Add install option for app-updates

This commit is contained in:
CreepyCrafter24 2020-04-08 19:22:38 +02:00
parent a76a09051b
commit daca8d5b9a
2 changed files with 33 additions and 4 deletions

View File

@ -35,6 +35,7 @@
this.log = new System.Windows.Forms.Button();
this.startupBox = new System.Windows.Forms.CheckBox();
this.pathBox = new System.Windows.Forms.CheckBox();
this.updateAppsBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// install
@ -74,9 +75,9 @@
this.processLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.processLabel.ForeColor = System.Drawing.SystemColors.ControlText;
this.processLabel.Location = new System.Drawing.Point(258, 94);
this.processLabel.Location = new System.Drawing.Point(386, 91);
this.processLabel.Name = "processLabel";
this.processLabel.Size = new System.Drawing.Size(293, 19);
this.processLabel.Size = new System.Drawing.Size(165, 22);
this.processLabel.TabIndex = 3;
this.processLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
@ -102,6 +103,7 @@
this.startupBox.Size = new System.Drawing.Size(122, 19);
this.startupBox.TabIndex = 5;
this.startupBox.Text = "Update on Startup";
this.startupBox.CheckedChanged += new System.EventHandler(this.startupBox_CheckedChanged);
//
// pathBox
//
@ -114,11 +116,23 @@
this.pathBox.Text = "Register in PATH";
this.pathBox.CheckedChanged += new System.EventHandler(this.pathBox_CheckedChanged);
//
// updateAppsBox
//
this.updateAppsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.updateAppsBox.AutoSize = true;
this.updateAppsBox.Enabled = false;
this.updateAppsBox.Location = new System.Drawing.Point(258, 91);
this.updateAppsBox.Name = "updateAppsBox";
this.updateAppsBox.Size = new System.Drawing.Size(94, 19);
this.updateAppsBox.TabIndex = 5;
this.updateAppsBox.Text = "Update Apps";
//
// InstallerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(563, 156);
this.Controls.Add(this.updateAppsBox);
this.Controls.Add(this.log);
this.Controls.Add(this.processLabel);
this.Controls.Add(this.progress);
@ -144,6 +158,7 @@
private System.Windows.Forms.Button log;
private System.Windows.Forms.CheckBox pathBox;
private System.Windows.Forms.CheckBox startupBox;
private System.Windows.Forms.CheckBox updateAppsBox;
}
}

View File

@ -28,8 +28,9 @@ namespace Installer
Step(0, "Initialized");
_log = _log.TrimStart(Environment.NewLine.ToCharArray());
_rkApp = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
startupBox.Checked = _rkApp.GetValue(AppName) != null;
pathBox.Checked = Path.Content.Contains(Path.GetName(PathTool.GetRelative("Install")));
startupBox.Checked = pathBox.Checked && _rkApp.GetValue(AppName) != null;
updateAppsBox.Checked = pathBox.Checked && startupBox.Checked && (string)_rkApp.GetValue(AppName) == "uptool dist-upgrade";
}
private void install_Click(object sender, EventArgs e)
@ -76,7 +77,9 @@ Online: {meta.Element("Hash").Value.ToUpper()}");
if (!Path.Content.Contains(Path.GetName(PathTool.GetRelative("Install"))))
Path.Append(PathTool.GetRelative("Install"));
if (startupBox.Checked)
_rkApp.SetValue(AppName, "uptool upgrade-self");
{
_rkApp.SetValue(AppName, updateAppsBox.Checked ? "uptool dist-upgrade" : "uptool upgrade-self");
}
else if (_rkApp.GetValue(AppName) != null)
_rkApp.DeleteValue(AppName, false);
}
@ -119,7 +122,18 @@ Online: {meta.Element("Hash").Value.ToUpper()}");
{
startupBox.Enabled = pathBox.Checked;
if (!pathBox.Checked)
{
startupBox.Checked = false;
updateAppsBox.Checked = false;
updateAppsBox.Enabled = false;
}
}
private void startupBox_CheckedChanged(object sender, EventArgs e)
{
updateAppsBox.Enabled = startupBox.Checked;
if (!startupBox.Checked)
updateAppsBox.Checked = false;
}
}
}