mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
add config file options
This commit is contained in:
parent
7b70b52044
commit
6b2874824e
13
ui-win32/UserSettings.Designer.cs
generated
13
ui-win32/UserSettings.Designer.cs
generated
|
@ -33,6 +33,7 @@
|
|||
this.btnDumpLog = new System.Windows.Forms.Button();
|
||||
this.btnVSettings = new System.Windows.Forms.Button();
|
||||
this.btnEditCfg = new System.Windows.Forms.Button();
|
||||
this.btnNewCfg = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnOK
|
||||
|
@ -87,6 +88,16 @@
|
|||
this.btnEditCfg.UseVisualStyleBackColor = true;
|
||||
this.btnEditCfg.Click += new System.EventHandler(this.BtnEditCfg_Click);
|
||||
//
|
||||
// btnNewCfg
|
||||
//
|
||||
this.btnNewCfg.Location = new System.Drawing.Point(12, 131);
|
||||
this.btnNewCfg.Name = "btnNewCfg";
|
||||
this.btnNewCfg.Size = new System.Drawing.Size(270, 23);
|
||||
this.btnNewCfg.TabIndex = 5;
|
||||
this.btnNewCfg.Text = "New Configuration File...";
|
||||
this.btnNewCfg.UseVisualStyleBackColor = true;
|
||||
this.btnNewCfg.Click += new System.EventHandler(this.BtnNewCfg_Click);
|
||||
//
|
||||
// UserSettingsForm
|
||||
//
|
||||
this.AcceptButton = this.btnOK;
|
||||
|
@ -95,6 +106,7 @@
|
|||
this.CancelButton = this.btnOK;
|
||||
this.ClientSize = new System.Drawing.Size(295, 202);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnNewCfg);
|
||||
this.Controls.Add(this.btnEditCfg);
|
||||
this.Controls.Add(this.btnVSettings);
|
||||
this.Controls.Add(this.btnDumpLog);
|
||||
|
@ -120,5 +132,6 @@
|
|||
private System.Windows.Forms.Button btnDumpLog;
|
||||
private System.Windows.Forms.Button btnVSettings;
|
||||
private System.Windows.Forms.Button btnEditCfg;
|
||||
private System.Windows.Forms.Button btnNewCfg;
|
||||
}
|
||||
}
|
|
@ -62,7 +62,50 @@ namespace network.loki.lokinet.win32.ui
|
|||
|
||||
private void BtnEditCfg_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start(string.Format("{0}/lokinet.ini", config_path));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue