From 25c8b207b2fee0c350208b7c6487bf135ea47ca9 Mon Sep 17 00:00:00 2001 From: Troy Cook Date: Sun, 9 Aug 2020 21:27:25 -0500 Subject: [PATCH] Friendly name comments Signed-off-by: Troy Cook --- AddPortMapForm.Designer.cs | 16 +++++ AddPortMapForm.cs | 1 + AddPortMapForm.resx | 114 ++++++++++++++++++++++++--------- AddRelayMapForm.Designer.cs | 16 +++++ AddRelayMapForm.cs | 1 + AddRelayMapForm.resx | 124 ++++++++++++++++++++++++++---------- MainForm.cs | 4 ++ MapUserControl.cs | 10 ++- 8 files changed, 220 insertions(+), 66 deletions(-) diff --git a/AddPortMapForm.Designer.cs b/AddPortMapForm.Designer.cs index bf9f61a..451de07 100644 --- a/AddPortMapForm.Designer.cs +++ b/AddPortMapForm.Designer.cs @@ -44,6 +44,8 @@ this.label6 = new System.Windows.Forms.Label(); this.tcpRadioButton = new System.Windows.Forms.RadioButton(); this.udpRadioButton = new System.Windows.Forms.RadioButton(); + this.ruleNameTextBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.localNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.remoteNumericUpDown)).BeginInit(); this.SuspendLayout(); @@ -169,12 +171,24 @@ this.udpRadioButton.UseVisualStyleBackColor = true; this.udpRadioButton.CheckedChanged += new System.EventHandler(this.tcpRadioButton_CheckedChanged); // + // ruleNameTextBox + // + resources.ApplyResources(this.ruleNameTextBox, "ruleNameTextBox"); + this.ruleNameTextBox.Name = "ruleNameTextBox"; + // + // label8 + // + resources.ApplyResources(this.label8, "label8"); + this.label8.Name = "label8"; + // // AddPortMapForm // this.AcceptButton = this.okButton; resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; + this.Controls.Add(this.ruleNameTextBox); + this.Controls.Add(this.label8); this.Controls.Add(this.udpRadioButton); this.Controls.Add(this.tcpRadioButton); this.Controls.Add(this.label6); @@ -219,5 +233,7 @@ private System.Windows.Forms.Label label6; private System.Windows.Forms.RadioButton tcpRadioButton; private System.Windows.Forms.RadioButton udpRadioButton; + private System.Windows.Forms.TextBox ruleNameTextBox; + private System.Windows.Forms.Label label8; } } \ No newline at end of file diff --git a/AddPortMapForm.cs b/AddPortMapForm.cs index 9895a74..9537348 100644 --- a/AddPortMapForm.cs +++ b/AddPortMapForm.cs @@ -21,6 +21,7 @@ namespace MeshCentralRouter InitializeComponent(); } + public string getRuleName() { return ruleNameTextBox.Text; } public int getProtocol() { return (int)(tcpRadioButton.Checked?1:2); } public int getLocalPort() { return (int)localNumericUpDown.Value; } public int getRemotePort() { return (int)remoteNumericUpDown.Value; } diff --git a/AddPortMapForm.resx b/AddPortMapForm.resx index 87424f7..99d8fef 100644 --- a/AddPortMapForm.resx +++ b/AddPortMapForm.resx @@ -123,7 +123,7 @@ - 288, 167 + 288, 194 75, 23 @@ -145,13 +145,13 @@ $this - 14 + 16 Bottom, Right - 207, 167 + 207, 194 75, 23 @@ -172,13 +172,13 @@ $this - 13 + 15 Top, Left, Right - 157, 33 + 157, 60 206, 20 @@ -199,13 +199,13 @@ $this - 12 + 14 True - 12, 35 + 12, 62 55, 13 @@ -226,13 +226,13 @@ $this - 11 + 13 Top, Left, Right - 157, 86 + 157, 113 206, 21 @@ -250,13 +250,13 @@ $this - 10 + 12 True - 12, 89 + 12, 116 81, 13 @@ -277,13 +277,13 @@ $this - 9 + 11 True - 12, 142 + 12, 169 66, 13 @@ -304,13 +304,13 @@ $this - 7 + 9 Top, Left, Right - 157, 140 + 157, 167 206, 20 @@ -331,13 +331,13 @@ $this - 8 + 10 True - 12, 116 + 12, 143 59, 13 @@ -358,7 +358,7 @@ $this - 5 + 7 Top, Left, Right @@ -382,7 +382,7 @@ WinSCP - 157, 113 + 157, 140 206, 21 @@ -400,13 +400,13 @@ $this - 6 + 8 True - 12, 62 + 12, 89 73, 13 @@ -427,13 +427,13 @@ $this - 3 + 5 Top, Left, Right - 157, 59 + 157, 86 206, 21 @@ -451,13 +451,13 @@ $this - 4 + 6 True - 12, 9 + 12, 36 46, 13 @@ -478,13 +478,13 @@ $this - 2 + 4 True - 157, 9 + 157, 36 46, 17 @@ -505,13 +505,13 @@ $this - 1 + 3 True - 209, 9 + 209, 36 48, 17 @@ -532,8 +532,62 @@ $this + 2 + + + Top, Left, Right + + + 157, 10 + + + 206, 20 + + + 20 + + + ruleNameTextBox + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 0 + + True + + + NoControl + + + 12, 13 + + + 60, 13 + + + 19 + + + Rule Name + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + True @@ -541,7 +595,7 @@ 6, 13 - 375, 202 + 375, 229 diff --git a/AddRelayMapForm.Designer.cs b/AddRelayMapForm.Designer.cs index 6c1d390..cfff2ff 100644 --- a/AddRelayMapForm.Designer.cs +++ b/AddRelayMapForm.Designer.cs @@ -46,6 +46,8 @@ this.udpRadioButton = new System.Windows.Forms.RadioButton(); this.tcpRadioButton = new System.Windows.Forms.RadioButton(); this.label7 = new System.Windows.Forms.Label(); + this.ruleNameTextBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.localNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.remoteNumericUpDown)).BeginInit(); this.SuspendLayout(); @@ -181,12 +183,24 @@ resources.ApplyResources(this.label7, "label7"); this.label7.Name = "label7"; // + // ruleNameTextBox + // + resources.ApplyResources(this.ruleNameTextBox, "ruleNameTextBox"); + this.ruleNameTextBox.Name = "ruleNameTextBox"; + // + // label8 + // + resources.ApplyResources(this.label8, "label8"); + this.label8.Name = "label8"; + // // AddRelayMapForm // this.AcceptButton = this.okButton; resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; + this.Controls.Add(this.ruleNameTextBox); + this.Controls.Add(this.label8); this.Controls.Add(this.udpRadioButton); this.Controls.Add(this.tcpRadioButton); this.Controls.Add(this.label7); @@ -235,5 +249,7 @@ private System.Windows.Forms.RadioButton udpRadioButton; private System.Windows.Forms.RadioButton tcpRadioButton; private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox ruleNameTextBox; + private System.Windows.Forms.Label label8; } } \ No newline at end of file diff --git a/AddRelayMapForm.cs b/AddRelayMapForm.cs index 9f562ce..81eb8f0 100644 --- a/AddRelayMapForm.cs +++ b/AddRelayMapForm.cs @@ -23,6 +23,7 @@ namespace MeshCentralRouter updateInfo(); } + public string getRuleName() { return ruleNameTextBox.Text; } public int getProtocol() { return (int)(tcpRadioButton.Checked ? 1 : 2); } public int getLocalPort() { return (int)localNumericUpDown.Value; } public int getRemotePort() { return (int)remoteNumericUpDown.Value; } diff --git a/AddRelayMapForm.resx b/AddRelayMapForm.resx index 256cbe6..2b59855 100644 --- a/AddRelayMapForm.resx +++ b/AddRelayMapForm.resx @@ -123,7 +123,7 @@ - 288, 193 + 288, 220 75, 23 @@ -145,13 +145,13 @@ $this - 16 + 18 Bottom, Right - 207, 193 + 207, 220 75, 23 @@ -172,13 +172,13 @@ $this - 15 + 17 Top, Left, Right - 157, 32 + 157, 59 206, 20 @@ -199,13 +199,13 @@ $this - 14 + 16 True - 12, 34 + 12, 61 55, 13 @@ -226,13 +226,13 @@ $this - 13 + 15 Top, Left, Right - 157, 85 + 157, 112 206, 21 @@ -250,13 +250,13 @@ $this - 12 + 14 True - 12, 88 + 12, 115 71, 13 @@ -277,13 +277,13 @@ $this - 11 + 13 True - 12, 167 + 12, 194 66, 13 @@ -304,13 +304,13 @@ $this - 9 + 11 Top, Left, Right - 157, 165 + 157, 192 206, 20 @@ -331,13 +331,13 @@ $this - 10 + 12 True - 12, 115 + 12, 142 59, 13 @@ -358,7 +358,7 @@ $this - 7 + 9 Top, Left, Right @@ -382,7 +382,7 @@ WinSCP - 157, 112 + 157, 139 206, 21 @@ -400,13 +400,13 @@ $this - 8 + 10 True - 12, 142 + 12, 169 57, 13 @@ -427,13 +427,13 @@ $this - 6 + 8 Top, Left, Right - 157, 139 + 157, 166 206, 20 @@ -457,13 +457,13 @@ $this - 5 + 7 True - 12, 61 + 12, 88 73, 13 @@ -484,13 +484,13 @@ $this - 3 + 5 Top, Left, Right - 157, 58 + 157, 85 206, 21 @@ -508,13 +508,13 @@ $this - 4 + 6 True - 209, 9 + 209, 36 48, 17 @@ -535,13 +535,13 @@ $this - 0 + 2 True - 157, 9 + 157, 36 46, 17 @@ -562,13 +562,13 @@ $this - 1 + 3 True - 12, 9 + 12, 36 46, 13 @@ -589,7 +589,61 @@ $this - 2 + 4 + + + Top, Left, Right + + + 157, 10 + + + 206, 20 + + + 18 + + + ruleNameTextBox + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + NoControl + + + 12, 13 + + + 60, 13 + + + 17 + + + Rule Name + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 True @@ -598,7 +652,7 @@ 6, 13 - 375, 228 + 375, 255 diff --git a/MainForm.cs b/MainForm.cs index 97fab70..8c90604 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -814,6 +814,7 @@ namespace MeshCentralRouter MapUserControl map = new MapUserControl(); map.xdebug = debug; map.inaddrany = inaddrany; + map.ruleName = form.getRuleName(); map.protocol = form.getProtocol(); map.localPort = form.getLocalPort(); map.remotePort = form.getRemotePort(); @@ -941,6 +942,7 @@ namespace MeshCentralRouter MapUserControl map = new MapUserControl(); map.xdebug = debug; map.inaddrany = inaddrany; + map.ruleName = form.getRuleName(); map.protocol = form.getProtocol(); map.localPort = form.getLocalPort(); map.remotePort = form.getRemotePort(); @@ -1241,6 +1243,7 @@ namespace MeshCentralRouter MapUserControl map = new MapUserControl(); map.xdebug = debug; map.inaddrany = inaddrany; + map.ruleName = x["ruleName"].ToString(); map.protocol = (int)x["protocol"]; map.localPort = (int)x["localPort"]; if (x.ContainsKey("remoteIP")) { map.remoteIP = (string)x["remoteIP"]; } @@ -1282,6 +1285,7 @@ namespace MeshCentralRouter MeshMapper map = ((MapUserControl)c).mapper; if (mapCounter == 0) { text += " {\r\n"; } else { text += ",\r\n {\r\n"; } text += " \"nodeName\": \"" + mapCtrl.node.name + "\",\r\n"; + text += " \"ruleName\": \"" + mapCtrl.ruleName + "\",\r\n"; text += " \"meshId\": \"" + mapCtrl.node.meshid + "\",\r\n"; text += " \"nodeId\": \"" + mapCtrl.node.nodeid + "\",\r\n"; text += " \"appId\": " + mapCtrl.appId + ",\r\n"; diff --git a/MapUserControl.cs b/MapUserControl.cs index c6fba1f..fd902f4 100644 --- a/MapUserControl.cs +++ b/MapUserControl.cs @@ -14,6 +14,7 @@ namespace MeshCentralRouter { public partial class MapUserControl : UserControl { + public string ruleName; public int protocol; public int localPort; public string remoteIP = null; @@ -44,7 +45,14 @@ namespace MeshCentralRouter public void UpdateInfo() { - deviceNameLabel.Text = node.name; + if(this.ruleName != null) + { + deviceNameLabel.Text = node.name + ": " + this.ruleName; + } + else + { + deviceNameLabel.Text = node.name; + } devicePictureBox.Image = deviceImageList.Images[node.icon - 1]; }