try running curl if we can't use native WebClient

pull/825/head
Rick V 5 years ago
parent d1dd270bbb
commit ef4ccdc943
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

@ -1,5 +1,5 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
@ -58,54 +58,54 @@ namespace network.loki.lokinet.win32.ui
VisualSettings v = new VisualSettings();
v.ShowDialog();
v.Dispose();
}
private void BtnEditCfg_Click(object sender, EventArgs e)
{
try {
Process.Start(string.Format("{0}/lokinet.ini", config_path)); }
catch
{
MessageBox.Show("No existing config found");
BtnNewCfg_Click(sender, e);
}
}
private void BtnNewCfg_Click(object sender, EventArgs e)
{
if (File.Exists(string.Format("{0}/lokinet.ini", config_path)))
{
DialogResult resp = MessageBox.Show("WARNING: This will overwrite your existing config file, Continue?", "Lokinet", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(resp)
{
case DialogResult.Yes:
File.Delete(string.Format("{0}/lokinet.ini", config_path));
break;
case DialogResult.No:
return;
}
}
string lokinetExeString;
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet", Directory.GetCurrentDirectory());
Process p = new Process();
p.StartInfo.FileName = lokinetExeString;
p.StartInfo.Arguments = "-g";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(msg);
p.Start();
}
private void msg(object sender, EventArgs e)
{
MessageBox.Show(string.Format("Created new config file at {0}/lokinet.ini", config_path), "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
private void BtnEditCfg_Click(object sender, EventArgs e)
{
try {
Process.Start(string.Format("{0}/lokinet.ini", config_path)); }
catch
{
MessageBox.Show("No existing config found");
BtnNewCfg_Click(sender, e);
}
}
private void BtnNewCfg_Click(object sender, EventArgs e)
{
if (File.Exists(string.Format("{0}/lokinet.ini", config_path)))
{
DialogResult resp = MessageBox.Show("WARNING: This will overwrite your existing config file, Continue?", "Lokinet", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(resp)
{
case DialogResult.Yes:
File.Delete(string.Format("{0}/lokinet.ini", config_path));
break;
case DialogResult.No:
return;
}
}
string lokinetExeString;
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet", Directory.GetCurrentDirectory());
Process p = new Process();
p.StartInfo.FileName = lokinetExeString;
p.StartInfo.Arguments = "-g";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(msg);
p.Start();
}
private void msg(object sender, EventArgs e)
{
MessageBox.Show(string.Format("Created new config file at {0}/lokinet.ini", config_path), "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}

@ -1,4 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
@ -33,10 +35,32 @@ namespace network.loki.lokinet.win32.ui
MessageBox.Show("LokiNET node bootstrapped", "LokiNET", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
}
catch (NotSupportedException ex)
{
string lokinetExeString;
Process lokinet_bootstrap = new Process();
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet-bootstrap.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet-bootstrap", Directory.GetCurrentDirectory());
lokinet_bootstrap.StartInfo.UseShellExecute = false;
lokinet_bootstrap.StartInfo.CreateNoWindow = true;
lokinet_bootstrap.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
lokinet_bootstrap.StartInfo.FileName = lokinetExeString;
lokinet_bootstrap.StartInfo.Arguments = string.Format("--cacert rootcerts.pem -L {0} -o {1}", uriBox.Text, default_path);
lokinet_bootstrap.Start();
lokinet_bootstrap.WaitForExit();
if (lokinet_bootstrap.ExitCode == 0)
DialogResult = DialogResult.OK;
else
throw (ex); // pass the original exception back to the caller, TLS failed
}
catch (Exception ex)
{
{
MessageBox.Show(string.Format("An error occured while downloading data. {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
DialogResult = DialogResult.Abort;
DialogResult = DialogResult.Abort;
}
wc.Dispose();
Close();

Loading…
Cancel
Save