Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
wixy | 62a1ade1e6 | |
wixy | 34e797625b | |
wixy | c6437d822e | |
wixy | 86d37be2c0 | |
Donald | 2280400c5f |
|
@ -1,6 +1,6 @@
|
|||
### Ultron.Ngrok
|
||||
|
||||
Ultron.Ngrok 简称uNgrok,是级域Ngrok的图形化配置辅助工具,帮助用户更方便的使用Ngrok
|
||||
Ultron.Ngrok 简称uNgrok,是基于Ngrok的图形化配置辅助工具,帮助用户更方便的使用Ngrok
|
||||
|
||||
|
||||
### Ngrok
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
this.labelProductName = new System.Windows.Forms.Label();
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.labelCopyright = new System.Windows.Forms.Label();
|
||||
this.labelEmail = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -42,16 +43,18 @@
|
|||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 0, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 0, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 0, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelEmail, 0, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 0, 4);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 8);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 4;
|
||||
this.tableLayoutPanel.RowCount = 5;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(223, 100);
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(223, 113);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// labelProductName
|
||||
|
@ -69,7 +72,7 @@
|
|||
// labelVersion
|
||||
//
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(6, 20);
|
||||
this.labelVersion.Location = new System.Drawing.Point(6, 21);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
|
@ -81,7 +84,7 @@
|
|||
// labelCopyright
|
||||
//
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(6, 39);
|
||||
this.labelCopyright.Location = new System.Drawing.Point(6, 42);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
|
@ -90,13 +93,25 @@
|
|||
this.labelCopyright.Text = "版权";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelEmail
|
||||
//
|
||||
this.labelEmail.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelEmail.Location = new System.Drawing.Point(6, 63);
|
||||
this.labelEmail.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelEmail.MaximumSize = new System.Drawing.Size(0, 16);
|
||||
this.labelEmail.Name = "labelEmail";
|
||||
this.labelEmail.Size = new System.Drawing.Size(214, 16);
|
||||
this.labelEmail.TabIndex = 25;
|
||||
this.labelEmail.Text = "Email";
|
||||
this.labelEmail.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.okButton.Location = new System.Drawing.Point(145, 65);
|
||||
this.okButton.Location = new System.Drawing.Point(145, 91);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 25);
|
||||
this.okButton.Size = new System.Drawing.Size(75, 19);
|
||||
this.okButton.TabIndex = 24;
|
||||
this.okButton.Text = "确定(&O)";
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
|
@ -106,7 +121,7 @@
|
|||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(241, 116);
|
||||
this.ClientSize = new System.Drawing.Size(241, 129);
|
||||
this.Controls.Add(this.tableLayoutPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
|
@ -129,5 +144,6 @@
|
|||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Label labelCopyright;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Label labelEmail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Ultron.Ngrok
|
|||
this.labelProductName.Text = AssemblyProduct;
|
||||
this.labelVersion.Text = String.Format("版本 {0}", AssemblyVersion);
|
||||
this.labelCopyright.Text = AssemblyCopyright;
|
||||
this.labelEmail.Text = "邮箱 wixy@qq.com";
|
||||
}
|
||||
|
||||
#region 程序集特性访问器
|
||||
|
@ -104,6 +105,5 @@ namespace Ultron.Ngrok
|
|||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,71 +28,73 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.TunnelConfigGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.enableCBX = new System.Windows.Forms.CheckBox();
|
||||
this.ipTB = new System.Windows.Forms.TextBox();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.delButton = new System.Windows.Forms.Button();
|
||||
this.enableCBX = new System.Windows.Forms.CheckBox();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.tunnelListBox = new System.Windows.Forms.ListBox();
|
||||
this.ipTB = new System.Windows.Forms.TextBox();
|
||||
this.tunnelTypeLabelPort = new System.Windows.Forms.Label();
|
||||
this.tunnelTypeCMB = new System.Windows.Forms.ComboBox();
|
||||
this.tunnelTypeLabel = new System.Windows.Forms.Label();
|
||||
this.portTB = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.tunnelNameTB = new System.Windows.Forms.TextBox();
|
||||
this.subdomainLBL = new System.Windows.Forms.Label();
|
||||
this.subdomainTB = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.tunnelTypeLabelPort = new System.Windows.Forms.Label();
|
||||
this.subdomainLBL = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.tunnelTypeLabel = new System.Windows.Forms.Label();
|
||||
this.tunnelTypeCMB = new System.Windows.Forms.ComboBox();
|
||||
this.tunnelListBox = new System.Windows.Forms.ListBox();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.tpCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.notShowCB = new System.Windows.Forms.CheckBox();
|
||||
this.autoStartCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.saveButton = new System.Windows.Forms.Button();
|
||||
this.TunnelConfigGroupBox.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TunnelConfigGroupBox
|
||||
// tabControl1
|
||||
//
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.enableCBX);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.ipTB);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.delButton);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.addButton);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.portTB);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.tunnelNameTB);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.subdomainTB);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.label1);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.label2);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.label5);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeLabelPort);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.subdomainLBL);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.label3);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeLabel);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.tunnelTypeCMB);
|
||||
this.TunnelConfigGroupBox.Controls.Add(this.tunnelListBox);
|
||||
this.TunnelConfigGroupBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.TunnelConfigGroupBox.Name = "TunnelConfigGroupBox";
|
||||
this.TunnelConfigGroupBox.Size = new System.Drawing.Size(291, 201);
|
||||
this.TunnelConfigGroupBox.TabIndex = 8;
|
||||
this.TunnelConfigGroupBox.TabStop = false;
|
||||
this.TunnelConfigGroupBox.Text = "通道配置";
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Location = new System.Drawing.Point(8, 2);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(327, 188);
|
||||
this.tabControl1.TabIndex = 9;
|
||||
//
|
||||
// enableCBX
|
||||
// tabPage1
|
||||
//
|
||||
this.enableCBX.AutoSize = true;
|
||||
this.enableCBX.Location = new System.Drawing.Point(193, 154);
|
||||
this.enableCBX.Name = "enableCBX";
|
||||
this.enableCBX.Size = new System.Drawing.Size(15, 14);
|
||||
this.enableCBX.TabIndex = 10;
|
||||
this.enableCBX.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ipTB
|
||||
//
|
||||
this.ipTB.Location = new System.Drawing.Point(193, 100);
|
||||
this.ipTB.Name = "ipTB";
|
||||
this.ipTB.Size = new System.Drawing.Size(92, 21);
|
||||
this.ipTB.TabIndex = 9;
|
||||
this.tabPage1.BackColor = System.Drawing.Color.White;
|
||||
this.tabPage1.Controls.Add(this.delButton);
|
||||
this.tabPage1.Controls.Add(this.enableCBX);
|
||||
this.tabPage1.Controls.Add(this.addButton);
|
||||
this.tabPage1.Controls.Add(this.tunnelListBox);
|
||||
this.tabPage1.Controls.Add(this.ipTB);
|
||||
this.tabPage1.Controls.Add(this.tunnelTypeLabelPort);
|
||||
this.tabPage1.Controls.Add(this.tunnelTypeCMB);
|
||||
this.tabPage1.Controls.Add(this.tunnelTypeLabel);
|
||||
this.tabPage1.Controls.Add(this.portTB);
|
||||
this.tabPage1.Controls.Add(this.label3);
|
||||
this.tabPage1.Controls.Add(this.tunnelNameTB);
|
||||
this.tabPage1.Controls.Add(this.subdomainLBL);
|
||||
this.tabPage1.Controls.Add(this.subdomainTB);
|
||||
this.tabPage1.Controls.Add(this.label5);
|
||||
this.tabPage1.Controls.Add(this.label1);
|
||||
this.tabPage1.Controls.Add(this.label2);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(319, 162);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "通道配置";
|
||||
//
|
||||
// delButton
|
||||
//
|
||||
this.delButton.Location = new System.Drawing.Point(76, 172);
|
||||
this.delButton.Location = new System.Drawing.Point(76, 131);
|
||||
this.delButton.Name = "delButton";
|
||||
this.delButton.Size = new System.Drawing.Size(50, 23);
|
||||
this.delButton.TabIndex = 1;
|
||||
|
@ -100,9 +102,18 @@
|
|||
this.delButton.UseVisualStyleBackColor = true;
|
||||
this.delButton.Click += new System.EventHandler(this.delButton_Click);
|
||||
//
|
||||
// enableCBX
|
||||
//
|
||||
this.enableCBX.AutoSize = true;
|
||||
this.enableCBX.Location = new System.Drawing.Point(195, 140);
|
||||
this.enableCBX.Name = "enableCBX";
|
||||
this.enableCBX.Size = new System.Drawing.Size(15, 14);
|
||||
this.enableCBX.TabIndex = 10;
|
||||
this.enableCBX.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Location = new System.Drawing.Point(6, 172);
|
||||
this.addButton.Location = new System.Drawing.Point(6, 131);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(50, 23);
|
||||
this.addButton.TabIndex = 1;
|
||||
|
@ -110,31 +121,110 @@
|
|||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// tunnelListBox
|
||||
//
|
||||
this.tunnelListBox.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tunnelListBox.FormattingEnabled = true;
|
||||
this.tunnelListBox.ItemHeight = 14;
|
||||
this.tunnelListBox.Location = new System.Drawing.Point(6, 6);
|
||||
this.tunnelListBox.Name = "tunnelListBox";
|
||||
this.tunnelListBox.Size = new System.Drawing.Size(120, 116);
|
||||
this.tunnelListBox.TabIndex = 5;
|
||||
this.tunnelListBox.SelectedIndexChanged += new System.EventHandler(this.tunnelListBox_SelectedValueChanged);
|
||||
//
|
||||
// ipTB
|
||||
//
|
||||
this.ipTB.Location = new System.Drawing.Point(195, 86);
|
||||
this.ipTB.Name = "ipTB";
|
||||
this.ipTB.Size = new System.Drawing.Size(92, 21);
|
||||
this.ipTB.TabIndex = 9;
|
||||
//
|
||||
// tunnelTypeLabelPort
|
||||
//
|
||||
this.tunnelTypeLabelPort.AutoSize = true;
|
||||
this.tunnelTypeLabelPort.Location = new System.Drawing.Point(136, 36);
|
||||
this.tunnelTypeLabelPort.Name = "tunnelTypeLabelPort";
|
||||
this.tunnelTypeLabelPort.Size = new System.Drawing.Size(53, 12);
|
||||
this.tunnelTypeLabelPort.TabIndex = 8;
|
||||
this.tunnelTypeLabelPort.Text = "远程端口";
|
||||
this.tunnelTypeLabelPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tunnelTypeLabelPort.Visible = false;
|
||||
//
|
||||
// tunnelTypeCMB
|
||||
//
|
||||
this.tunnelTypeCMB.FormattingEnabled = true;
|
||||
this.tunnelTypeCMB.Items.AddRange(new object[] {
|
||||
"TCP",
|
||||
"HTTP"});
|
||||
this.tunnelTypeCMB.Location = new System.Drawing.Point(195, 60);
|
||||
this.tunnelTypeCMB.Name = "tunnelTypeCMB";
|
||||
this.tunnelTypeCMB.Size = new System.Drawing.Size(92, 20);
|
||||
this.tunnelTypeCMB.TabIndex = 6;
|
||||
this.tunnelTypeCMB.SelectedIndexChanged += new System.EventHandler(this.tunnelTypeCMB_SelectedIndexChanged);
|
||||
//
|
||||
// tunnelTypeLabel
|
||||
//
|
||||
this.tunnelTypeLabel.AutoSize = true;
|
||||
this.tunnelTypeLabel.Location = new System.Drawing.Point(136, 63);
|
||||
this.tunnelTypeLabel.Name = "tunnelTypeLabel";
|
||||
this.tunnelTypeLabel.Size = new System.Drawing.Size(53, 12);
|
||||
this.tunnelTypeLabel.TabIndex = 7;
|
||||
this.tunnelTypeLabel.Text = "通道类型";
|
||||
//
|
||||
// portTB
|
||||
//
|
||||
this.portTB.Location = new System.Drawing.Point(193, 127);
|
||||
this.portTB.Location = new System.Drawing.Point(195, 113);
|
||||
this.portTB.Name = "portTB";
|
||||
this.portTB.Size = new System.Drawing.Size(92, 21);
|
||||
this.portTB.TabIndex = 9;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(148, 89);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.label3.Size = new System.Drawing.Size(41, 12);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "IP地址";
|
||||
//
|
||||
// tunnelNameTB
|
||||
//
|
||||
this.tunnelNameTB.Location = new System.Drawing.Point(193, 20);
|
||||
this.tunnelNameTB.Location = new System.Drawing.Point(195, 6);
|
||||
this.tunnelNameTB.Name = "tunnelNameTB";
|
||||
this.tunnelNameTB.Size = new System.Drawing.Size(92, 21);
|
||||
this.tunnelNameTB.TabIndex = 9;
|
||||
//
|
||||
// subdomainLBL
|
||||
//
|
||||
this.subdomainLBL.AutoSize = true;
|
||||
this.subdomainLBL.Location = new System.Drawing.Point(148, 36);
|
||||
this.subdomainLBL.Name = "subdomainLBL";
|
||||
this.subdomainLBL.Size = new System.Drawing.Size(41, 12);
|
||||
this.subdomainLBL.TabIndex = 8;
|
||||
this.subdomainLBL.Text = "子域名";
|
||||
this.subdomainLBL.Visible = false;
|
||||
//
|
||||
// subdomainTB
|
||||
//
|
||||
this.subdomainTB.Location = new System.Drawing.Point(193, 47);
|
||||
this.subdomainTB.Location = new System.Drawing.Point(195, 33);
|
||||
this.subdomainTB.Name = "subdomainTB";
|
||||
this.subdomainTB.Size = new System.Drawing.Size(92, 21);
|
||||
this.subdomainTB.TabIndex = 9;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(160, 10);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(29, 12);
|
||||
this.label5.TabIndex = 8;
|
||||
this.label5.Text = "名称";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(158, 154);
|
||||
this.label1.Location = new System.Drawing.Point(160, 140);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 12);
|
||||
this.label1.TabIndex = 8;
|
||||
|
@ -143,87 +233,58 @@
|
|||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(158, 130);
|
||||
this.label2.Location = new System.Drawing.Point(160, 116);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(29, 12);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "端口";
|
||||
//
|
||||
// label5
|
||||
// tabPage2
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(158, 24);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(29, 12);
|
||||
this.label5.TabIndex = 8;
|
||||
this.label5.Text = "名称";
|
||||
this.tabPage2.BackColor = System.Drawing.Color.White;
|
||||
this.tabPage2.Controls.Add(this.tpCheckBox);
|
||||
this.tabPage2.Controls.Add(this.notShowCB);
|
||||
this.tabPage2.Controls.Add(this.autoStartCheckBox);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(319, 162);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "应用设置";
|
||||
//
|
||||
// tunnelTypeLabelPort
|
||||
// tpCheckBox
|
||||
//
|
||||
this.tunnelTypeLabelPort.AutoSize = true;
|
||||
this.tunnelTypeLabelPort.Location = new System.Drawing.Point(134, 50);
|
||||
this.tunnelTypeLabelPort.Name = "tunnelTypeLabelPort";
|
||||
this.tunnelTypeLabelPort.Size = new System.Drawing.Size(53, 12);
|
||||
this.tunnelTypeLabelPort.TabIndex = 8;
|
||||
this.tunnelTypeLabelPort.Text = "远程端口";
|
||||
this.tunnelTypeLabelPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tunnelTypeLabelPort.Visible = false;
|
||||
this.tpCheckBox.AutoSize = true;
|
||||
this.tpCheckBox.Location = new System.Drawing.Point(17, 62);
|
||||
this.tpCheckBox.Name = "tpCheckBox";
|
||||
this.tpCheckBox.Size = new System.Drawing.Size(108, 16);
|
||||
this.tpCheckBox.TabIndex = 12;
|
||||
this.tpCheckBox.Text = "退出隐藏到托盘";
|
||||
this.tpCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// subdomainLBL
|
||||
// notShowCB
|
||||
//
|
||||
this.subdomainLBL.AutoSize = true;
|
||||
this.subdomainLBL.Location = new System.Drawing.Point(146, 50);
|
||||
this.subdomainLBL.Name = "subdomainLBL";
|
||||
this.subdomainLBL.Size = new System.Drawing.Size(41, 12);
|
||||
this.subdomainLBL.TabIndex = 8;
|
||||
this.subdomainLBL.Text = "子域名";
|
||||
this.subdomainLBL.Visible = false;
|
||||
this.notShowCB.AutoSize = true;
|
||||
this.notShowCB.Location = new System.Drawing.Point(17, 40);
|
||||
this.notShowCB.Name = "notShowCB";
|
||||
this.notShowCB.Size = new System.Drawing.Size(108, 16);
|
||||
this.notShowCB.TabIndex = 12;
|
||||
this.notShowCB.Text = "不显示运行窗口";
|
||||
this.notShowCB.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
// autoStartCheckBox
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(146, 103);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.label3.Size = new System.Drawing.Size(41, 12);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "IP地址";
|
||||
//
|
||||
// tunnelTypeLabel
|
||||
//
|
||||
this.tunnelTypeLabel.AutoSize = true;
|
||||
this.tunnelTypeLabel.Location = new System.Drawing.Point(134, 77);
|
||||
this.tunnelTypeLabel.Name = "tunnelTypeLabel";
|
||||
this.tunnelTypeLabel.Size = new System.Drawing.Size(53, 12);
|
||||
this.tunnelTypeLabel.TabIndex = 7;
|
||||
this.tunnelTypeLabel.Text = "通道类型";
|
||||
//
|
||||
// tunnelTypeCMB
|
||||
//
|
||||
this.tunnelTypeCMB.FormattingEnabled = true;
|
||||
this.tunnelTypeCMB.Items.AddRange(new object[] {
|
||||
"TCP",
|
||||
"HTTP"});
|
||||
this.tunnelTypeCMB.Location = new System.Drawing.Point(193, 74);
|
||||
this.tunnelTypeCMB.Name = "tunnelTypeCMB";
|
||||
this.tunnelTypeCMB.Size = new System.Drawing.Size(92, 20);
|
||||
this.tunnelTypeCMB.TabIndex = 6;
|
||||
this.tunnelTypeCMB.SelectedIndexChanged += new System.EventHandler(this.tunnelTypeCMB_SelectedIndexChanged);
|
||||
//
|
||||
// tunnelListBox
|
||||
//
|
||||
this.tunnelListBox.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tunnelListBox.FormattingEnabled = true;
|
||||
this.tunnelListBox.ItemHeight = 14;
|
||||
this.tunnelListBox.Location = new System.Drawing.Point(6, 20);
|
||||
this.tunnelListBox.Name = "tunnelListBox";
|
||||
this.tunnelListBox.Size = new System.Drawing.Size(120, 144);
|
||||
this.tunnelListBox.TabIndex = 5;
|
||||
this.tunnelListBox.SelectedIndexChanged += new System.EventHandler(this.tunnelListBox_SelectedValueChanged);
|
||||
this.autoStartCheckBox.AutoSize = true;
|
||||
this.autoStartCheckBox.Location = new System.Drawing.Point(17, 18);
|
||||
this.autoStartCheckBox.Name = "autoStartCheckBox";
|
||||
this.autoStartCheckBox.Size = new System.Drawing.Size(72, 16);
|
||||
this.autoStartCheckBox.TabIndex = 12;
|
||||
this.autoStartCheckBox.Text = "自动启动";
|
||||
this.autoStartCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
this.saveButton.Location = new System.Drawing.Point(228, 219);
|
||||
this.saveButton.Location = new System.Drawing.Point(256, 196);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.saveButton.TabIndex = 1;
|
||||
|
@ -235,8 +296,8 @@
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(309, 247);
|
||||
this.Controls.Add(this.TunnelConfigGroupBox);
|
||||
this.ClientSize = new System.Drawing.Size(340, 225);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
|
@ -246,15 +307,17 @@
|
|||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "设置";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingForm_FormClosed);
|
||||
this.TunnelConfigGroupBox.ResumeLayout(false);
|
||||
this.TunnelConfigGroupBox.PerformLayout();
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox TunnelConfigGroupBox;
|
||||
private System.Windows.Forms.CheckBox enableCBX;
|
||||
private System.Windows.Forms.TextBox ipTB;
|
||||
private System.Windows.Forms.Button delButton;
|
||||
|
@ -272,5 +335,11 @@
|
|||
private System.Windows.Forms.ListBox tunnelListBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label tunnelTypeLabelPort;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.CheckBox autoStartCheckBox;
|
||||
private System.Windows.Forms.CheckBox notShowCB;
|
||||
private System.Windows.Forms.CheckBox tpCheckBox;
|
||||
}
|
||||
}
|
|
@ -104,6 +104,9 @@ namespace Ultron.Ngrok
|
|||
ServerAddr = "ngrok.aaqbee.com:8083",
|
||||
TrustHostRootCerts = false,
|
||||
Version = AssemblyVersion,
|
||||
AutoStart = false,
|
||||
UseNotifyMenu = true,
|
||||
HideWindow = false,
|
||||
Tunnels = new Dictionary<string, Tunnel>()
|
||||
};
|
||||
Tunnel httpTunnel = new Tunnel
|
||||
|
@ -142,6 +145,9 @@ namespace Ultron.Ngrok
|
|||
if(ServerConfig.Version != AssemblyVersion)
|
||||
{
|
||||
ServerConfig.Version = AssemblyVersion;
|
||||
ServerConfig.AutoStart = false;
|
||||
ServerConfig.UseNotifyMenu = true;
|
||||
ServerConfig.HideWindow = false;
|
||||
SaveConfig();
|
||||
}
|
||||
}
|
||||
|
@ -169,16 +175,27 @@ namespace Ultron.Ngrok
|
|||
tunnelName += " " + item.Key;
|
||||
}
|
||||
|
||||
autoStartCheckBox.Checked = ServerConfig.AutoStart;
|
||||
notShowCB.Checked = ServerConfig.HideWindow;
|
||||
tpCheckBox.Checked = ServerConfig.UseNotifyMenu;
|
||||
|
||||
ExecuteCommand = ExeFile + ".exe -config ngrok.cfg start" + tunnelName;
|
||||
}
|
||||
|
||||
public void ReLoadConfig()
|
||||
{
|
||||
string configText = File.ReadAllText(ConfigFile, Encoding.UTF8);
|
||||
var input = new StringReader(configText);
|
||||
var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
|
||||
ServerConfig = deserializer.Deserialize<Config>(input);
|
||||
|
||||
try
|
||||
{
|
||||
string configText = File.ReadAllText(ConfigFile, Encoding.UTF8);
|
||||
var input = new StringReader(configText);
|
||||
//var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
|
||||
var deserializer = new Deserializer();
|
||||
ServerConfig = deserializer.Deserialize<Config>(input);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.InnerException.Message);
|
||||
}
|
||||
LoadConfig();
|
||||
}
|
||||
|
||||
|
@ -317,8 +334,16 @@ namespace Ultron.Ngrok
|
|||
tunl.TunnelName = tunnelNameTB.Text;
|
||||
tunl.Enable = enableCBX.Checked;
|
||||
|
||||
SaveConfig();
|
||||
ServerConfig.AutoStart = autoStartCheckBox.Checked;
|
||||
ServerConfig.HideWindow = notShowCB.Checked;
|
||||
ServerConfig.UseNotifyMenu = tpCheckBox.Checked;
|
||||
|
||||
SaveConfig();
|
||||
LoadConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveConfig();
|
||||
LoadConfig();
|
||||
}
|
||||
WriteLogToForm("保存成功");
|
||||
|
@ -340,6 +365,5 @@ namespace Ultron.Ngrok
|
|||
{
|
||||
ReLoadConfig();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,4 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -28,15 +28,21 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this.cmdLogTextArea = new System.Windows.Forms.TextBox();
|
||||
this.startBtn = new System.Windows.Forms.Button();
|
||||
this.endBtn = new System.Windows.Forms.Button();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.topMenuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.notifyMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.topMenuStrip.SuspendLayout();
|
||||
this.notifyMenuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cmdLogTextArea
|
||||
|
@ -71,17 +77,18 @@
|
|||
this.endBtn.UseVisualStyleBackColor = true;
|
||||
this.endBtn.Click += new System.EventHandler(this.endBtn_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
// topMenuStrip
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.topMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.设置ToolStripMenuItem,
|
||||
this.帮助ToolStripMenuItem,
|
||||
this.关于ToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(362, 25);
|
||||
this.menuStrip1.TabIndex = 4;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
this.topMenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.topMenuStrip.Name = "topMenuStrip";
|
||||
this.topMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.topMenuStrip.Size = new System.Drawing.Size(362, 25);
|
||||
this.topMenuStrip.TabIndex = 4;
|
||||
this.topMenuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// 设置ToolStripMenuItem
|
||||
//
|
||||
|
@ -104,6 +111,36 @@
|
|||
this.关于ToolStripMenuItem.Text = "关于";
|
||||
this.关于ToolStripMenuItem.Click += new System.EventHandler(this.关于ToolStripMenuItem_Click);
|
||||
//
|
||||
// notifyIcon
|
||||
//
|
||||
this.notifyIcon.ContextMenuStrip = this.notifyMenuStrip;
|
||||
this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
|
||||
this.notifyIcon.Text = Program.FormName;
|
||||
this.notifyIcon.Visible = true;
|
||||
this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_MouseDoubleClick);
|
||||
//
|
||||
// notifyMenuStrip
|
||||
//
|
||||
this.notifyMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.显示ToolStripMenuItem,
|
||||
this.退出ToolStripMenuItem});
|
||||
this.notifyMenuStrip.Name = "notifyMenuStrip";
|
||||
this.notifyMenuStrip.Size = new System.Drawing.Size(181, 70);
|
||||
//
|
||||
// 退出ToolStripMenuItem
|
||||
//
|
||||
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
|
||||
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.退出ToolStripMenuItem.Text = "退出";
|
||||
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
|
||||
//
|
||||
// 显示ToolStripMenuItem
|
||||
//
|
||||
this.显示ToolStripMenuItem.Name = "显示ToolStripMenuItem";
|
||||
this.显示ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.显示ToolStripMenuItem.Text = "显示";
|
||||
this.显示ToolStripMenuItem.Click += new System.EventHandler(this.显示ToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
@ -112,17 +149,19 @@
|
|||
this.Controls.Add(this.endBtn);
|
||||
this.Controls.Add(this.startBtn);
|
||||
this.Controls.Add(this.cmdLogTextArea);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Controls.Add(this.topMenuStrip);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MainMenuStrip = this.topMenuStrip;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FormMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "uNgrok";
|
||||
this.Text = Program.FormName;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.topMenuStrip.ResumeLayout(false);
|
||||
this.topMenuStrip.PerformLayout();
|
||||
this.notifyMenuStrip.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -133,10 +172,14 @@
|
|||
public System.Windows.Forms.TextBox cmdLogTextArea;
|
||||
private System.Windows.Forms.Button startBtn;
|
||||
private System.Windows.Forms.Button endBtn;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.MenuStrip topMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 设置ToolStripMenuItem;
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon;
|
||||
private System.Windows.Forms.ContextMenuStrip notifyMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 显示ToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,17 @@ using System.Diagnostics;
|
|||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Threading;
|
||||
using Ultron.Ngrok.Utils;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using Ultron.Ngrok.Utils;
|
||||
using Ultron.Ngrok.Properties;
|
||||
|
||||
namespace Ultron.Ngrok
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public delegate void CmdInitAlready();
|
||||
|
||||
#region 属性
|
||||
|
||||
/// <summary>
|
||||
|
@ -82,22 +84,35 @@ namespace Ultron.Ngrok
|
|||
//进程检测
|
||||
CheckProcessAndKill(setting.ExeFile);
|
||||
|
||||
CmdInitAlready callback = new CmdInitAlready(CmdCallBack);
|
||||
//初始化CMD
|
||||
new Thread(new ThreadStart(InitCmd)).Start();
|
||||
Thread cmdThread = new Thread(InitCmd);
|
||||
cmdThread.IsBackground = true;
|
||||
cmdThread.Start(callback);
|
||||
|
||||
//检查更新
|
||||
new Thread(new ThreadStart(CheckUpdateAsync)).Start();
|
||||
Thread updateThread = new Thread(new ThreadStart(CheckUpdateAsync));
|
||||
updateThread.IsBackground = true;
|
||||
updateThread.Start();
|
||||
}
|
||||
|
||||
public void CmdCallBack()
|
||||
{
|
||||
if(setting.ServerConfig.AutoStart)
|
||||
{
|
||||
startBtn_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 事件
|
||||
|
||||
private void startBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
//网络检测
|
||||
NetworkUtils.CheckServeStatus(this);
|
||||
cmd.SendMsg(setting.ExecuteCommand);
|
||||
cmd.SendMsg(setting.ExecuteCommand,setting.ServerConfig.HideWindow);
|
||||
|
||||
startBtn.Enabled = false;
|
||||
endBtn.Enabled = true;
|
||||
|
@ -119,7 +134,7 @@ namespace Ultron.Ngrok
|
|||
|
||||
private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("explorer.exe", "http://git.iwangyu.cn/wixy/Ultron.Ngrok/wiki");
|
||||
Process.Start("explorer.exe", "https://git.wixy.cn/wixy/Ultron.Ngrok/wiki/帮助");
|
||||
}
|
||||
|
||||
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -128,6 +143,51 @@ namespace Ultron.Ngrok
|
|||
about.ShowDialog();
|
||||
}
|
||||
|
||||
private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (this.WindowState == FormWindowState.Minimized)
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
if (this.Visible == false)
|
||||
this.Show();
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (setting.ServerConfig.UseNotifyMenu)
|
||||
{
|
||||
notifyIcon.Visible = true;
|
||||
this.Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
||||
{
|
||||
// 关闭所有的线程
|
||||
this.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
||||
{
|
||||
this.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void 显示ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
WindowState = FormWindowState.Normal;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 方法
|
||||
|
@ -170,12 +230,14 @@ namespace Ultron.Ngrok
|
|||
setting.WriteLogToForm += WriteLog;
|
||||
}
|
||||
|
||||
public void InitCmd()
|
||||
public void InitCmd(object obj)
|
||||
{
|
||||
//创建CMD
|
||||
cmd = new CmdUtils();
|
||||
cmd.ProcessMessageEvent += DealMessage;
|
||||
cmd.ProcessKilled += cmd_Exited;
|
||||
CmdInitAlready callback = obj as CmdInitAlready;
|
||||
callback();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -239,6 +301,16 @@ namespace Ultron.Ngrok
|
|||
|
||||
public void HttpGet(string url)
|
||||
{
|
||||
string updateExe = Directory.GetCurrentDirectory() + @"\autoUpdate.exe";
|
||||
if (File.Exists(updateExe))
|
||||
{
|
||||
File.Delete(updateExe);
|
||||
}
|
||||
|
||||
FileStream stream = new FileStream(updateExe, FileMode.OpenOrCreate);
|
||||
stream.Write(Resources.autoUpdate, 0, Resources.autoUpdate.Length);
|
||||
stream.Close();
|
||||
|
||||
WebClient wc = new WebClient();
|
||||
Uri uri = new Uri(url, UriKind.RelativeOrAbsolute);
|
||||
wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
|
||||
|
@ -247,42 +319,44 @@ namespace Ultron.Ngrok
|
|||
|
||||
public void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
|
||||
{
|
||||
StreamReader read = new StreamReader(e.Result);
|
||||
string str = read.ReadToEnd();
|
||||
if (str.Contains("\"code\":1"))
|
||||
return;
|
||||
else
|
||||
try
|
||||
{
|
||||
if (MessageBox.Show("检测到新版本,立即更新?", "版本更新", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
StreamReader read = new StreamReader(e.Result);
|
||||
string str = read.ReadToEnd();
|
||||
if (str.Contains("\"code\":1"))
|
||||
return;
|
||||
else
|
||||
{
|
||||
int verStart = str.IndexOf("\"version\":\"") + 11;
|
||||
int verEnd = str.IndexOf("\",\"title\"");
|
||||
string version = str.Substring(verStart, verEnd - verStart);
|
||||
string updateExe = Directory.GetCurrentDirectory() + @"\autoUpdate.exe";
|
||||
if (File.Exists(updateExe))
|
||||
if (MessageBox.Show("检测到新版本,立即更新?", "版本更新", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
File.Delete(updateExe);
|
||||
int verStart = str.IndexOf("\"version\":\"") + 11;
|
||||
int verEnd = str.IndexOf("\",\"title\"");
|
||||
string version = str.Substring(verStart, verEnd - verStart);
|
||||
|
||||
RunUpdateProgram(version);
|
||||
}
|
||||
|
||||
FileStream stream = new FileStream(updateExe, FileMode.OpenOrCreate);
|
||||
stream.Write(Resources.autoUpdate, 0, Resources.autoUpdate.Length);
|
||||
stream.Close();
|
||||
|
||||
RunUpdateProgram(version);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
string msg = ex.InnerException == null ? ex.Message : ex.InnerException.Message;
|
||||
MessageBox.Show($"无法检测更新:{msg}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RunUpdateProgram(string verion)
|
||||
{
|
||||
Application.Exit();
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "autoUpdate.exe";
|
||||
startInfo.Arguments = "https://cloud-disk-1251608065.cos.ap-guangzhou.myqcloud.com/uNgrok_" + verion + ".exe" + " uNgrok.exe";
|
||||
startInfo.Arguments = "\"https://cloud-disk-1251608065.cos.ap-guangzhou.myqcloud.com/uNgrok_" + verion + ".exe" + " uNgrok.exe\"";
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Normal;
|
||||
startInfo.UseShellExecute = false;
|
||||
Process.Start(startInfo);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,10 +117,182 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="topMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>151, 17</value>
|
||||
</metadata>
|
||||
<metadata name="notifyMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>262, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="notifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAMDAAAAEAIACoJQAAFgAAACgAAAAwAAAAYAAAAAEAIAAAAAAAACQAAMMOAADDDgAAAAAAAAAA
|
||||
AAA/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/
|
||||
P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/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8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAA=
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAMMOAADDDgAAAAAAAAAA
|
||||
|
|
|
@ -24,6 +24,15 @@ namespace Ultron.Ngrok.Model
|
|||
[YamlMember(Alias = "version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[YamlMember(Alias = "auto_start")]
|
||||
public bool AutoStart { get; set; }
|
||||
|
||||
[YamlMember(Alias = "hide_window")]
|
||||
public bool HideWindow { get; set; }
|
||||
|
||||
[YamlMember(Alias = "use_notify_menu")]
|
||||
public bool UseNotifyMenu { get; set; }
|
||||
|
||||
[YamlMember(Alias = "auth_token")]
|
||||
public string AuthToken { get; set; }
|
||||
|
||||
|
|
|
@ -1,13 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Ultron.Ngrok
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
#region WindowsAPI
|
||||
|
||||
/// <summary>
|
||||
/// 显示窗口
|
||||
/// </summary>
|
||||
/// <param name="hWnd"></param>
|
||||
/// <param name="cmdShow"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("User32.dll")]
|
||||
private static extern bool ShowWindowAsync(System.IntPtr hWnd, int cmdShow);
|
||||
|
||||
/// <summary>
|
||||
/// 根据窗体句柄获得窗体标题
|
||||
/// </summary>
|
||||
/// <param name="hWnd"></param>
|
||||
/// <param name="lpText"></param>
|
||||
/// <param name="nCount"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpText, int nCount);
|
||||
|
||||
/// <summary>
|
||||
/// 根据窗体句柄获得其进程ID
|
||||
/// </summary>
|
||||
/// <param name="hwnd"></param>
|
||||
/// <param name="ID"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID);
|
||||
|
||||
/// <summary>
|
||||
/// 枚举窗体
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("user32")]
|
||||
private static extern int EnumWindows(CallBack x, int y);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 属性字段委托
|
||||
|
||||
/// <summary>
|
||||
/// 窗体标题
|
||||
/// </summary>
|
||||
public static string FormName = "uNgrok";
|
||||
|
||||
/// <summary>
|
||||
/// 显示窗口参数
|
||||
/// </summary>
|
||||
private const int SW_RESTORE = 9;
|
||||
|
||||
/// <summary>
|
||||
/// 已存在的进程实例
|
||||
/// </summary>
|
||||
private static Process instance = null;
|
||||
|
||||
private delegate bool CallBack(IntPtr hwnd, int lParam);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
|
@ -16,7 +79,85 @@ namespace Ultron.Ngrok
|
|||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
|
||||
//获取运行的进程
|
||||
instance = RunningInstance();
|
||||
if (instance == null)
|
||||
{
|
||||
//没有进程在运行
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
else
|
||||
{
|
||||
//是否托盘化, 托盘状态窗口句柄为0
|
||||
if (instance.MainWindowHandle.ToInt32() != 0)
|
||||
{
|
||||
//调用api函数,正常显示窗口
|
||||
ShowWindowAsync(instance.MainWindowHandle, SW_RESTORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CallBack callback = new CallBack(Report);
|
||||
EnumWindows(callback, 0);
|
||||
}
|
||||
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
}
|
||||
}
|
||||
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取运行中的进程
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static Process RunningInstance()
|
||||
{
|
||||
Process current = Process.GetCurrentProcess();
|
||||
Process[] processes = Process.GetProcessesByName(current.ProcessName);
|
||||
//遍历与当前进程名称相同的进程列表
|
||||
foreach (Process process in processes)
|
||||
{
|
||||
//如果实例已经存在则忽略当前进程
|
||||
if (process.Id != current.Id)
|
||||
{
|
||||
//保证要打开的进程同已经存在的进程来自同一文件路径
|
||||
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName)
|
||||
{
|
||||
//返回已经存在的进程
|
||||
return process;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 枚举窗口回调
|
||||
/// </summary>
|
||||
/// <param name="hwnd"></param>
|
||||
/// <param name="lParam"></param>
|
||||
/// <returns></returns>
|
||||
private static bool Report(IntPtr hwnd, int lParam)
|
||||
{
|
||||
//获得窗体标题
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
GetWindowText(hwnd, sb, sb.Capacity);
|
||||
|
||||
//获取进程ID
|
||||
GetWindowThreadProcessId(hwnd, out int calcID);
|
||||
|
||||
//标题栏、进程id符合
|
||||
if ((sb.ToString() == FormName) && (instance != null) && (calcID == instance.Id))
|
||||
{
|
||||
//调用api函数,正常显示窗口
|
||||
ShowWindowAsync(hwnd, SW_RESTORE);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.2.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.1.0")]
|
||||
|
|
Binary file not shown.
|
@ -150,7 +150,7 @@
|
|||
<None Include="Resources\YamlDotNet.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\autoUpdate.exe" />
|
||||
<Content Include="Resources\autoUpdate.exe" />
|
||||
<Content Include="Resources\icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -22,10 +22,9 @@ namespace Ultron.Ngrok.Utils
|
|||
public CmdUtils()
|
||||
{
|
||||
Control.CheckForIllegalCrossThreadCalls = false;
|
||||
|
||||
}
|
||||
|
||||
public void Init()
|
||||
public void Init(bool hideWindow = false)
|
||||
{
|
||||
cmd = new Process();//创建进程对象
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
|
@ -34,7 +33,7 @@ namespace Ultron.Ngrok.Utils
|
|||
startInfo.UseShellExecute = false;//不使用系统外壳程序启动
|
||||
startInfo.RedirectStandardInput = true;//不重定向输入
|
||||
startInfo.RedirectStandardOutput = true; //重定向输出
|
||||
startInfo.CreateNoWindow = false;//不创建窗口
|
||||
startInfo.CreateNoWindow = hideWindow;//不创建窗口
|
||||
|
||||
cmd.StartInfo = startInfo;
|
||||
|
||||
|
@ -61,7 +60,7 @@ namespace Ultron.Ngrok.Utils
|
|||
}
|
||||
}
|
||||
|
||||
public void SendMsg(string cmdStr)
|
||||
public void SendMsg(string cmdStr,bool hideWindow = false)
|
||||
{
|
||||
ProcessMessageEvent(0, "开始运行...");
|
||||
if (!IsInited || cmd.HasExited)
|
||||
|
@ -73,7 +72,7 @@ namespace Ultron.Ngrok.Utils
|
|||
startInfo.UseShellExecute = false;//不使用系统外壳程序启动
|
||||
startInfo.RedirectStandardInput = true;//不重定向输入
|
||||
startInfo.RedirectStandardOutput = true; //重定向输出
|
||||
startInfo.CreateNoWindow = false;//不创建窗口
|
||||
startInfo.CreateNoWindow = hideWindow;//不创建窗口
|
||||
|
||||
cmd.StartInfo = startInfo;
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartArguments>"https://cloud-disk-1251608065.cos.ap-guangzhou.myqcloud.com/uNgrok_1.2.0.0.exe uNgrok.exe"</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -2,6 +2,7 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Ultron.Update
|
||||
|
@ -39,12 +40,22 @@ namespace Ultron.Update
|
|||
|
||||
public UpdateForm(string[] args)
|
||||
{
|
||||
string[] startParams = args[0].Split(' ');
|
||||
|
||||
if(startParams.Length < 2)
|
||||
{
|
||||
MessageBox.Show("启动参数出错");
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
ExecuteFile = args[1];
|
||||
ExecuteFile = startParams[1];
|
||||
|
||||
string updateFile = Directory.GetCurrentDirectory() + @"\"+ ExecuteFile;
|
||||
|
||||
Thread.Sleep(800);
|
||||
|
||||
if (File.Exists(updateFile))
|
||||
File.Delete(updateFile);
|
||||
if (File.Exists(Directory.GetCurrentDirectory() + @"\ngrok_x64.exe"))
|
||||
|
@ -52,7 +63,7 @@ namespace Ultron.Update
|
|||
if (File.Exists(Directory.GetCurrentDirectory() + @"\ngrok_x86.exe"))
|
||||
File.Delete(Directory.GetCurrentDirectory() + @"\ngrok_x86.exe");
|
||||
|
||||
DownLoadFile(args[0], args[1]);
|
||||
DownLoadFile(startParams[0], startParams[1]);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue