diff --git a/Netch/Forms/MainForm.Designer.cs b/Netch/Forms/MainForm.Designer.cs index feb7f45a..0a551854 100644 --- a/Netch/Forms/MainForm.Designer.cs +++ b/Netch/Forms/MainForm.Designer.cs @@ -42,7 +42,6 @@ namespace Netch.Forms this.AddTrojanServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CreateProcessModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ManageProcessModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SubscribeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ManageSubscribeLinksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UpdateServersFromSubscribeLinksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -54,6 +53,7 @@ namespace Netch.Forms this.UpdateACLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.updateACLWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.reinstallTapDriverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.OpenDirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton(); this.VersionLabel = new System.Windows.Forms.ToolStripLabel(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -64,16 +64,9 @@ namespace Netch.Forms this.ModeLabel = new System.Windows.Forms.Label(); this.ServerLabel = new System.Windows.Forms.Label(); this.ProfileNameText = new System.Windows.Forms.TextBox(); - this.ModeComboBox = new System.Windows.Forms.SearchComboBox(); this.ServerComboBox = new System.Windows.Forms.ComboBox(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.EditPictureBox = new System.Windows.Forms.PictureBox(); - this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox(); - this.DeletePictureBox = new System.Windows.Forms.PictureBox(); - this.SpeedPictureBox = new System.Windows.Forms.PictureBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.EditModePictureBox = new System.Windows.Forms.PictureBox(); - this.DeleteModePictureBox = new System.Windows.Forms.PictureBox(); this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel(); @@ -88,20 +81,27 @@ namespace Netch.Forms this.SettingsButton = new System.Windows.Forms.Button(); this.ProfileGroupBox = new System.Windows.Forms.GroupBox(); this.ProfileTable = new System.Windows.Forms.TableLayoutPanel(); + this.ModeComboBox = new System.Windows.Forms.SearchComboBox(); + this.EditPictureBox = new System.Windows.Forms.PictureBox(); + this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox(); + this.DeletePictureBox = new System.Windows.Forms.PictureBox(); + this.SpeedPictureBox = new System.Windows.Forms.PictureBox(); + this.EditModePictureBox = new System.Windows.Forms.PictureBox(); + this.DeleteModePictureBox = new System.Windows.Forms.PictureBox(); this.MenuStrip.SuspendLayout(); this.ConfigurationGroupBox.SuspendLayout(); this.configLayoutPanel.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.StatusStrip.SuspendLayout(); + this.NotifyMenu.SuspendLayout(); + this.ProfileGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit(); - this.tableLayoutPanel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit(); - this.StatusStrip.SuspendLayout(); - this.NotifyMenu.SuspendLayout(); - this.ProfileGroupBox.SuspendLayout(); this.SuspendLayout(); // // MenuStrip @@ -182,8 +182,7 @@ namespace Netch.Forms // ModeToolStripMenuItem // this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.CreateProcessModeToolStripMenuItem, - this.ManageProcessModeToolStripMenuItem}); + this.CreateProcessModeToolStripMenuItem}); this.ModeToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); this.ModeToolStripMenuItem.Name = "ModeToolStripMenuItem"; this.ModeToolStripMenuItem.Size = new System.Drawing.Size(55, 21); @@ -192,17 +191,10 @@ namespace Netch.Forms // CreateProcessModeToolStripMenuItem // this.CreateProcessModeToolStripMenuItem.Name = "CreateProcessModeToolStripMenuItem"; - this.CreateProcessModeToolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.CreateProcessModeToolStripMenuItem.Size = new System.Drawing.Size(202, 22); this.CreateProcessModeToolStripMenuItem.Text = "Create Process Mode"; this.CreateProcessModeToolStripMenuItem.Click += new System.EventHandler(this.CreateProcessModeToolStripButton_Click); // - // ManageProcessModeToolStripMenuItem - // - this.ManageProcessModeToolStripMenuItem.Name = "ManageProcessModeToolStripMenuItem"; - this.ManageProcessModeToolStripMenuItem.Size = new System.Drawing.Size(212, 22); - this.ManageProcessModeToolStripMenuItem.Text = "Manage Process Mode"; - this.ManageProcessModeToolStripMenuItem.Click += new System.EventHandler(this.ManageProcessModeToolStripMenuItem_Click); - // // SubscribeToolStripMenuItem // this.SubscribeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -236,7 +228,8 @@ namespace Netch.Forms this.CleanDNSCacheToolStripMenuItem, this.UpdateACLToolStripMenuItem, this.updateACLWithProxyToolStripMenuItem, - this.reinstallTapDriverToolStripMenuItem}); + this.reinstallTapDriverToolStripMenuItem, + this.OpenDirectoryToolStripMenuItem}); this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem"; this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21); @@ -291,6 +284,13 @@ namespace Netch.Forms this.reinstallTapDriverToolStripMenuItem.Text = "Reinstall TUN/TAP driver"; this.reinstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.reinstallTapDriverToolStripMenuItem_Click); // + // OpenDirectoryToolStripMenuItem + // + this.OpenDirectoryToolStripMenuItem.Name = "OpenDirectoryToolStripMenuItem"; + this.OpenDirectoryToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.OpenDirectoryToolStripMenuItem.Text = "Open Directory"; + this.OpenDirectoryToolStripMenuItem.Click += new System.EventHandler(this.OpenDirectoryToolStripMenuItem_Click); + // // AboutToolStripButton // this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; @@ -343,7 +343,7 @@ namespace Netch.Forms // this.configLayoutPanel.ColumnCount = 3; this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.configLayoutPanel.Controls.Add(this.ProfileLabel, 0, 2); this.configLayoutPanel.Controls.Add(this.ModeLabel, 0, 1); @@ -401,19 +401,6 @@ namespace Netch.Forms this.ProfileNameText.Size = new System.Drawing.Size(546, 23); this.ProfileNameText.TabIndex = 11; // - // ModeComboBox - // - this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.ModeComboBox.FormattingEnabled = true; - this.ModeComboBox.IntegralHeight = false; - this.ModeComboBox.Location = new System.Drawing.Point(54, 34); - this.ModeComboBox.Name = "ModeComboBox"; - this.ModeComboBox.Size = new System.Drawing.Size(546, 24); - this.ModeComboBox.TabIndex = 2; - this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); - // // ServerComboBox // this.ServerComboBox.Dock = System.Windows.Forms.DockStyle.Fill; @@ -446,50 +433,6 @@ namespace Netch.Forms this.tableLayoutPanel2.Size = new System.Drawing.Size(94, 24); this.tableLayoutPanel2.TabIndex = 12; // - // EditPictureBox - // - this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image"))); - this.EditPictureBox.Location = new System.Drawing.Point(3, 3); - this.EditPictureBox.Name = "EditPictureBox"; - this.EditPictureBox.Size = new System.Drawing.Size(16, 16); - this.EditPictureBox.TabIndex = 7; - this.EditPictureBox.TabStop = false; - this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click); - // - // CopyLinkPictureBox - // - this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink; - this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3); - this.CopyLinkPictureBox.Name = "CopyLinkPictureBox"; - this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18); - this.CopyLinkPictureBox.TabIndex = 14; - this.CopyLinkPictureBox.TabStop = false; - this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click); - // - // DeletePictureBox - // - this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image"))); - this.DeletePictureBox.Location = new System.Drawing.Point(26, 3); - this.DeletePictureBox.Name = "DeletePictureBox"; - this.DeletePictureBox.Size = new System.Drawing.Size(16, 16); - this.DeletePictureBox.TabIndex = 8; - this.DeletePictureBox.TabStop = false; - this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click); - // - // SpeedPictureBox - // - this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image"))); - this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3); - this.SpeedPictureBox.Name = "SpeedPictureBox"; - this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16); - this.SpeedPictureBox.TabIndex = 9; - this.SpeedPictureBox.TabStop = false; - this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click); - // // tableLayoutPanel3 // this.tableLayoutPanel3.ColumnCount = 4; @@ -506,30 +449,6 @@ namespace Netch.Forms this.tableLayoutPanel3.Size = new System.Drawing.Size(94, 24); this.tableLayoutPanel3.TabIndex = 13; // - // EditModePictureBox - // - this.EditModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.Location = new System.Drawing.Point(3, 3); - this.EditModePictureBox.Name = "EditModePictureBox"; - this.EditModePictureBox.Size = new System.Drawing.Size(16, 16); - this.EditModePictureBox.TabIndex = 12; - this.EditModePictureBox.TabStop = false; - this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click); - // - // DeleteModePictureBox - // - this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete; - this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3); - this.DeleteModePictureBox.Name = "DeleteModePictureBox"; - this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16); - this.DeleteModePictureBox.TabIndex = 13; - this.DeleteModePictureBox.TabStop = false; - this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click); - // // StatusStrip // this.StatusStrip.ImageScalingSize = new System.Drawing.Size(20, 20); @@ -658,6 +577,87 @@ namespace Netch.Forms this.ProfileTable.Size = new System.Drawing.Size(703, 43); this.ProfileTable.TabIndex = 0; // + // ModeComboBox + // + this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.ModeComboBox.FormattingEnabled = true; + this.ModeComboBox.IntegralHeight = false; + this.ModeComboBox.Location = new System.Drawing.Point(54, 34); + this.ModeComboBox.Name = "ModeComboBox"; + this.ModeComboBox.Size = new System.Drawing.Size(546, 24); + this.ModeComboBox.TabIndex = 2; + this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); + // + // EditPictureBox + // + this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image"))); + this.EditPictureBox.Location = new System.Drawing.Point(3, 3); + this.EditPictureBox.Name = "EditPictureBox"; + this.EditPictureBox.Size = new System.Drawing.Size(16, 16); + this.EditPictureBox.TabIndex = 7; + this.EditPictureBox.TabStop = false; + this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click); + // + // CopyLinkPictureBox + // + this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink; + this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3); + this.CopyLinkPictureBox.Name = "CopyLinkPictureBox"; + this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18); + this.CopyLinkPictureBox.TabIndex = 14; + this.CopyLinkPictureBox.TabStop = false; + this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click); + // + // DeletePictureBox + // + this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image"))); + this.DeletePictureBox.Location = new System.Drawing.Point(26, 3); + this.DeletePictureBox.Name = "DeletePictureBox"; + this.DeletePictureBox.Size = new System.Drawing.Size(16, 16); + this.DeletePictureBox.TabIndex = 8; + this.DeletePictureBox.TabStop = false; + this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click); + // + // SpeedPictureBox + // + this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image"))); + this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3); + this.SpeedPictureBox.Name = "SpeedPictureBox"; + this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16); + this.SpeedPictureBox.TabIndex = 9; + this.SpeedPictureBox.TabStop = false; + this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click); + // + // EditModePictureBox + // + this.EditModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.Location = new System.Drawing.Point(3, 3); + this.EditModePictureBox.Name = "EditModePictureBox"; + this.EditModePictureBox.Size = new System.Drawing.Size(16, 16); + this.EditModePictureBox.TabIndex = 12; + this.EditModePictureBox.TabStop = false; + this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click); + // + // DeleteModePictureBox + // + this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete; + this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3); + this.DeleteModePictureBox.Name = "DeleteModePictureBox"; + this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16); + this.DeleteModePictureBox.TabIndex = 13; + this.DeleteModePictureBox.TabStop = false; + this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -679,24 +679,25 @@ namespace Netch.Forms this.Text = "Netch"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); this.Load += new System.EventHandler(this.MainForm_Load); + this.VisibleChanged += new System.EventHandler(this.MainForm_VisibleChanged); this.MenuStrip.ResumeLayout(false); this.MenuStrip.PerformLayout(); this.ConfigurationGroupBox.ResumeLayout(false); this.configLayoutPanel.ResumeLayout(false); this.configLayoutPanel.PerformLayout(); this.tableLayoutPanel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit(); this.tableLayoutPanel3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit(); this.StatusStrip.ResumeLayout(false); this.StatusStrip.PerformLayout(); this.NotifyMenu.ResumeLayout(false); this.ProfileGroupBox.ResumeLayout(false); this.ProfileGroupBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -746,7 +747,6 @@ namespace Netch.Forms private System.Windows.Forms.TextBox ProfileNameText; private System.Windows.Forms.GroupBox ProfileGroupBox; private System.Windows.Forms.TableLayoutPanel ProfileTable; - private System.Windows.Forms.ToolStripMenuItem ManageProcessModeToolStripMenuItem; private System.Windows.Forms.PictureBox EditModePictureBox; private System.Windows.Forms.PictureBox DeleteModePictureBox; private System.Windows.Forms.PictureBox CopyLinkPictureBox; @@ -760,5 +760,6 @@ namespace Netch.Forms private System.Windows.Forms.ToolStripMenuItem reinstallTapDriverToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem AddTrojanServerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem RelyToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem OpenDirectoryToolStripMenuItem; } } \ No newline at end of file diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index e32c4484..a285f94e 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -48,6 +48,7 @@ namespace Netch.Forms /// public static MainForm Instance = null; + public MainForm() { InitializeComponent(); @@ -357,7 +358,7 @@ namespace Netch.Forms AddTrojanServerToolStripMenuItem.Text = Utils.i18N.Translate(AddTrojanServerToolStripMenuItem.Text); ModeToolStripMenuItem.Text = Utils.i18N.Translate(ModeToolStripMenuItem.Text); CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(CreateProcessModeToolStripMenuItem.Text); - ManageProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(ManageProcessModeToolStripMenuItem.Text); + OpenDirectoryToolStripMenuItem.Text = Utils.i18N.Translate(OpenDirectoryToolStripMenuItem.Text); SubscribeToolStripMenuItem.Text = Utils.i18N.Translate(SubscribeToolStripMenuItem.Text); ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text); UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text); @@ -384,6 +385,10 @@ namespace Netch.Forms ExitToolStripButton.Text = Utils.i18N.Translate(ExitToolStripButton.Text); RelyToolStripMenuItem.Text = Utils.i18N.Translate(RelyToolStripMenuItem.Text); + SizeHeight = Size.Height; + ControllHeight = ConfigurationGroupBox.Controls[0].Height/3; + ProfileBoxHeight = ProfileGroupBox.Height; + CFGBoxHeight = ConfigurationGroupBox.Height; InitProfile(); // 自动检测延迟 @@ -509,9 +514,9 @@ namespace Netch.Forms Hide(); } - private void ManageProcessModeToolStripMenuItem_Click(object sender, EventArgs e) + private void OpenDirectoryToolStripMenuItem_Click(object sender, EventArgs e) { - Utils.Utils.OpenDir(@"mode"); + Utils.Utils.OpenDir(@".\"); } private void ManageSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e) @@ -1232,48 +1237,64 @@ namespace Netch.Forms } + // init at MainFrom_Load() + private int SizeHeight; + private int ControllHeight; + private int ProfileBoxHeight; + private int CFGBoxHeight; + + public void InitProfile() { - var num_profile = Global.Settings.ProfileCount; - if (num_profile == 0) + + foreach (var button in ProfileButtons) { - ProfileGroupBox.Size = new Size(0, 0); - ConfigurationGroupBox.Size -= new Size(0, 25); - this.Size -= new Size(0, 70 + 25); + button.Dispose(); + } + ProfileButtons.Clear(); + ProfileTable.ColumnStyles.Clear(); + ProfileTable.RowStyles.Clear(); + + var numProfile = Global.Settings.ProfileCount; + if (numProfile == 0) + { + configLayoutPanel.RowStyles[2].SizeType = SizeType.Percent; configLayoutPanel.RowStyles[2].Height = 0; + ProfileGroupBox.Visible = false; + + ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, CFGBoxHeight-ControllHeight); + Size = new Size(Size.Width,SizeHeight-(ControllHeight+ProfileBoxHeight)); + return; } - ProfileTable.ColumnCount = num_profile; + configLayoutPanel.RowStyles[2].SizeType = SizeType.AutoSize; + ProfileGroupBox.Visible = true; + ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width,CFGBoxHeight); + Size = new Size(Size.Width,SizeHeight); - while (Global.Settings.profiles.Count < num_profile) + + ProfileTable.ColumnCount = numProfile; + + while (Global.Settings.Profiles.Count < numProfile) { - Global.Settings.profiles.Add(new Models.Profile()); + Global.Settings.Profiles.Add(new Models.Profile()); } // buttons - for (var i = 0; i < num_profile; ++i) + for (var i = 0; i < numProfile; ++i) { var b = new Button(); ProfileTable.Controls.Add(b, i, 0); b.Location = new Point(i * 100, 0); b.Click += ProfileButton_Click; b.Dock = DockStyle.Fill; - b.Text = "None"; - ProfileButtons.Add(b); + b.Text = !Global.Settings.Profiles[i].IsDummy ? Global.Settings.Profiles[i].ProfileName : Utils.i18N.Translate("None"); - if (!Global.Settings.profiles[i].IsDummy) - { - b.Text = Global.Settings.profiles[i].ProfileName; - } - else - { - b.Text = Utils.i18N.Translate(b.Text); - } + ProfileButtons.Add(b); } // equal column - ProfileTable.ColumnStyles.Clear(); for (var i = 1; i <= ProfileTable.RowCount; i++) { ProfileTable.RowStyles.Add(new RowStyle(SizeType.Percent, 1)); @@ -1286,7 +1307,7 @@ namespace Netch.Forms private string LoadProfile(int index) { - var p = Global.Settings.profiles[index]; + var p = Global.Settings.Profiles[index]; if (p.IsDummy) throw new Exception("Profile not found."); @@ -1329,7 +1350,7 @@ namespace Netch.Forms var selectedMode = (Models.Mode)ModeComboBox.SelectedItem; var name = ProfileNameText.Text; - Global.Settings.profiles[index] = new Models.Profile(selectedServer, selectedMode, name); + Global.Settings.Profiles[index] = new Models.Profile(selectedServer, selectedMode, name); } @@ -1568,5 +1589,14 @@ namespace Netch.Forms { Process.Start($"https://mega.nz/file/9OQ1EazJ#0pjJ3xt57AVLr29vYEEv15GSACtXVQOGlEOPpi_2Ico"); } + + private void MainForm_VisibleChanged(object sender, EventArgs e) + { + if (!Visible) + return; + + InitProfile(); + + } } } diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs index 0af2b4a3..5cdba74b 100644 --- a/Netch/Forms/SettingForm.Designer.cs +++ b/Netch/Forms/SettingForm.Designer.cs @@ -473,9 +473,9 @@ // // ProfileCount_TextBox // - this.ProfileCount_TextBox.Location = new System.Drawing.Point(209, 164); + this.ProfileCount_TextBox.Location = new System.Drawing.Point(120, 164); this.ProfileCount_TextBox.Name = "ProfileCount_TextBox"; - this.ProfileCount_TextBox.Size = new System.Drawing.Size(226, 23); + this.ProfileCount_TextBox.Size = new System.Drawing.Size(90, 23); this.ProfileCount_TextBox.TabIndex = 9; this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index 3c4fb4c8..34e45f5e 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -433,7 +433,7 @@ namespace Netch.Forms Global.Settings.TUNTAP.UseFakeDNS = UseFakeDNSCheckBox.Checked; Utils.Configuration.Save(); - MessageBox.Show(Utils.i18N.Translate("Saved. Modify some settings need to restart the software"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index 7c0491ad..10806750 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -142,7 +142,7 @@ namespace Netch.Models /// /// 已保存的快捷配置 /// - public List profiles = new List(); + public List Profiles = new List(); /// /// 快捷配置数量 diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index 65f7b687..db88ef9f 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -47,7 +47,6 @@ "New version available": "发现新版本", "Mode": "模式", "Create Process Mode": "创建进程模式", - "Manage Process Mode": "管理进程模式", "Edit Process Mode": "修改进程模式", "Address": "地址", @@ -99,6 +98,7 @@ "Reinstall TUN/TAP driver successfully": "重装 TUN/TAP 驱动成功", "Reinstall TUN/TAP driver failed": "重装 TUN/TAP 驱动失败", "Reinstalling TUN/TAP driver": "正在重装 TUN/TAP 驱动", + "Open Directory": "打开目录", "About": "关于", "Telegram Channel": "Telegram 频道", @@ -165,7 +165,7 @@ "Port value illegal. Try again.": "端口值非法。请重试。", "Check update when opened": "打开软件时检查更新", "Start Shadowsocks from DLL (No support for ACL)": "SS DLL(推荐使用,不支持 ACL)", - "ProfileCount": "快捷配置数量(重启软件生效)", + "ProfileCount": "快捷配置数量", "ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。", "STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。", "Detection interval value illegal. Try again.": "检测间隔值非法。请重试。", @@ -179,7 +179,7 @@ "STUN Server Port": "STUN 服务器端口", "Custom ACL": "自定义 ACL 规则", "Language": "语言", - "Saved. Modify some settings need to restart the software": "保存成功,修改部分设置需重启软件", + "Saved.": "保存成功", "Profile": "配置名", "Profiles": "配置",