From ca7b650e3b95395051e5385ea4daf4b44f7ac568 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 18 Apr 2022 14:41:37 +0800 Subject: [PATCH] clear --- clashN/clashN/Forms/MainForm.Designer.cs | 32 +++---------- clashN/clashN/Forms/MainForm.cs | 57 ++++++------------------ clashN/clashN/Forms/MainForm.resx | 52 +++++---------------- 3 files changed, 30 insertions(+), 111 deletions(-) diff --git a/clashN/clashN/Forms/MainForm.Designer.cs b/clashN/clashN/Forms/MainForm.Designer.cs index f90c32c..874cbc3 100644 --- a/clashN/clashN/Forms/MainForm.Designer.cs +++ b/clashN/clashN/Forms/MainForm.Designer.cs @@ -52,8 +52,8 @@ this.menuSelectAll = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.menuClearProfileStatistics = new System.Windows.Forms.ToolStripMenuItem(); - this.tsbProfile = new System.Windows.Forms.ToolStripDropDownButton(); this.qrCodeControl = new clashN.Forms.QRCodeControl(); + this.tsbProfile = new System.Windows.Forms.ToolStripDropDownButton(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.mainMsgControl = new clashN.Forms.MainMsgControl(); @@ -65,9 +65,7 @@ this.menuKeepNothing = new System.Windows.Forms.ToolStripMenuItem(); this.menuRoutings = new System.Windows.Forms.ToolStripMenuItem(); this.menuProfiles = new System.Windows.Forms.ToolStripMenuItem(); - this.menuProfiles2 = new System.Windows.Forms.ToolStripComboBox(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); - this.menuAddProfiles2 = new System.Windows.Forms.ToolStripMenuItem(); this.menuScanScreen2 = new System.Windows.Forms.ToolStripMenuItem(); this.menuUpdateSubscriptions = new System.Windows.Forms.ToolStripMenuItem(); this.menuUpdateSubViaProxy = new System.Windows.Forms.ToolStripMenuItem(); @@ -286,6 +284,11 @@ resources.ApplyResources(this.menuClearProfileStatistics, "menuClearProfileStatistics"); this.menuClearProfileStatistics.Click += new System.EventHandler(this.menuClearStatistic_Click); // + // qrCodeControl + // + resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); + this.qrCodeControl.Name = "qrCodeControl"; + // // tsbProfile // this.tsbProfile.DropDown = this.cmsLv; @@ -293,11 +296,6 @@ resources.ApplyResources(this.tsbProfile, "tsbProfile"); this.tsbProfile.Name = "tsbProfile"; // - // qrCodeControl - // - resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); - this.qrCodeControl.Name = "qrCodeControl"; - // // splitContainer1 // resources.ApplyResources(this.splitContainer1, "splitContainer1"); @@ -337,9 +335,7 @@ this.menuSysAgentMode, this.menuRoutings, this.menuProfiles, - this.menuProfiles2, this.toolStripSeparator13, - this.menuAddProfiles2, this.menuScanScreen2, this.menuUpdateSubscriptions, this.menuUpdateSubViaProxy, @@ -387,25 +383,11 @@ this.menuProfiles.Name = "menuProfiles"; resources.ApplyResources(this.menuProfiles, "menuProfiles"); // - // menuProfiles2 - // - this.menuProfiles2.BackColor = System.Drawing.SystemColors.Window; - this.menuProfiles2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.menuProfiles2.DropDownWidth = 500; - resources.ApplyResources(this.menuProfiles2, "menuProfiles2"); - this.menuProfiles2.Name = "menuProfiles2"; - // // toolStripSeparator13 // this.toolStripSeparator13.Name = "toolStripSeparator13"; resources.ApplyResources(this.toolStripSeparator13, "toolStripSeparator13"); // - // menuAddProfiles2 - // - this.menuAddProfiles2.Name = "menuAddProfiles2"; - resources.ApplyResources(this.menuAddProfiles2, "menuAddProfiles2"); - this.menuAddProfiles2.Click += new System.EventHandler(this.menuAddProfiles_Click); - // // menuScanScreen2 // this.menuScanScreen2.Name = "menuScanScreen2"; @@ -713,7 +695,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; private System.Windows.Forms.ToolStripDropDownButton tsbHelp; private System.Windows.Forms.ToolStripMenuItem tsbAbout; - private System.Windows.Forms.ToolStripMenuItem menuAddProfiles2; private System.Windows.Forms.ToolStripMenuItem menuScanScreen; private System.Windows.Forms.ToolStripMenuItem menuScanScreen2; private System.Windows.Forms.ToolStripDropDownButton tsbSub; @@ -739,7 +720,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator15; private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateGeo; private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.ToolStripComboBox menuProfiles2; private System.Windows.Forms.ToolStripMenuItem menuUpdateSubViaProxy; private System.Windows.Forms.ToolStripMenuItem tsbGlobalHotkeySetting; private System.Windows.Forms.ToolStripMenuItem tsbSubUpdate; diff --git a/clashN/clashN/Forms/MainForm.cs b/clashN/clashN/Forms/MainForm.cs index 30a8b63..138575d 100644 --- a/clashN/clashN/Forms/MainForm.cs +++ b/clashN/clashN/Forms/MainForm.cs @@ -330,56 +330,25 @@ namespace clashN.Forms private void RefreshProfilesMenu() { menuProfiles.DropDownItems.Clear(); - menuProfiles2.SelectedIndexChanged -= MenuProfiles2_SelectedIndexChanged; - menuProfiles2.Items.Clear(); - menuProfiles.Visible = false; - menuProfiles2.Visible = false; - if (lstProfile.Count > 20) + List lst = new List(); + for (int k = 0; k < lstProfile.Count; k++) { - for (int k = 0; k < lstProfile.Count; k++) + ProfileItem item = lstProfile[k]; + string name = item.GetSummary(); + + ToolStripMenuItem ts = new ToolStripMenuItem(name) { - ProfileItem item = lstProfile[k]; - string name = item.GetSummary(); - - if (config.IsActiveNode(item)) - { - name = $"√ {name}"; - } - menuProfiles2.Items.Add(name); - - } - menuProfiles2.SelectedIndex = lstProfile.FindIndex(it => it.indexId == config.indexId); - menuProfiles2.SelectedIndexChanged += MenuProfiles2_SelectedIndexChanged; - menuProfiles2.Visible = true; - } - else - { - List lst = new List(); - for (int k = 0; k < lstProfile.Count; k++) + Tag = k + }; + if (config.IsActiveNode(item)) { - ProfileItem item = lstProfile[k]; - string name = item.GetSummary(); - - ToolStripMenuItem ts = new ToolStripMenuItem(name) - { - Tag = k - }; - if (config.IsActiveNode(item)) - { - ts.Checked = true; - } - ts.Click += new EventHandler(ts_Click); - lst.Add(ts); + ts.Checked = true; } - menuProfiles.DropDownItems.AddRange(lst.ToArray()); - menuProfiles.Visible = true; + ts.Click += new EventHandler(ts_Click); + lst.Add(ts); } - } - - private void MenuProfiles2_SelectedIndexChanged(object sender, EventArgs e) - { - SetDefaultProfile(((ToolStripComboBox)sender).SelectedIndex); + menuProfiles.DropDownItems.AddRange(lst.ToArray()); } private void ts_Click(object sender, EventArgs e) diff --git a/clashN/clashN/Forms/MainForm.resx b/clashN/clashN/Forms/MainForm.resx index f98cdb9..fdaf859 100644 --- a/clashN/clashN/Forms/MainForm.resx +++ b/clashN/clashN/Forms/MainForm.resx @@ -445,13 +445,13 @@ Do not change system proxy - 294, 22 + 277, 22 System proxy - 294, 22 + 277, 22 Routing @@ -460,61 +460,43 @@ False - 294, 22 + 277, 22 Profile - - Standard - - - 50 - - - 200, 25 - - - Profile - - 291, 6 - - - 294, 22 - - - Add configuration file from clipboard + 274, 6 - 294, 22 + 277, 22 Scan QR code on the screen - 294, 22 + 277, 22 Update subscription without proxy - 294, 22 + 277, 22 Update subscriptions via proxy - 291, 6 + 274, 6 - 294, 22 + 277, 22 Exit - 295, 221 + 278, 192 cmsMain @@ -769,7 +751,7 @@ True - 156 + 78 7, 17 @@ -945,24 +927,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuProfiles2 - - - System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - toolStripSeparator13 System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuAddProfiles2 - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 - menuScanScreen2