From 5041fafd551fc6974089bb5fb245bf33464c89a3 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 16 Jun 2021 11:24:09 -0700 Subject: [PATCH] Fix for high DPI and open web site button. --- MainForm.Designer.cs | 26 +++++++++++++----------- MainForm.cs | 4 +++- MainForm.resx | 47 +++++++++++++++++++++++--------------------- MeshCentralServer.cs | 3 ++- 4 files changed, 45 insertions(+), 35 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 5e4c69d..c42ab5a 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -48,7 +48,6 @@ this.nextButton1 = new System.Windows.Forms.Button(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.panel2 = new System.Windows.Forms.Panel(); this.tokenRememberCheckBox = new System.Windows.Forms.CheckBox(); @@ -136,13 +135,13 @@ this.settingsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.openMapFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveMapFileDialog = new System.Windows.Forms.SaveFileDialog(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.panel5.SuspendLayout(); this.mainPanel.SuspendLayout(); this.mainTabControl.SuspendLayout(); this.tabPage1.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.tabPage2.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit(); @@ -165,6 +164,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.trayIconContextMenuStrip.SuspendLayout(); this.mappingsContextMenuStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); // // panel5 @@ -304,13 +304,6 @@ this.label1.Name = "label1"; this.label1.UseMnemonic = false; // - // pictureBox2 - // - resources.ApplyResources(this.pictureBox2, "pictureBox2"); - this.pictureBox2.Image = global::MeshCentralRouter.Properties.Resources.MeshCentral; - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.TabStop = false; - // // tabPage2 // this.tabPage2.Controls.Add(this.panel2); @@ -507,6 +500,7 @@ // // mainContextMenuStrip // + this.mainContextMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); this.mainContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.showGroupNamesToolStripMenuItem, this.showOfflineDevicesToolStripMenuItem, @@ -638,6 +632,7 @@ // // devicesContextMenuStrip // + this.devicesContextMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); this.devicesContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addMapToolStripMenuItem, this.addRelayMapToolStripMenuItem, @@ -890,6 +885,7 @@ // // trayIconContextMenuStrip // + this.trayIconContextMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); this.trayIconContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.openToolStripMenuItem, this.toolStripMenuItem1, @@ -920,6 +916,7 @@ // // mappingsContextMenuStrip // + this.mappingsContextMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); this.mappingsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.openMappingsToolStripMenuItem, this.saveMappingsToolStripMenuItem, @@ -961,6 +958,13 @@ this.saveMapFileDialog.DefaultExt = "mcrouter"; resources.ApplyResources(this.saveMapFileDialog, "saveMapFileDialog"); // + // pictureBox2 + // + resources.ApplyResources(this.pictureBox2, "pictureBox2"); + this.pictureBox2.Image = global::MeshCentralRouter.Properties.Resources.MeshCentral; + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.TabStop = false; + // // MainForm // resources.ApplyResources(this, "$this"); @@ -980,7 +984,6 @@ this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.tabPage2.ResumeLayout(false); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); @@ -1006,6 +1009,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.trayIconContextMenuStrip.ResumeLayout(false); this.mappingsContextMenuStrip.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.ResumeLayout(false); } @@ -1019,7 +1023,6 @@ private System.Windows.Forms.Label versionLabel; private System.Windows.Forms.Button nextButton1; private System.Windows.Forms.PictureBox pictureBox3; - private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.Panel panel2; @@ -1117,6 +1120,7 @@ private System.Windows.Forms.ToolStripMenuItem askConsentBarToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem askConsentToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem privacyBarToolStripMenuItem; + private System.Windows.Forms.PictureBox pictureBox2; } } diff --git a/MainForm.cs b/MainForm.cs index 165ad9e..e592382 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -1338,7 +1338,9 @@ namespace MeshCentralRouter if (meshcentral.loginCookie != null) { Uri serverurl = null; if (authLoginUrl != null) { - serverurl = new Uri("https://" + authLoginUrl.Host + ":" + ((authLoginUrl.Port > 0) ? authLoginUrl.Port : 443) + authLoginUrl.LocalPath + "?login=" + meshcentral.loginCookie); + string localPath = authLoginUrl.LocalPath; + if (localPath.EndsWith("/control.ashx")) { localPath = localPath.Substring(0, localPath.Length - 12); } + serverurl = new Uri("https://" + authLoginUrl.Host + ":" + ((authLoginUrl.Port > 0) ? authLoginUrl.Port : 443) + localPath + "?login=" + meshcentral.loginCookie); } else { serverurl = new Uri("https://" + serverNameComboBox.Text + "?login=" + meshcentral.loginCookie); } diff --git a/MainForm.resx b/MainForm.resx index 00dbdc7..1f7b561 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -295,7 +295,7 @@ - 213, 20 + 214, 20 102 @@ -322,7 +322,7 @@ 241, 110 - 213, 21 + 214, 21 100 @@ -346,7 +346,7 @@ 241, 151 - 213, 20 + 214, 20 101 @@ -370,7 +370,7 @@ NoControl - 173, 260 + 174, 260 303, 13 @@ -529,10 +529,10 @@ 15, 68 - 202, 170 + 217, 170 - CenterImage + Zoom 7 @@ -763,7 +763,7 @@ 241, 151 - 213, 20 + 214, 20 201 @@ -793,7 +793,7 @@ 202, 170 - CenterImage + Zoom 15 @@ -1024,7 +1024,7 @@ Vertical - 451, 162 + 450, 162 25 @@ -1399,7 +1399,7 @@ Bottom, Left - 4, 183 + 4, 174 168, 35 @@ -1535,7 +1535,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADg - HQAAAk1TRnQBSQFMAgEBEAEAAWgBAAFoAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + HQAAAk1TRnQBSQFMAgEBEAEAAXgBAAF4AQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABUAMAAQEBAAEYBgABPP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AJYAA/0D+AP3A/sD/yEAA/0D+gP5 A/wD/xgAAfoB+wH6A/4qAAP9A/8tAAP7A88D1QPbA88D1AO+A9QYAAP8A90D4APjA90D4APUA+MSAAP8 AZEBjwF9AU4BaAEhAfQB9QH0JAAD/gPRA8YD+ioAAcYCxwHPAtAB2ALZA90DywPBA68DmgP3FQAD2APd @@ -1702,7 +1702,7 @@ 2, 88 - 406, 52 + 399, 52 5 @@ -1741,7 +1741,7 @@ 2, 88 - 406, 52 + 399, 52 4 @@ -1768,7 +1768,7 @@ 0, 0 - 470, 250 + 470, 248 50 @@ -1819,7 +1819,7 @@ NoControl - 4, 181 + 4, 185 168, 35 @@ -1864,7 +1864,7 @@ 6, 79 - 457, 52 + 453, 52 4 @@ -1893,7 +1893,7 @@ Click "Add" to get started. 0, 0 - 470, 220 + 473, 224 49 @@ -1917,7 +1917,7 @@ Click "Add" to get started. NoControl - 1, 226 + 1, 229 20, 20 @@ -1944,7 +1944,7 @@ Click "Add" to get started. NoControl - 238, 226 + 241, 229 20, 20 @@ -1974,7 +1974,7 @@ Click "Add" to get started. NoControl - 370, 224 + 373, 227 100, 23 @@ -2007,7 +2007,7 @@ Click "Add" to get started. NoControl - 264, 224 + 267, 227 100, 23 @@ -2037,7 +2037,7 @@ Click "Add" to get started. 3, 3, 3, 3 - 470, 250 + 473, 256 1 @@ -2315,6 +2315,9 @@ Click "Add" to get started. 492, 65 + + Zoom + 2 diff --git a/MeshCentralServer.cs b/MeshCentralServer.cs index 5a547cf..33d28db 100644 --- a/MeshCentralServer.cs +++ b/MeshCentralServer.cs @@ -365,7 +365,8 @@ namespace MeshCentralRouter n.agentcaps = (int)((Dictionary)node["agent"])["caps"]; } if (node.ContainsKey("conn")) { n.conn = (int)node["conn"]; } - n.icon = (int)node["icon"]; + n.icon = 1; + if (node.ContainsKey("icon")) { n.icon = (int)node["icon"]; } if (node.ContainsKey("users")) { n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); } else { n.users = null; } if (node.ContainsKey("rdpport")) { n.rdpport = (int)node["rdpport"]; } ulong nodeRights = 0;