1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2026-01-03 08:53:13 +00:00

Improved self-update system.

This commit is contained in:
Ylian Saint-Hilaire
2022-05-24 16:52:58 -07:00
parent 3a1e8671be
commit 85657d2857
10 changed files with 167 additions and 19 deletions

View File

@@ -38,6 +38,7 @@
this.exp_KeyboardHookCheckBox = new System.Windows.Forms.CheckBox();
this.exp_KeyboardHookPriorityCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkForUpdatedCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
@@ -45,6 +46,7 @@
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.checkForUpdatedCheckBox);
this.groupBox1.Controls.Add(this.systemTrayCheckBox);
this.groupBox1.Controls.Add(this.doubleClickComboBox);
this.groupBox1.Controls.Add(this.label1);
@@ -113,6 +115,12 @@
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// checkForUpdatedCheckBox
//
resources.ApplyResources(this.checkForUpdatedCheckBox, "checkForUpdatedCheckBox");
this.checkForUpdatedCheckBox.Name = "checkForUpdatedCheckBox";
this.checkForUpdatedCheckBox.UseVisualStyleBackColor = true;
//
// DeviceSettingsForm
//
this.AcceptButton = this.okButton;
@@ -146,5 +154,6 @@
private System.Windows.Forms.CheckBox exp_KeyboardHookCheckBox;
private System.Windows.Forms.CheckBox exp_KeyboardHookPriorityCheckBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox checkForUpdatedCheckBox;
}
}

View File

@@ -40,6 +40,12 @@ namespace MeshCentralRouter
set { systemTrayCheckBox.Checked = value; }
}
public bool CheckForUpdates
{
get { return checkForUpdatedCheckBox.Checked; }
set { checkForUpdatedCheckBox.Checked = value; }
}
public bool Exp_KeyboardHook
{
get { return exp_KeyboardHookCheckBox.Checked; }

View File

@@ -122,13 +122,43 @@
<value>Top, Left, Right</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="checkForUpdatedCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkForUpdatedCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="checkForUpdatedCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>14, 93</value>
</data>
<data name="checkForUpdatedCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 17</value>
</data>
<data name="checkForUpdatedCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="checkForUpdatedCheckBox.Text" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Name" xml:space="preserve">
<value>checkForUpdatedCheckBox</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="systemTrayCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="systemTrayCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="systemTrayCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>14, 70</value>
</data>
@@ -151,7 +181,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;systemTrayCheckBox.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="doubleClickComboBox.Items" xml:space="preserve">
<value>Add Map...</value>
@@ -196,7 +226,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;doubleClickComboBox.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -223,13 +253,13 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>294, 97</value>
<value>294, 117</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@@ -256,7 +286,7 @@
<value>NoControl</value>
</data>
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 193</value>
<value>150, 211</value>
</data>
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@@ -286,7 +316,7 @@
<value>NoControl</value>
</data>
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>231, 193</value>
<value>231, 211</value>
</data>
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@@ -373,10 +403,10 @@
<value>Top, Bottom, Left, Right</value>
</data>
<data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 115</value>
<value>12, 135</value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>294, 72</value>
<value>294, 70</value>
</data>
<data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
@@ -403,7 +433,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>318, 228</value>
<value>318, 246</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@@ -49,7 +49,7 @@ namespace MeshCentralRouter
public bool forceExit = false;
public bool sendEmailToken = false;
public bool sendSMSToken = false;
public bool allowUpdates = true;
public bool allowUpdates = Settings.GetRegValue("CheckForUpdates", true);
public Uri authLoginUrl = null;
public Process installProcess = null;
public string acceptableCertHash = null;
@@ -1566,10 +1566,14 @@ namespace MeshCentralRouter
SettingsForm f = new SettingsForm();
f.BindAllInterfaces = inaddrany;
f.ShowSystemTray = (notifyIcon.Visible == true);
f.CheckForUpdates = Settings.GetRegValue("CheckForUpdates", true);
if (f.ShowDialog(this) == DialogResult.OK)
{
inaddrany = f.BindAllInterfaces;
Settings.SetRegValue("CheckForUpdates", f.CheckForUpdates);
allowUpdates = f.CheckForUpdates;
if (f.ShowSystemTray)
{
notifyIcon.Visible = true;
@@ -2158,9 +2162,12 @@ namespace MeshCentralRouter
f.ShowSystemTray = (notifyIcon.Visible == true);
f.Exp_KeyboardHookPriority = Settings.GetRegValue("Exp_KeyboardHookPriority", false);
f.Exp_KeyboardHook = Settings.GetRegValue("Exp_KeyboardHook", false);
f.CheckForUpdates = Settings.GetRegValue("CheckForUpdates", true);
if (f.ShowDialog(this) == DialogResult.OK)
{
Settings.SetRegValue("CheckForUpdates", f.CheckForUpdates);
allowUpdates = f.CheckForUpdates;
deviceDoubleClickAction = f.deviceDoubleClickAction;
Settings.SetRegValue("DevDoubleClickClickAction", deviceDoubleClickAction.ToString());
Settings.SetRegValue("Exp_KeyboardHook", f.Exp_KeyboardHook.ToString().ToLower());

View File

@@ -34,6 +34,7 @@
this.allInterfacesCheckBox = new System.Windows.Forms.CheckBox();
this.systemTrayCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.checkForUpdatedCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@@ -67,11 +68,18 @@
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.checkForUpdatedCheckBox);
this.groupBox1.Controls.Add(this.systemTrayCheckBox);
this.groupBox1.Controls.Add(this.allInterfacesCheckBox);
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// checkForUpdatedCheckBox
//
resources.ApplyResources(this.checkForUpdatedCheckBox, "checkForUpdatedCheckBox");
this.checkForUpdatedCheckBox.Name = "checkForUpdatedCheckBox";
this.checkForUpdatedCheckBox.UseVisualStyleBackColor = true;
//
// SettingsForm
//
this.AcceptButton = this.okButton;
@@ -98,5 +106,6 @@
private System.Windows.Forms.CheckBox allInterfacesCheckBox;
private System.Windows.Forms.CheckBox systemTrayCheckBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkForUpdatedCheckBox;
}
}

View File

@@ -38,6 +38,12 @@ namespace MeshCentralRouter
set { systemTrayCheckBox.Checked = value; }
}
public bool CheckForUpdates
{
get { return checkForUpdatedCheckBox.Checked; }
set { checkForUpdatedCheckBox.Checked = value; }
}
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;

