diff --git a/DeviceUserControl.resx b/DeviceUserControl.resx index ce43b5a..90a83e0 100644 --- a/DeviceUserControl.resx +++ b/DeviceUserControl.resx @@ -269,7 +269,7 @@ 60, 10 - 235, 15 + 229, 15 1 @@ -296,7 +296,7 @@ 60, 30 - 235, 15 + 229, 15 2 @@ -322,12 +322,6 @@ 313, 17 - - 149, 22 - - - Set RDP port... - 150, 26 @@ -338,7 +332,7 @@ System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 365, 4 + 359, 4 58, 47 @@ -361,6 +355,12 @@ 6 + + 149, 22 + + + Set RDP port... + 15, 17 @@ -369,7 +369,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAy - mgAAAk1TRnQBSQFMAgEBCAEAAXgBAAF4AQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI + mgAAAk1TRnQBSQFMAgEBCAEAAYABAAGAAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI AwABlgMAAQEBAAEQBQABYAHq/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A @@ -1037,7 +1037,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4 - mgAAAk1TRnQBSQFMAgEBCAEAAYABAAGAAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI + mgAAAk1TRnQBSQFMAgEBCAEAAYgBAAGIAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI AwABlgMAAQEBAAEQBQABYAHq/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A @@ -1706,12 +1706,6 @@ 468, 17 - - 178, 22 - - - Use Alternate Port... - 179, 26 @@ -1722,7 +1716,7 @@ System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 301, 4 + 295, 4 58, 23 @@ -1745,11 +1739,17 @@ 5 + + 178, 22 + + + Use Alternate Port... + Top, Right - 301, 28 + 295, 28 58, 23 @@ -1776,7 +1776,7 @@ Top, Right - 365, 28 + 359, 28 58, 23 @@ -1803,7 +1803,7 @@ Top, Right - 365, 4 + 359, 4 58, 23 @@ -1833,7 +1833,7 @@ 6, 13 - 425, 52 + 421, 53 setRDPPortToolStripMenuItem diff --git a/MainForm.cs b/MainForm.cs index adaf48b..1bb3276 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -1337,7 +1337,7 @@ namespace MeshCentralRouter map.protocol = protocol; // 1 = TCP, 2 = UDP map.localPort = 0; // Any map.remotePort = port; // HTTP - map.appId = appId; // 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP + map.appId = appId; // 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = PuTTY, 4 = RDP, 5 = WinSCP map.node = node; if (authLoginUrl != null) { map.host = authLoginUrl.Host + ":" + ((authLoginUrl.Port > 0) ? authLoginUrl.Port : 443); } else { map.host = serverNameComboBox.Text; } map.authCookie = meshcentral.authCookie; @@ -1609,6 +1609,15 @@ namespace MeshCentralRouter QuickMap(1, 443, 2, node); // HTTPS } + private void sshToolStripMenuItem_Click(object sender, EventArgs e) + { + if (devicesListView.SelectedItems.Count != 1) { return; } + ListViewItem selecteditem = devicesListView.SelectedItems[0]; + NodeClass node = (NodeClass)selecteditem.Tag; + if ((node.conn & 1) == 0) { return; } // Agent not connected on this device + QuickMap(1, 22, 3, node); // Putty + } + private void rdpToolStripMenuItem_Click(object sender, EventArgs e) { if (devicesListView.SelectedItems.Count != 1) { return; } @@ -1617,16 +1626,7 @@ namespace MeshCentralRouter if ((node.conn & 1) == 0) { return; } // Agent not connected on this device int rdpport = 3389; if (node.rdpport != 0) { rdpport = node.rdpport; } - QuickMap(1, rdpport, 3, node); // RDP - } - - private void sshToolStripMenuItem_Click(object sender, EventArgs e) - { - if (devicesListView.SelectedItems.Count != 1) { return; } - ListViewItem selecteditem = devicesListView.SelectedItems[0]; - NodeClass node = (NodeClass)selecteditem.Tag; - if ((node.conn & 1) == 0) { return; } // Agent not connected on this device - QuickMap(1, 22, 4, node); // Putty + QuickMap(1, rdpport, 4, node); // RDP } private void scpToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/MapUserControl.cs b/MapUserControl.cs index c2bd602..03fa17f 100644 --- a/MapUserControl.cs +++ b/MapUserControl.cs @@ -95,8 +95,8 @@ namespace MeshCentralRouter } else { if (appId == 1) { statemsg = "HTTP: " + statemsg; } else if (appId == 2) { statemsg = "HTTPS: " + statemsg; } - else if (appId == 3) { statemsg = "RDP: " + statemsg; } - else if (appId == 4) { statemsg = "PuTTY: " + statemsg; } + else if (appId == 3) { statemsg = "PuTTY: " + statemsg; } + else if (appId == 4) { statemsg = "RDP: " + statemsg; } else if (appId == 5) { statemsg = "WinSCP: " + statemsg; } else { statemsg = "TCP: " + statemsg; } } @@ -111,33 +111,6 @@ namespace MeshCentralRouter if (appId == 1) { System.Diagnostics.Process.Start("http://localhost:" + mapper.localport); } if (appId == 2) { System.Diagnostics.Process.Start("https://localhost:" + mapper.localport); } if (appId == 3) - { - System.Diagnostics.Process proc = null; - string cmd = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System) + "\\mstsc.exe"; - string tfile = Path.Combine(Path.GetTempPath(), "MeshRdpFile.rdp"); - string[] f = null; - try { if (File.Exists(tfile)) f = File.ReadAllLines(tfile); } catch (Exception) { } - if (f != null) - { - List f2 = new List(); - foreach (string fx in f) { if (!fx.StartsWith("full address")) f2.Add(fx); } - f2.Add(string.Format("full address:s:127.0.0.1:{0}", mapper.localport)); - File.WriteAllLines(tfile, f2.ToArray()); - } - else - { - File.WriteAllText(tfile, string.Format("full address:s:127.0.0.1:{0}", mapper.localport)); - } - string args = "/edit:\"" + tfile + "\""; - - // Launch the process - try { proc = System.Diagnostics.Process.Start(cmd, args); } - catch (System.ComponentModel.Win32Exception) { } - - // Setup auto-exit - if ((autoexit == true) && (parent.autoExitProc == null)) { parent.autoExitProc = proc; parent.SetAutoClose(); autoExitTimer.Enabled = true; } - } - if (appId == 4) { string puttyPath = loadFromRegistry("PuttyPath"); if ((shift == false) && (File.Exists(puttyPath))) @@ -163,7 +136,7 @@ namespace MeshCentralRouter { saveToRegistry("PuttyPath", f.GetAppPath()); string args = "-ssh 127.0.0.1 -P " + mapper.localport; - + // Launch the process try { proc = System.Diagnostics.Process.Start(f.GetAppPath(), args); } catch (System.ComponentModel.Win32Exception) { } @@ -174,6 +147,33 @@ namespace MeshCentralRouter } } } + if (appId == 4) + { + System.Diagnostics.Process proc = null; + string cmd = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System) + "\\mstsc.exe"; + string tfile = Path.Combine(Path.GetTempPath(), "MeshRdpFile.rdp"); + string[] f = null; + try { if (File.Exists(tfile)) f = File.ReadAllLines(tfile); } catch (Exception) { } + if (f != null) + { + List f2 = new List(); + foreach (string fx in f) { if (!fx.StartsWith("full address")) f2.Add(fx); } + f2.Add(string.Format("full address:s:127.0.0.1:{0}", mapper.localport)); + File.WriteAllLines(tfile, f2.ToArray()); + } + else + { + File.WriteAllText(tfile, string.Format("full address:s:127.0.0.1:{0}", mapper.localport)); + } + string args = "/edit:\"" + tfile + "\""; + + // Launch the process + try { proc = System.Diagnostics.Process.Start(cmd, args); } + catch (System.ComponentModel.Win32Exception) { } + + // Setup auto-exit + if ((autoexit == true) && (parent.autoExitProc == null)) { parent.autoExitProc = proc; parent.SetAutoClose(); autoExitTimer.Enabled = true; } + } if (appId == 5) { string winScpPath = loadFromRegistry("WinSCPPath"); diff --git a/MapUserControl.resx b/MapUserControl.resx index 37bc4d0..dcecd62 100644 --- a/MapUserControl.resx +++ b/MapUserControl.resx @@ -119,7 +119,7 @@ - 5, 3 + 5, 0 50, 50 @@ -151,10 +151,10 @@ NoControl - 60, 11 + 60, 8 - 280, 15 + 273, 15 1 @@ -181,10 +181,10 @@ NoControl - 60, 31 + 60, 28 - 280, 15 + 273, 15 2 @@ -208,7 +208,7 @@ Top, Right - 346, 4 + 339, 1 75, 23 @@ -235,7 +235,7 @@ Top, Right - 346, 28 + 339, 25 75, 23 @@ -266,7 +266,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAy - mgAAAk1TRnQBSQFMAgEBCAEAAVgBAAFYAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI + mgAAAk1TRnQBSQFMAgEBCAEAAWABAAFgAQABMgEAATIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAHI AwABlgMAAQEBAAEQBQABYAHq/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A @@ -954,7 +954,7 @@ 6, 13 - 421, 54 + 417, 53 deviceImageList