diff --git a/.gitignore b/.gitignore index 7f7f9051..8f99a9fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.vs /packages .idea/ +/*.user \ No newline at end of file diff --git a/Netch/Forms/MainForm.Designer.cs b/Netch/Forms/MainForm.Designer.cs index 2d23ee91..952c9bc6 100644 --- a/Netch/Forms/MainForm.Designer.cs +++ b/Netch/Forms/MainForm.Designer.cs @@ -48,6 +48,7 @@ this.updatePACToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UninstallTapDriverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeNetchFirewallRulesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.HelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CheckForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fAQToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -89,7 +90,7 @@ this.ProfileTable = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.ButtomControlContainerControl = new System.Windows.Forms.ContainerControl(); - this.removeNetchFirewallRulesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AttachConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuStrip.SuspendLayout(); this.ConfigurationGroupBox.SuspendLayout(); this.configLayoutPanel.SuspendLayout(); @@ -114,8 +115,10 @@ this.MenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.ServerToolStripMenuItem, this.ModeToolStripMenuItem, this.SubscribeToolStripMenuItem, this.OptionsToolStripMenuItem, this.HelpToolStripMenuItem, this.exitToolStripMenuItem, this.AboutToolStripButton, this.NewVersionLabel, this.VersionLabel + this.ServerToolStripMenuItem, this.ModeToolStripMenuItem, this.SubscribeToolStripMenuItem, this.OptionsToolStripMenuItem, this.HelpToolStripMenuItem, this.exitToolStripMenuItem, this.AboutToolStripButton, + this.NewVersionLabel, this.VersionLabel }); + this.MenuStrip.Location = new System.Drawing.Point(0, 0); this.MenuStrip.Name = "MenuStrip"; this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; @@ -124,10 +127,7 @@ // // ServerToolStripMenuItem // - this.ServerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.ImportServersFromClipboardToolStripMenuItem - }); + this.ServerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.ImportServersFromClipboardToolStripMenuItem}); this.ServerToolStripMenuItem.Margin = new System.Windows.Forms.Padding(3, 0, 0, 1); this.ServerToolStripMenuItem.Name = "ServerToolStripMenuItem"; this.ServerToolStripMenuItem.Size = new System.Drawing.Size(57, 21); @@ -142,10 +142,7 @@ // // ModeToolStripMenuItem // - this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.CreateProcessModeToolStripMenuItem, this.ReloadModesToolStripMenuItem - }); + this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.CreateProcessModeToolStripMenuItem, this.ReloadModesToolStripMenuItem}); 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); @@ -167,10 +164,7 @@ // // SubscribeToolStripMenuItem // - this.SubscribeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.ManageSubscribeLinksToolStripMenuItem, this.UpdateServersFromSubscribeLinksToolStripMenuItem, this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem - }); + this.SubscribeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.ManageSubscribeLinksToolStripMenuItem, this.UpdateServersFromSubscribeLinksToolStripMenuItem, this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem}); this.SubscribeToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); this.SubscribeToolStripMenuItem.Name = "SubscribeToolStripMenuItem"; this.SubscribeToolStripMenuItem.Size = new System.Drawing.Size(77, 21); @@ -201,8 +195,10 @@ // this.OptionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.OpenDirectoryToolStripMenuItem, this.CleanDNSCacheToolStripMenuItem, this.UpdateACLToolStripMenuItem, this.updateACLWithProxyToolStripMenuItem, this.updatePACToolStripMenuItem, this.UninstallServiceToolStripMenuItem, this.UninstallTapDriverToolStripMenuItem, this.removeNetchFirewallRulesToolStripMenuItem + this.OpenDirectoryToolStripMenuItem, this.CleanDNSCacheToolStripMenuItem, this.UpdateACLToolStripMenuItem, this.updateACLWithProxyToolStripMenuItem, this.updatePACToolStripMenuItem, this.UninstallServiceToolStripMenuItem, this.UninstallTapDriverToolStripMenuItem, + this.removeNetchFirewallRulesToolStripMenuItem, this.AttachConsoleToolStripMenuItem }); + 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); @@ -257,12 +253,16 @@ this.UninstallTapDriverToolStripMenuItem.Text = "Uninstall TUN/TAP driver"; this.UninstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.UninstallTapDriverToolStripMenuItem_Click); // + // removeNetchFirewallRulesToolStripMenuItem + // + this.removeNetchFirewallRulesToolStripMenuItem.Name = "removeNetchFirewallRulesToolStripMenuItem"; + this.removeNetchFirewallRulesToolStripMenuItem.Size = new System.Drawing.Size(243, 22); + this.removeNetchFirewallRulesToolStripMenuItem.Text = "Remove Netch Firewall Rules"; + this.removeNetchFirewallRulesToolStripMenuItem.Click += new System.EventHandler(this.RemoveNetchFirewallRulesToolStripMenuItem_Click); + // // HelpToolStripMenuItem // - this.HelpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.CheckForUpdatesToolStripMenuItem, this.fAQToolStripMenuItem - }); + this.HelpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.CheckForUpdatesToolStripMenuItem, this.fAQToolStripMenuItem}); this.HelpToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); this.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"; this.HelpToolStripMenuItem.Size = new System.Drawing.Size(47, 21); @@ -538,10 +538,7 @@ // StatusStrip // this.StatusStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.StatusLabel, this.UsedBandwidthLabel, this.DownloadSpeedLabel, this.UploadSpeedLabel, this.blankToolStripStatusLabel, this.NatTypeStatusLabel, this.NatTypeStatusLightLabel - }); + this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.StatusLabel, this.UsedBandwidthLabel, this.DownloadSpeedLabel, this.UploadSpeedLabel, this.blankToolStripStatusLabel, this.NatTypeStatusLabel, this.NatTypeStatusLightLabel}); this.StatusStrip.Location = new System.Drawing.Point(0, 272); this.StatusStrip.Name = "StatusStrip"; this.StatusStrip.Size = new System.Drawing.Size(740, 22); @@ -624,10 +621,7 @@ // NotifyMenu // this.NotifyMenu.ImageScalingSize = new System.Drawing.Size(20, 20); - this.NotifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] - { - this.ShowMainFormToolStripButton, this.ExitToolStripButton - }); + this.NotifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.ShowMainFormToolStripButton, this.ExitToolStripButton}); this.NotifyMenu.Name = "NotifyMenu"; this.NotifyMenu.ShowItemToolTips = false; this.NotifyMenu.Size = new System.Drawing.Size(108, 48); @@ -707,12 +701,12 @@ this.ButtomControlContainerControl.TabStop = false; this.ButtomControlContainerControl.Text = "groupBox1"; // - // removeNetchFirewallRulesToolStripMenuItem + // AttachConsoleToolStripMenuItem // - this.removeNetchFirewallRulesToolStripMenuItem.Name = "removeNetchFirewallRulesToolStripMenuItem"; - this.removeNetchFirewallRulesToolStripMenuItem.Size = new System.Drawing.Size(243, 22); - this.removeNetchFirewallRulesToolStripMenuItem.Text = "Remove Netch Firewall Rules"; - this.removeNetchFirewallRulesToolStripMenuItem.Click += new System.EventHandler(this.RemoveNetchFirewallRulesToolStripMenuItem_Click); + this.AttachConsoleToolStripMenuItem.Name = "AttachConsoleToolStripMenuItem"; + this.AttachConsoleToolStripMenuItem.Size = new System.Drawing.Size(243, 22); + this.AttachConsoleToolStripMenuItem.Text = "Attach Console"; + this.AttachConsoleToolStripMenuItem.Click += new System.EventHandler(this.AttachConsoleToolStripMenuItem_Click); // // MainForm // @@ -758,6 +752,8 @@ this.ResumeLayout(false); this.PerformLayout(); } + + private System.Windows.Forms.ToolStripMenuItem AttachConsoleToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeNetchFirewallRulesToolStripMenuItem; private System.Windows.Forms.ToolStripButton AboutToolStripButton; diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index e66a4f4b..88d87f24 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -1575,5 +1575,11 @@ namespace Netch.Forms #endregion #endregion + + private void AttachConsoleToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!NativeMethods.AttachConsole(-1)) + NativeMethods.AllocConsole(); + } } } \ No newline at end of file