diff --git a/CustomAppsAddForm.Designer.cs b/CustomAppsAddForm.Designer.cs index 19f68e9..9159380 100644 --- a/CustomAppsAddForm.Designer.cs +++ b/CustomAppsAddForm.Designer.cs @@ -38,9 +38,11 @@ this.commandTextBox = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label4 = new System.Windows.Forms.Label(); this.selectFileButton = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.label5 = new System.Windows.Forms.Label(); + this.argsTextBox = new System.Windows.Forms.TextBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -48,7 +50,7 @@ // this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.okButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.okButton.Location = new System.Drawing.Point(244, 160); + this.okButton.Location = new System.Drawing.Point(244, 190); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 4; @@ -61,7 +63,7 @@ this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancelButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.cancelButton.Location = new System.Drawing.Point(325, 160); + this.cancelButton.Location = new System.Drawing.Point(325, 190); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 5; @@ -116,14 +118,17 @@ this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(6, 74); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(54, 13); + this.label3.Size = new System.Drawing.Size(85, 13); this.label3.TabIndex = 10; - this.label3.Text = "Command"; + this.label3.Text = "Executable Path"; // // groupBox1 // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.argsTextBox); this.groupBox1.Controls.Add(this.selectFileButton); this.groupBox1.Controls.Add(this.nameTextBox); this.groupBox1.Controls.Add(this.label3); @@ -131,29 +136,16 @@ this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.protocolTextBox); this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Location = new System.Drawing.Point(12, 56); + this.groupBox1.Location = new System.Drawing.Point(12, 57); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(388, 98); + this.groupBox1.Size = new System.Drawing.Size(388, 127); this.groupBox1.TabIndex = 12; this.groupBox1.TabStop = false; this.groupBox1.Text = "Application"; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label4.Location = new System.Drawing.Point(12, 9); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(388, 44); - this.label4.TabIndex = 13; - this.label4.Text = "Enter a friendly name, protocol (like HTTP, RDP, VNC) and the command line and ar" + - "guments to run the application. In the command line, use %L for address and %P f" + - "or connection port."; // // selectFileButton // - this.selectFileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.selectFileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.selectFileButton.Location = new System.Drawing.Point(360, 71); this.selectFileButton.Name = "selectFileButton"; this.selectFileButton.Size = new System.Drawing.Size(21, 20); @@ -161,20 +153,49 @@ this.selectFileButton.Text = "..."; this.selectFileButton.UseVisualStyleBackColor = true; this.selectFileButton.Click += new System.EventHandler(this.selectFileButton_Click); + // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label4.Location = new System.Drawing.Point(12, 9); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(388, 45); + this.label4.TabIndex = 13; + this.label4.Text = "Enter a friendly name, protocol (like HTTP, RDP, VNC) and the command line and ar" + + "guments to run the application. In the arguments, use %L for address, %P for con" + + "nection port and %N for computer name."; // // openFileDialog // this.openFileDialog.DefaultExt = "exe"; - this.openFileDialog.Filter = "Executable|*.exe"; + this.openFileDialog.Filter = "Executable|*.exe|All Files|*.*"; this.openFileDialog.Title = "Select Application Executable"; // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 100); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(57, 13); + this.label5.TabIndex = 13; + this.label5.Text = "Arguments"; + // + // argsTextBox + // + this.argsTextBox.Location = new System.Drawing.Point(116, 97); + this.argsTextBox.Name = "argsTextBox"; + this.argsTextBox.Size = new System.Drawing.Size(265, 20); + this.argsTextBox.TabIndex = 14; + this.argsTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged); + // // CustomAppsAddForm // this.AcceptButton = this.okButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(412, 195); + this.ClientSize = new System.Drawing.Size(412, 225); this.Controls.Add(this.label4); this.Controls.Add(this.groupBox1); this.Controls.Add(this.okButton); @@ -207,5 +228,7 @@ private System.Windows.Forms.Label label4; private System.Windows.Forms.Button selectFileButton; private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox argsTextBox; } } \ No newline at end of file diff --git a/CustomAppsAddForm.cs b/CustomAppsAddForm.cs index 07ca7cb..136fa48 100644 --- a/CustomAppsAddForm.cs +++ b/CustomAppsAddForm.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.IO; using System.Windows.Forms; namespace MeshCentralRouter @@ -27,6 +21,11 @@ namespace MeshCentralRouter get { return commandTextBox.Text; } set { commandTextBox.Text = value; updateInfo(); } } + public string appArgs + { + get { return argsTextBox.Text; } + set { argsTextBox.Text = value; updateInfo(); } + } public CustomAppsAddForm() { @@ -35,7 +34,7 @@ namespace MeshCentralRouter public void updateInfo() { - okButton.Enabled = (nameTextBox.Text.Length > 0) && (protocolTextBox.Text.Length > 0) && (commandTextBox.Text.Length > 0) && (nameTextBox.Text.IndexOf(' ') == -1) && (protocolTextBox.Text.IndexOf(' ') == -1); + okButton.Enabled = (nameTextBox.Text.Length > 0) && (protocolTextBox.Text.Length > 0) && (commandTextBox.Text.Length > 0) && (nameTextBox.Text.IndexOf(' ') == -1) && (protocolTextBox.Text.IndexOf(' ') == -1) && (File.Exists(commandTextBox.Text)); } private void CustomAppsAddForm_Load(object sender, EventArgs e) diff --git a/CustomAppsForm.cs b/CustomAppsForm.cs index 6403d6d..11530dd 100644 --- a/CustomAppsForm.cs +++ b/CustomAppsForm.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; using System.Diagnostics; +using System.Windows.Forms; +using System.ComponentModel; +using System.Collections.Generic; namespace MeshCentralRouter { @@ -23,7 +18,17 @@ namespace MeshCentralRouter private void CustomAppsForm_Load(object sender, EventArgs e) { - if (apps != null) { foreach (string[] app in apps) { mainListView.Items.Add(new ListViewItem(app)); } } + if (apps != null) { + foreach (string[] app in apps) { + string[] x = new string[5]; + x[0] = app[0]; + x[1] = app[1]; + x[2] = "\"" + app[2] + "\" " + app[3]; + x[3] = app[2]; + x[4] = app[3]; + mainListView.Items.Add(new ListViewItem(x)); + } + } UpdateInfo(); } @@ -32,10 +37,11 @@ namespace MeshCentralRouter List r = new List(); foreach (ListViewItem l in mainListView.Items) { - string[] x = new string[3]; + string[] x = new string[4]; x[0] = l.SubItems[0].Text; x[1] = l.SubItems[1].Text.ToLower(); - x[2] = l.SubItems[2].Text; + x[2] = l.SubItems[3].Text; + x[3] = l.SubItems[4].Text; r.Add(x); } return r; @@ -52,10 +58,12 @@ namespace MeshCentralRouter foreach (ListViewItem l in list) { mainListView.Items.Remove(l); } // Add the new protocol - string[] x = new string[3]; + string[] x = new string[5]; x[0] = f.appName; x[1] = f.appProtocol.ToLower(); - x[2] = f.appCommand; + x[2] = "\"" + f.appCommand + "\" " + f.appArgs; + x[3] = f.appCommand; + x[4] = f.appArgs; mainListView.Items.Add(new ListViewItem(x)); } } @@ -99,8 +107,8 @@ namespace MeshCentralRouter { if (mainListView.SelectedItems.Count != 1) return; ListViewItem i = mainListView.SelectedItems[0]; - CustomAppsRunForm f = new CustomAppsRunForm(i.SubItems[2].Text); - if (f.ShowDialog(this) == DialogResult.OK) { Process.Start(f.getFinalCommand()); } + CustomAppsRunForm f = new CustomAppsRunForm(i.SubItems[3].Text, i.SubItems[4].Text); + if (f.ShowDialog(this) == DialogResult.OK) { Process.Start(i.SubItems[3].Text, f.getFinalArgs()); } } private void editToolStripMenuItem_Click(object sender, EventArgs e) @@ -110,7 +118,8 @@ namespace MeshCentralRouter CustomAppsAddForm f = new CustomAppsAddForm(); f.appName = i.SubItems[0].Text; f.appProtocol = i.SubItems[1].Text; - f.appCommand = i.SubItems[2].Text; + f.appCommand = i.SubItems[3].Text; + f.appArgs = i.SubItems[4].Text; if (f.ShowDialog(this) == DialogResult.OK) { // Remove any matching protocol @@ -119,13 +128,14 @@ namespace MeshCentralRouter foreach (ListViewItem l in list) { mainListView.Items.Remove(l); } // Add the new protocol - string[] x = new string[3]; + string[] x = new string[5]; x[0] = f.appName; x[1] = f.appProtocol.ToLower(); - x[2] = f.appCommand; + x[2] = "\"" + f.appCommand + "\" " + f.appArgs; + x[3] = f.appCommand; + x[4] = f.appArgs; mainListView.Items.Add(new ListViewItem(x)); } - } } } diff --git a/CustomAppsRunForm.Designer.cs b/CustomAppsRunForm.Designer.cs index 0886598..3dc16e6 100644 --- a/CustomAppsRunForm.Designer.cs +++ b/CustomAppsRunForm.Designer.cs @@ -39,6 +39,10 @@ this.okButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); + this.argsTextBox = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.nameTextBox = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -47,6 +51,10 @@ this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.nameTextBox); + this.groupBox1.Controls.Add(this.label6); + this.groupBox1.Controls.Add(this.argsTextBox); + this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.portTextBox); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.addressTextBox); @@ -55,16 +63,16 @@ this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(12, 49); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(382, 101); + this.groupBox1.Size = new System.Drawing.Size(382, 155); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; - this.groupBox1.Text = "Application Command Line"; + this.groupBox1.Text = "Application Command"; // // portTextBox // this.portTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.portTextBox.Location = new System.Drawing.Point(116, 71); + this.portTextBox.Location = new System.Drawing.Point(116, 97); this.portTextBox.Name = "portTextBox"; this.portTextBox.Size = new System.Drawing.Size(260, 20); this.portTextBox.TabIndex = 13; @@ -74,17 +82,17 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 74); + this.label4.Location = new System.Drawing.Point(6, 100); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(26, 13); + this.label4.Size = new System.Drawing.Size(44, 13); this.label4.TabIndex = 12; - this.label4.Text = "Port"; + this.label4.Text = "Port %P"; // // addressTextBox // this.addressTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.addressTextBox.Location = new System.Drawing.Point(116, 45); + this.addressTextBox.Location = new System.Drawing.Point(116, 71); this.addressTextBox.Name = "addressTextBox"; this.addressTextBox.Size = new System.Drawing.Size(260, 20); this.addressTextBox.TabIndex = 11; @@ -94,11 +102,11 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 48); + this.label3.Location = new System.Drawing.Point(6, 74); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(45, 13); + this.label3.Size = new System.Drawing.Size(62, 13); this.label3.TabIndex = 10; - this.label3.Text = "Address"; + this.label3.Text = "Address %L"; // // commandTextBox // @@ -122,7 +130,7 @@ // okButton // this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.okButton.Location = new System.Drawing.Point(238, 156); + this.okButton.Location = new System.Drawing.Point(238, 210); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 3; @@ -134,7 +142,7 @@ // this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(319, 156); + this.cancelButton.Location = new System.Drawing.Point(319, 210); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 2; @@ -150,8 +158,46 @@ this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(382, 35); this.label1.TabIndex = 4; - this.label1.Text = "Test that the application runs correctly by specifying and address and port and c" + - "lick ok to run the application."; + this.label1.Text = "Test that the application runs correctly by specifying and address, port and name" + + ". Then click ok to run the application."; + // + // argsTextBox + // + this.argsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.argsTextBox.Location = new System.Drawing.Point(116, 45); + this.argsTextBox.Name = "argsTextBox"; + this.argsTextBox.ReadOnly = true; + this.argsTextBox.Size = new System.Drawing.Size(260, 20); + this.argsTextBox.TabIndex = 15; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 48); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(57, 13); + this.label5.TabIndex = 14; + this.label5.Text = "Arguments"; + // + // nameTextBox + // + this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nameTextBox.Location = new System.Drawing.Point(116, 123); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(260, 20); + this.nameTextBox.TabIndex = 17; + this.nameTextBox.Text = "MyComputer"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 126); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(54, 13); + this.label6.TabIndex = 16; + this.label6.Text = "Name %N"; // // CustomAppsRunForm // @@ -159,7 +205,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(406, 191); + this.ClientSize = new System.Drawing.Size(406, 245); this.Controls.Add(this.label1); this.Controls.Add(this.okButton); this.Controls.Add(this.cancelButton); @@ -189,5 +235,9 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox commandTextBox; private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox argsTextBox; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label label6; } } \ No newline at end of file diff --git a/CustomAppsRunForm.cs b/CustomAppsRunForm.cs index a3862a2..647c572 100644 --- a/CustomAppsRunForm.cs +++ b/CustomAppsRunForm.cs @@ -13,21 +13,24 @@ namespace MeshCentralRouter public partial class CustomAppsRunForm : Form { private string command = null; + private string args = null; - public CustomAppsRunForm(string command) + public CustomAppsRunForm(string command, string args) { this.command = command; + this.args = args; InitializeComponent(); } - public string getFinalCommand() + public string getFinalArgs() { - return command.Replace("%L", addressTextBox.Text).Replace("%P", portTextBox.Text); + return args.Replace("%L", addressTextBox.Text).Replace("%P", portTextBox.Text).Replace("%N", nameTextBox.Text); } public void UpdateInfo() { - commandTextBox.Text = getFinalCommand(); + commandTextBox.Text = command; + argsTextBox.Text = getFinalArgs(); } private void addressTextBox_TextChanged(object sender, EventArgs e) diff --git a/MapUserControl.cs b/MapUserControl.cs index 70bd89e..a1c75be 100644 --- a/MapUserControl.cs +++ b/MapUserControl.cs @@ -131,18 +131,13 @@ namespace MeshCentralRouter { if (appIdStr == null) return; string appCmd = null; - List apps = Settings.GetApplications(); - foreach (String[] app in apps) { if (app[1].ToLower() == appIdStr.ToLower()) { appCmd = app[2]; } } - appCmd = appCmd.Replace("%P", mapper.localport.ToString()).Replace("%L", "127.0.0.1"); string appArgs = null; - int i = appCmd.IndexOf(' '); - if (i >= 0) { appArgs = appCmd.Substring(i + 1); appCmd = appCmd.Substring(0, i); } - if (appCmd != null) - { + List apps = Settings.GetApplications(); + foreach (String[] app in apps) { if (app[1].ToLower() == appIdStr.ToLower()) { appCmd = app[2]; if (app[3] != null) { appArgs = app[3].Replace("%P", mapper.localport.ToString()).Replace("%L", "127.0.0.1").Replace("%N", "xxx"); } } } + if (appCmd != null) { // Launch the process System.Diagnostics.Process proc = null; try { proc = System.Diagnostics.Process.Start(appCmd, appArgs); } catch (System.ComponentModel.Win32Exception) { } - // Setup auto-exit if ((autoexit == true) && (parent.autoExitProc == null)) { parent.autoExitProc = proc; parent.SetAutoClose(); autoExitTimer.Enabled = true; } autoexit = false; diff --git a/Settings.cs b/Settings.cs index f21fa91..a19886d 100644 --- a/Settings.cs +++ b/Settings.cs @@ -66,6 +66,7 @@ namespace MeshCentralRouter { skey.SetValue("Protocol", app[1]); skey.SetValue("Command", app[2]); + skey.SetValue("Arguments", app[3]); } } } @@ -83,10 +84,12 @@ namespace MeshCentralRouter { string protocol = (string)key2.GetValue("Protocol"); string command = (string)key2.GetValue("Command"); - String[] a = new string[3]; + string args = (string)key2.GetValue("Arguments"); + String[] a = new string[4]; a[0] = k; a[1] = protocol; a[2] = command; + a[3] = args; apps.Add(a); } } @@ -94,8 +97,6 @@ namespace MeshCentralRouter return apps; } - //public static void DeleteSubKeyTree(RegistryKey key, string subkey) { if (key.OpenSubKey(subkey) == null) { return; } DeleteSubKeyTree(key, subkey); } - public static void ClearApplications() { RegistryKey key = Registry.CurrentUser.CreateSubKey(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", true);