View File

@@ -123,7 +123,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>231, 92</value>
<value>231, 113</value>
</data>
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@@ -151,7 +151,7 @@
<value>Bottom, Right</value>
</data>
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 92</value>
<value>150, 113</value>
</data>
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@@ -202,7 +202,7 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;allInterfacesCheckBox.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="systemTrayCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -232,16 +232,46 @@
<value>groupBox1</value>
</data>
<data name="&gt;&gt;systemTrayCheckBox.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="checkForUpdatedCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkForUpdatedCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="checkForUpdatedCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 68</value>
</data>
<data name="checkForUpdatedCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 17</value>
</data>
<data name="checkForUpdatedCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="checkForUpdatedCheckBox.Text" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Name" xml:space="preserve">
<value>checkForUpdatedCheckBox</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>294, 74</value>
<value>294, 95</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -268,7 +298,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>318, 127</value>
<value>318, 148</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@@ -35,6 +35,7 @@
this.updateProgressBar = new System.Windows.Forms.ProgressBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.mainLabel = new System.Windows.Forms.Label();
this.checkForUpdatedCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
@@ -45,6 +46,7 @@
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Name = "cancelButton";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
@@ -79,12 +81,19 @@
resources.ApplyResources(this.mainLabel, "mainLabel");
this.mainLabel.Name = "mainLabel";
//
// checkForUpdatedCheckBox
//
resources.ApplyResources(this.checkForUpdatedCheckBox, "checkForUpdatedCheckBox");
this.checkForUpdatedCheckBox.Name = "checkForUpdatedCheckBox";
this.checkForUpdatedCheckBox.UseVisualStyleBackColor = true;
//
// UpdateForm
//
this.AcceptButton = this.okButton;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.Controls.Add(this.checkForUpdatedCheckBox);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
@@ -95,6 +104,7 @@
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -106,5 +116,6 @@
private System.Windows.Forms.Label mainLabel;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ProgressBar updateProgressBar;
private System.Windows.Forms.CheckBox checkForUpdatedCheckBox;
}
}

View File

@@ -53,10 +53,13 @@ namespace MeshCentralRouter
if (lines[5] != "") { mainLabel.Text = lines[5]; }
}
catch (Exception) { }
checkForUpdatedCheckBox.Checked = Settings.GetRegValue("CheckForUpdates", true);
}
private void okButton_Click(object sender, EventArgs e)
{
Settings.SetRegValue("CheckForUpdates", checkForUpdatedCheckBox.Checked);
DownloadUpdate();
}
@@ -165,5 +168,9 @@ namespace MeshCentralRouter
return Result.ToString();
}
private void cancelButton_Click(object sender, EventArgs e)
{
Settings.SetRegValue("CheckForUpdates", checkForUpdatedCheckBox.Checked);
}
}
}

View File

@@ -145,7 +145,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cancelButton.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
@@ -172,7 +172,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;okButton.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
@@ -283,6 +283,39 @@
<value>$this</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="checkForUpdatedCheckBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="checkForUpdatedCheckBox.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="checkForUpdatedCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="checkForUpdatedCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 161</value>
</data>
<data name="checkForUpdatedCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>171, 17</value>
</data>
<data name="checkForUpdatedCheckBox.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="checkForUpdatedCheckBox.Text" xml:space="preserve">
<value>Continue checking for updates</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Name" xml:space="preserve">
<value>checkForUpdatedCheckBox</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;checkForUpdatedCheckBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">