release v3.9.0.0

This commit is contained in:
wisdomwei201804 2020-12-10 00:03:16 +08:00
parent 5f59a91852
commit 10033e6d5d
20 changed files with 1794 additions and 1802 deletions

View File

@ -112,7 +112,8 @@ namespace net.nutcore.aliddns
new XElement("add", new XAttribute("key", "logautosave"), new XAttribute("value", "Off")),
new XElement("add", new XAttribute("key", "TTL"), new XAttribute("value", "600")),
new XElement("add", new XAttribute("key", "autoCheckUpdate"), new XAttribute("value", "Off")),
new XElement("add", new XAttribute("key", "ngrokauto"), new XAttribute("value", "Off"))
new XElement("add", new XAttribute("key", "ngrokauto"), new XAttribute("value", "Off")),
new XElement("add", new XAttribute("key", "ngrokexists"), new XAttribute("value", "Off"))
)
)
);

View File

@ -1,236 +0,0 @@
namespace net.nutcore.aliddns
{
partial class Form_About
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_About));
this.authorInformation = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.PublishLink = new System.Windows.Forms.LinkLabel();
this.personalWebsite = new System.Windows.Forms.LinkLabel();
this.textBox_updateInfo = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.checkBox_autoCheckUpdate = new System.Windows.Forms.CheckBox();
this.label_latestVer = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label_currentVer = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.authorInformation.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// authorInformation
//
this.authorInformation.Controls.Add(this.label3);
this.authorInformation.Controls.Add(this.linkLabel1);
this.authorInformation.Controls.Add(this.label2);
this.authorInformation.Controls.Add(this.label1);
this.authorInformation.Controls.Add(this.PublishLink);
this.authorInformation.Controls.Add(this.personalWebsite);
this.authorInformation.Location = new System.Drawing.Point(12, 71);
this.authorInformation.Name = "authorInformation";
this.authorInformation.Size = new System.Drawing.Size(242, 81);
this.authorInformation.TabIndex = 8;
this.authorInformation.TabStop = false;
this.authorInformation.Text = "著作信息";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 62);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(95, 12);
this.label3.TabIndex = 6;
this.label3.Text = "本程序发布地址:";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(107, 39);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(77, 12);
this.linkLabel1.TabIndex = 5;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "阿里开发论坛";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(95, 12);
this.label2.TabIndex = 4;
this.label2.Text = "原程序发布地址:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 12);
this.label1.TabIndex = 3;
this.label1.Text = "原作者主页:";
//
// PublishLink
//
this.PublishLink.AutoSize = true;
this.PublishLink.Location = new System.Drawing.Point(107, 62);
this.PublishLink.Name = "PublishLink";
this.PublishLink.Size = new System.Drawing.Size(125, 12);
this.PublishLink.TabIndex = 2;
this.PublishLink.TabStop = true;
this.PublishLink.Text = "AliDDNS 3.0 之后版本";
this.PublishLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.PublishLink_LinkClicked);
//
// personalWebsite
//
this.personalWebsite.AutoSize = true;
this.personalWebsite.Location = new System.Drawing.Point(83, 17);
this.personalWebsite.Name = "personalWebsite";
this.personalWebsite.Size = new System.Drawing.Size(95, 12);
this.personalWebsite.TabIndex = 1;
this.personalWebsite.TabStop = true;
this.personalWebsite.Text = "www.nutcore.net";
this.personalWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.personalWebsite_LinkClicked);
//
// textBox_updateInfo
//
this.textBox_updateInfo.Location = new System.Drawing.Point(12, 158);
this.textBox_updateInfo.Multiline = true;
this.textBox_updateInfo.Name = "textBox_updateInfo";
this.textBox_updateInfo.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox_updateInfo.Size = new System.Drawing.Size(242, 119);
this.textBox_updateInfo.TabIndex = 9;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.checkBox_autoCheckUpdate);
this.groupBox1.Controls.Add(this.label_latestVer);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label_currentVer);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(12, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(242, 62);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "升级设置";
//
// checkBox_autoCheckUpdate
//
this.checkBox_autoCheckUpdate.AutoSize = true;
this.checkBox_autoCheckUpdate.Checked = true;
this.checkBox_autoCheckUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_autoCheckUpdate.Location = new System.Drawing.Point(8, 40);
this.checkBox_autoCheckUpdate.Name = "checkBox_autoCheckUpdate";
this.checkBox_autoCheckUpdate.Size = new System.Drawing.Size(96, 16);
this.checkBox_autoCheckUpdate.TabIndex = 4;
this.checkBox_autoCheckUpdate.Text = "自动检测升级";
this.checkBox_autoCheckUpdate.UseVisualStyleBackColor = true;
this.checkBox_autoCheckUpdate.CheckedChanged += new System.EventHandler(this.checkBox_autoCheckUpdate_CheckedChanged);
//
// label_latestVer
//
this.label_latestVer.AutoSize = true;
this.label_latestVer.Location = new System.Drawing.Point(185, 19);
this.label_latestVer.Name = "label_latestVer";
this.label_latestVer.Size = new System.Drawing.Size(47, 12);
this.label_latestVer.TabIndex = 3;
this.label_latestVer.Text = "0.0.0.0";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(125, 19);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(59, 12);
this.label6.TabIndex = 2;
this.label6.Text = "远程版本:";
//
// label_currentVer
//
this.label_currentVer.AutoSize = true;
this.label_currentVer.Location = new System.Drawing.Point(71, 19);
this.label_currentVer.Name = "label_currentVer";
this.label_currentVer.Size = new System.Drawing.Size(47, 12);
this.label_currentVer.TabIndex = 1;
this.label_currentVer.Text = "0.0.0.0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 19);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 0;
this.label4.Text = "本地版本:";
//
// Form_About
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(267, 289);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.textBox_updateInfo);
this.Controls.Add(this.authorInformation);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form_About";
this.Text = "关于";
this.Load += new System.EventHandler(this.Form_About_Load);
this.authorInformation.ResumeLayout(false);
this.authorInformation.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox authorInformation;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.LinkLabel PublishLink;
private System.Windows.Forms.LinkLabel personalWebsite;
private System.Windows.Forms.TextBox textBox_updateInfo;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkBox_autoCheckUpdate;
private System.Windows.Forms.Label label_latestVer;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label_currentVer;
private System.Windows.Forms.Label label4;
}
}

View File

@ -1,74 +0,0 @@
using System;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Xml;
namespace net.nutcore.aliddns
{
public partial class Form_About : Form
{
private AppConfigHelper cfg = new AppConfigHelper();
public Form_About()
{
InitializeComponent();
this.MinimizeBox = false; //取消窗口最小化按钮
this.MaximizeBox = false; //取消窗口最大化按钮
}
private void PublishLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/wisdomwei201804/AliDDNS/");
}
private void personalWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "http://www.nutcore.net/");
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://bbs.aliyun.com/read/289624.html");
}
private void checkBox_autoCheckUpdate_CheckedChanged(object sender, EventArgs e)
{
if(checkBox_autoCheckUpdate.Checked == true)
{
cfg.SaveAppSetting("autoCheckUpdate", "On");
//mainForm.textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件自动检测升级启用!" + "\r\n");
}
else
{
cfg.SaveAppSetting("autoCheckUpdate", "Off");
//mainForm.textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件自动检测升级关闭!" + "\r\n");
}
}
private void Form_About_Load(object sender, EventArgs e)
{
//读取updateinfo.txt文件
textBox_updateInfo.ReadOnly = true;
string filePath = System.AppDomain.CurrentDomain.BaseDirectory;
string updateInfoFile = filePath + "updateinfo.txt";
if (File.Exists(updateInfoFile))
textBox_updateInfo.Text = File.ReadAllText(updateInfoFile, Encoding.Default);
else
textBox_updateInfo.Text = "软件运行目录下没有找到updateinfo.txt文件";
//版本检查
label_currentVer.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //获取当前版本
if (mainForm.checkUpdate == true)
{
checkBox_autoCheckUpdate.Checked = true;
//获取远程版本信息
string strVer = mainForm.verCheckUpdate();
label_latestVer.Text = strVer.ToString();
}
else checkBox_autoCheckUpdate.Checked = false;
}
}
}

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA
AAAAAAAARU36AEVN+gBFTfoHRU36IUVN+kBFTfpgRU36hEVN+rJFTfrWRU365kVN+u9FTfr2RU36/EVN
+v9FTfr/RU36/0VN+v9FTfr+RU36+UVN+vJFTfrpRU363EVN+r1FTfqPRU36aEVN+kdFTfomRU36CEVN
+gBFTfoAAAAAAEVN+gBFTfoBRU36L0VN+plFTfrbRU368EVN+vpFTfr+RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr7RU3680VN
+t9FTfqgRU36MkVN+gFFTfoARU36AEVN+jBFTfrWRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfraRU36MEVN+gBFTfoFRU36okVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfqaRU36BkVN+h5FTfrXRU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/REz6/0RM+v9ETPr/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+ttFTfoiRU36PUVN+u1FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/Qkr4/0ZO9f9PVvL/VFvw/1Vb7/9QV/D/R0/y/0JK
9f9DS/n/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU368EVN+kJFTfpxRU36+kVN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/Q0v4/1FY9P9zefD/p6v0/8nL+f/S1Pr/09X6/8zO
+f+xtPT/fIHs/1Vb7P9DS/T/REz6/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr6RU36YUVN
+qZFTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/REz6/0ZO9/9yePP/w8X5/+Xm/v/r7P//6+z//+Xm
///k5f//6er//+zt///n6P7/ztD5/4CF7P9IUO//REz5/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfqERU36wEVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0RM+v9IUPj/j5T2/+Hi/f/u7///6+z//+3u
//+8v/v/cHb7/2ty+/+anv3/5+j//+zt///u7///5+n+/6Km8f9NVO7/REz5/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+rNFTfrSRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/Rk75/46T9//o6f7/7vD//8TH
/f/P0v3/7O3+/3l/9/8+R/n/QEj5/1de+v/Y2v7/5OX9/8LF+f/p6///7u/+/6Sn8f9JUPD/REz6/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU3610VN+uBFTfr/RU36/0VN+v9FTfr/RU36/0NM+v9udfj/4eP9//Hy
//+ytfv/YGb3/9DS/f/l5/3/cXfw/1lf7/9bYe//XWPv/8jL+v/r7P7/c3nv/5me+P/s7f//7O3+/4OI
7v9DS/X/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrmRU366UVN+v9FTfr/RU36/0VN+v9FTfr/TFT5/8DD
/P/29///2Nr7/32C7/+VmfH/6uv+//Hx/v/h4vv/4uP7/+Lj+//f4Pv/6+z9//P0//+vsvL/dXrr/8XH
9//29v//1tj5/1de8P9ETPr/RU36/0VN+v9FTfr/RU36/0VN+vBFTfrwRU36/0VN+v9FTfr/RU36/0NL
+v9rcfr/6er+//f3///t7v3/7u/9//f3///29///8PH+/+jp///k5v//5Ob//+fo///t7v//9fb///f3
///x8f3/6uv8//X2///z9P7/gobv/0JK9/9FTfr/RU36/0VN+v9FTfr/RU3690VN+vVFTfr/RU36/0VN
+v9FTfr/REz6/6Gl+//5+f//9/j//+nq///P0f7/4OH+//r7//+usvf/Ymn5/15l+/9eZfv/YGf7/4iN
/P/y8v//7e79/87Q/P/k5f//9fb///v7//+8v/b/SVD1/0VN+v9FTfr/RU36/0VN+v9FTfr9RU36+EVN
+v9FTfr/RU36/0VN+v9IUPr/wsX9//////+/wvn/ZWz6/05W+v+2uv3//v///42S8/9ASPj/Q0z6/0NM
+v9BSfr/ZWz7/+/w///e3/v/W2L2/1xj+/+nqv3/+vv//9vd+v9TWvX/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr6RU36/0VN+v9FTfr/RU36/0tT+v/O0P7//////4uQ8/9ASPj/Rk76/7y//f//////iIzy/z5G
9v9BSfb/QUn2/z9H9v9haPn/7u/+/+Pk/P9XXvb/QEj6/3B2+//29///5uf8/1lg9v9ETPr/RU36/0VN
+v9FTfr/RU36/0VN+vpFTfr/RU36/0VN+v9FTfr/S1P6/87Q/v//////j5Tx/0BI9/9DS/f/vL/7////
//+lqPH/dnvs/4GG7f+Ch+z/en7s/4iM7//z9P7/4+T7/1Ra8v8/R/j/dHr7//n5///m5/z/WWD3/0RM
+v9FTfr/RU36/0VN+v9FTfr/RU3690VN+v9FTfr/RU36/0VN+v9IT/r/wcT9//////+3uvT/W2Lv/4OI
8P/e4Pr///////v7/v/9/f7////+/////v/+/v7/+/v+///////y8v3/lZnu/11j6/+coPf//////9zd
/P9SWvj/REz6/0VN+v9FTfr/RU36/0VN+v9FTfr0RU36/0VN+v9FTfr/RU36/0NL+v+anvz///////T1
/f/n6Pv//f3+//39////////8PD9/87Q/f/FyP7/xMf9/8rM/v/i4/7//v7///7+///+/v//7Oz7/+7u
/P//////t7r5/0hP+f9FTfr/RU36/0VN+v9FTfr/RU36/kVN+u5FTfr/RU36/0VN+v9FTfr/Q0v6/2Rr
+//s7f7///////Pz/f+1uPv/o6f9//v8///P0fj/UFf2/0hQ+v9IUPr/SFD6/5uf+///////xcf5/6qt
+//o6f7///////n6/v99gvj/Qkr6/0VN+v9FTfr/RU36/0VN+v9FTfr5RU365kVN+v9FTfr/RU36/0VN
+v9FTfr/SVH6/7q9/f//////6On7/2Jo7P9dZPf/7+///+Lj+v9VXPT/REz6/0VN+v9GTvr/ur38////
//+Fivb/Uln1/9PV+///////1Nb8/1Rb+f9ETPr/RU36/0VN+v9FTfr/RU36/0VN+vJFTfrcRU36/0VN
+v9FTfr/RU36/0VN+v9DTPr/ZGv7/+Pk/v//////0dL2/21z7P/W1/v/9PX9/2hu8f9DS/n/REz6/09X
+v/W2P3/9PT9/32C8/+6vfj//v7///Pz/v96gPr/Q0v6/0VN+v9FTfr/RU36/0VN+v9FTfr/RU366UVN
+s1FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/gYb8/+7v////////4+T5/+Lj+v//////io/v/z5G
8/8/R/X/Y2r3/+7v/v/z9P3/4OH6//39///4+P//mp77/0dP+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfrbRU36ukVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/gYb8/+Tl/v//////////////
///Y2vj/j5Ps/4qO7f+8vvT//f3/////////////7+/+/5eb/P9JUfr/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+rxFTfqbRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/ZGv7/7q9
/f/t7v///f3////////////////////////+/v//8vL//8nL/f9zefv/Rk76/0RM+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36jkVN+mRFTfr4RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9DTPr/SVH6/2Rr+/+anvz/wsT9/8/R/v/Q0v7/xcj9/6Wp/f9tc/v/TVT6/0NL+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+vtFTfpmRU36N0VN+upFTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/Q0v6/0NL+v9IT/r/S1P6/0tT+v9IUPr/REz6/0NL+v9ETPr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU368kVN+kVFTfoaRU360kVN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrdRU36JUVN+gRFTfqaRU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+p9FTfoHRU36AEVN
+ixFTfrSRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrWRU36MEVN
+gBFTfoARU36AEVN+i5FTfqfRU3610VN+u5FTfr6RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr+RU36+EVN+utFTfrURU36nUVN
+i5FTfoARU36AAAAAABFTfoARU36AEVN+gZFTfodRU36PUVN+m9FTfqkRU36wEVN+tJFTfrfRU366EVN
+vBFTfr1RU36+EVN+vpFTfr6RU36+EVN+vRFTfrtRU365UVN+txFTfrORU36u0VN+pxFTfplRU36OEVN
+htFTfoFRU36AEVN+gAAAAAA4AAAB4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAAABgAAAAeAAAAc=
</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
@ -13,16 +14,17 @@ using static Aliyun.Acs.Alidns.Model.V20150109.DescribeSubDomainRecordsResponse;
namespace net.nutcore.aliddns
{
public partial class mainForm : Form
public partial class Form_main : Form
{
public static bool checkUpdate;
static IClientProfile clientProfile;
static DefaultAcsClient client;
//初始化ngrok操作类
private NgrokHelper ngrok = new NgrokHelper();
//初始化appconfig操作类
private AppConfigHelper cfg = new AppConfigHelper();
public mainForm()
public Form_main()
{
InitializeComponent();
this.MinimizeBox = false; //取消窗口最小化按钮
@ -34,7 +36,7 @@ namespace net.nutcore.aliddns
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mainForm_Load(object sender, EventArgs e)
private void Form_main_Load(object sender, EventArgs e)
{
//获取当前用户名和计算机名并写入日志
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "计算机名: " + System.Environment.UserDomainName + "\r\n");
@ -75,7 +77,7 @@ namespace net.nutcore.aliddns
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "当前用户需要文件写入和注册表操作权限,否则相关参数不起作用!" + "\r\n");
//读取设置文件aliddns_config.xml
if (readConfigFile())
if (appConfig_Load())
{
string ExePath = System.AppDomain.CurrentDomain.BaseDirectory;
string updateExe = ExePath + "update.exe";
@ -114,21 +116,50 @@ namespace net.nutcore.aliddns
updatePrepare();
}
}
notifyIcon_sysTray_Update(); //监测网络状态、刷新系统托盘图标
//读取updateinfo.txt文件
textBox_updateInfo.ReadOnly = true;
string filePath = System.AppDomain.CurrentDomain.BaseDirectory;
string updateInfoFile = filePath + "updateinfo.txt";
if (File.Exists(updateInfoFile))
{
textBox_updateInfo.Text = File.ReadAllText(updateInfoFile, Encoding.Default);
}
else
{
textBox_updateInfo.Text = "软件运行目录下没有找到updateinfo.txt文件";
}
//版本检查
label_currentVer.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //获取当前版本
if (Form_main.checkUpdate == true)
{
checkBox_autoCheckUpdate.Checked = true;
//获取远程版本信息
string strVer = Form_main.verCheckUpdate();
label_latestVer.Text = strVer.ToString();
}
else
{
checkBox_autoCheckUpdate.Checked = false;
}
//读取ngrok配置文件
ngrokConfig_Load();
//监测网络状态、刷新系统托盘图标
notifyIcon_sysTray_Update();
}
/// <summary>
/// 读取配置文件并初始化控件
/// </summary>
/// <returns></returns>
private bool readConfigFile()
private bool appConfig_Load()
{
try
{
textBox_accessKeyId.Text = EncryptHelper.AESDecrypt(cfg.GetAppSetting("AccessKeyID").ToString());
textBox_accessKeySecret.Text = EncryptHelper.AESDecrypt(cfg.GetAppSetting("AccessKeySecret").ToString());
textBox_recordId.Text = cfg.GetAppSetting("RecordID").ToString();
fullDomainName.Text = cfg.GetAppSetting("fullDomainName").ToString();
textBox_fullDomainName.Text = cfg.GetAppSetting("fullDomainName").ToString();
label_nextUpdateSeconds.Text = textBox_newSeconds.Text = cfg.GetAppSetting("WaitingTime").ToString();
if (cfg.GetAppSetting("autoUpdate").ToString() == "On") checkBox_autoUpdate.Checked = true;
else checkBox_autoUpdate.Checked = false;
@ -156,16 +187,12 @@ namespace net.nutcore.aliddns
if (cfg.GetAppSetting("autoCheckUpdate").ToString() == "On") checkUpdate = true;
else checkUpdate = false;
if (cfg.GetAppSetting("ngrokauto").ToString() == "On")
{
checkBox_ngrok.Checked = true;
button_ngrok.Enabled = false;
}
else
{
checkBox_ngrok.Checked = false;
button_ngrok.Enabled = true;
}
if (cfg.GetAppSetting("ngrokauto").ToString() == "On") checkBox_ngrokAuto.Checked = true;
else checkBox_ngrokAuto.Checked = false;
if (cfg.GetAppSetting("ngrokexists").ToString() == "On") checkBox_ngrokExists.Checked = true;
else checkBox_ngrokExists.Checked = false;
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "设置文件读取成功!" + "\r\n");
return true;
}
@ -236,7 +263,7 @@ namespace net.nutcore.aliddns
/// <returns></returns>
private bool getRecordId()
{
if(textBox_accessKeyId.Text.ToString()==null||textBox_accessKeySecret.Text.ToString()==null||fullDomainName.Text.ToString()==null||textBox_TTL.Text.ToString()==null||textBox_newSeconds.Text.ToString()==null)
if(textBox_accessKeyId.Text.ToString()==null||textBox_accessKeySecret.Text.ToString()==null||textBox_fullDomainName.Text.ToString()==null||textBox_TTL.Text.ToString()==null||textBox_newSeconds.Text.ToString()==null)
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "请检查设置,不能为空!" + "\r\n");
return false;
@ -244,7 +271,7 @@ namespace net.nutcore.aliddns
clientProfile = DefaultProfile.GetProfile("cn-hangzhou", textBox_accessKeyId.Text.ToString(), textBox_accessKeySecret.Text.ToString());
client = new DefaultAcsClient(clientProfile);
DescribeSubDomainRecordsRequest request = new DescribeSubDomainRecordsRequest();
request.SubDomain = fullDomainName.Text;
request.SubDomain = textBox_fullDomainName.Text;
try
{
DescribeSubDomainRecordsResponse response = client.GetAcsResponse(request);
@ -264,9 +291,9 @@ namespace net.nutcore.aliddns
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "阿里云DNS服务返回RecordId:" + i.ToString() + " RecordId" + record.RecordId + "\r\n");
textBox_recordId.Text = record.RecordId;
cfg.SaveAppSetting("RecordID", record.RecordId.ToString());
globalRR.Text = record.RR;
globalDomainType.Text = record.Type;
globalValue.Text = domainIP.Text = record.Value;
label_globalRR.Text = record.RR;
label_globalDomainType.Text = record.Type;
label_globalValue.Text = label_domainIP.Text = record.Value;
label_TTL.Text = Convert.ToString(record.TTL);
label_DomainIpStatus.Text = "已绑定";
label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(0, 0, 0, 255);
@ -309,19 +336,19 @@ namespace net.nutcore.aliddns
string fullDomain = response.RR.ToString() + "." + response.DomainName.ToString();
if (response.Value != "0.0.0.0")
{
if(fullDomain != fullDomainName.Text.ToString())
if(fullDomain != textBox_fullDomainName.Text.ToString())
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "阿里云DNS域名记录:"+ response.RecordId + " 对应域名为:" + fullDomain + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "配置文件域名记录:" + textBox_recordId.Text.ToString() + " 对应域名为:" + fullDomainName.Text.ToString() + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "配置文件域名记录:" + textBox_recordId.Text.ToString() + " 对应域名为:" + textBox_fullDomainName.Text.ToString() + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "配置文件设置错误!可能原因是修改域名记录后未及时添加,已经自动修改配置文件与服务器记录一致!" + "\r\n");
fullDomainName.Text = fullDomain;
textBox_fullDomainName.Text = fullDomain;
cfg.SaveAppSetting("fullDomainName", fullDomain);
}
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "域名:" + response.RR + "." + response.DomainName + " 已经绑定IP:" + response.Value + "\r\n");
textBox_recordId.Text = response.RecordId;
globalRR.Text = response.RR;
globalDomainType.Text = response.Type;
globalValue.Text = response.Value;
label_globalRR.Text = response.RR;
label_globalDomainType.Text = response.Type;
label_globalValue.Text = response.Value;
label_TTL.Text = Convert.ToString(response.TTL);
label_DomainIpStatus.Text = "已绑定";
label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(0, 0, 0, 255);
@ -354,7 +381,7 @@ namespace net.nutcore.aliddns
private void updateDomainRecord()
{
string[] symbols = new string[1] { "." };
string[] data = fullDomainName.Text.Split(symbols, 30, StringSplitOptions.RemoveEmptyEntries);
string[] data = textBox_fullDomainName.Text.Split(symbols, 30, StringSplitOptions.RemoveEmptyEntries);
string domainRR = data[0];
string domainName = data[1] + "." + data[2];
@ -365,16 +392,16 @@ namespace net.nutcore.aliddns
request.RR = domainRR;
request.RecordId = textBox_recordId.Text;
request.TTL = Convert.ToInt32(textBox_TTL.Text);
request.Value = localIP.Text;
request.Value = label_localIP.Text;
try
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "正在将WAN口IP:" + localIP.Text + "与域名" + fullDomainName.Text + "绑定..." + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "正在将WAN口IP:" + label_localIP.Text + "与域名" + textBox_fullDomainName.Text + "绑定..." + "\r\n");
UpdateDomainRecordResponse response = client.GetAcsResponse(request);
if (response.RecordId != null)
{
domainIP.Text = localIP.Text; //更新窗体数据
label_domainIP.Text = label_localIP.Text; //更新窗体数据
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "域名绑定IP更新成功" + "\r\n");
if (checkBox_ngrok.Checked == true)
if (checkBox_ngrokAuto.Checked == true)
{
//button_ngrok.Enabled = false;
//cfg.SaveAppSetting("ngrokauto", "On");
@ -416,7 +443,7 @@ namespace net.nutcore.aliddns
private bool addDomainRecord()
{
string[] symbols = new string[1] { "." };
string[] data = fullDomainName.Text.Split(symbols, 30, StringSplitOptions.RemoveEmptyEntries);
string[] data = textBox_fullDomainName.Text.Split(symbols, 30, StringSplitOptions.RemoveEmptyEntries);
string domainRR = data[0];
string domainName = data[1] + "." + data[2];
@ -427,32 +454,32 @@ namespace net.nutcore.aliddns
request.RR = domainRR;
request.DomainName = domainName;
request.TTL = Convert.ToInt32(textBox_TTL.Text);
request.Value = localIP.Text;
request.Value = label_localIP.Text;
try
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "正在向阿里云DNS服务添加域名:" + fullDomainName.Text + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "正在向阿里云DNS服务添加域名:" + textBox_fullDomainName.Text + "\r\n");
AddDomainRecordResponse response = client.GetAcsResponse(request);
if (response.RecordId != null)
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + " 域名:" + fullDomainName.Text + "添加成功!" + "服务器返回RecordId:" + response.RecordId + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + " 域名:" + textBox_fullDomainName.Text + "添加成功!" + "服务器返回RecordId:" + response.RecordId + "\r\n");
textBox_recordId.Text = response.RecordId.ToString();
cfg.SaveAppSetting("RecordID", response.RecordId.ToString());
globalDomainType.Text = request.Type;
globalRR.Text = request.RR;
globalValue.Text = domainIP.Text = request.Value;
label_globalDomainType.Text = request.Type;
label_globalRR.Text = request.RR;
label_globalValue.Text = label_domainIP.Text = request.Value;
label_DomainIpStatus.Text = "已绑定";
label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(0, 0, 0, 255);
return true;
}
else
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + " 域名:" + fullDomainName.Text + "添加失败!" + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + " 域名:" + textBox_fullDomainName.Text + "添加失败!" + "\r\n");
label_DomainIpStatus.Text = "未绑定";
domainIP.Text = "0.0.0.0";
label_domainIP.Text = "0.0.0.0";
textBox_recordId.Text = "null";
globalRR.Text = "null";
globalDomainType.Text = "null";
globalValue.Text = "null";
label_globalRR.Text = "null";
label_globalDomainType.Text = "null";
label_globalValue.Text = "null";
label_TTL.Text = "null";
label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(255, 255, 0, 0);
return false;
@ -485,24 +512,24 @@ namespace net.nutcore.aliddns
string[] arrayUrl = cfg.GetAppSetting("whatIsUrl").ToString().Split(',');
foreach (string strUrl in arrayUrl)
{
if ((localIP.Text = getWanIP(strUrl)) != "0.0.0.0")
if ((label_localIP.Text = getWanIP(strUrl)) != "0.0.0.0")
{
break;
}
}
if(localIP.Text.ToString() == "0.0.0.0")
if(label_localIP.Text.ToString() == "0.0.0.0")
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + localIP.Text + "域名绑定IP更新停止请检查查询网址设置或者手工指定IP" + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + label_localIP.Text + "域名绑定IP更新停止请检查查询网址设置或者手工指定IP" + "\r\n");
return;
}
domainIP.Text = getAliDnsRecordDomainIP();
if (domainIP.Text == localIP.Text)
label_domainIP.Text = getAliDnsRecordDomainIP();
if (label_domainIP.Text == label_localIP.Text)
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + localIP.Text + " 与域名绑定IP:" + domainIP.Text + "一致,无需更新!" + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + label_localIP.Text + " 与域名绑定IP:" + label_domainIP.Text + "一致,无需更新!" + "\r\n");
}
else
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + localIP.Text + " 与域名绑定IP:" + domainIP.Text + "不一致,需要更新!" + "\r\n");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "WAN口IP:" + label_localIP.Text + " 与域名绑定IP:" + label_domainIP.Text + "不一致,需要更新!" + "\r\n");
updateDomainRecord();
}
//localIP.Text = getWanIP();
@ -574,7 +601,7 @@ namespace net.nutcore.aliddns
}
}
private void mainForm_FormClosing(object sender, FormClosingEventArgs e)
private void Form_main_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true; //取消关闭窗体
this.WindowState = FormWindowState.Minimized; //窗体最小化
@ -584,7 +611,7 @@ namespace net.nutcore.aliddns
private void button_whatIsTest_Click(object sender, EventArgs e)
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "开始向网址发起查询... " + "\r\n");
localIP.Text = getWanIP(comboBox_whatIsUrl.Text.ToString().Trim());
label_localIP.Text = getWanIP(comboBox_whatIsUrl.Text.ToString().Trim());
notifyIcon_sysTray_Update(); //监测网络状态、刷新系统托盘图标
}
@ -634,12 +661,6 @@ namespace net.nutcore.aliddns
}
}
private void ToolStripMenuItem_About_Click(object sender, EventArgs e)
{
Form_About about = new Form_About();
about.Show(this);
}
private void checkBox_logAutoSave_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_logAutoSave.Checked == true)
@ -721,7 +742,7 @@ namespace net.nutcore.aliddns
string strIn = maskedTextBox_setIP.Text;
if (Regex.IsMatch(strIn, @"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$"))
{
localIP.Text = maskedTextBox_setIP.Text;
label_localIP.Text = maskedTextBox_setIP.Text;
updateDomainRecord();
//getDomainIP();
}
@ -754,7 +775,7 @@ namespace net.nutcore.aliddns
else
{
this.notifyIcon_sysTray.Icon = Properties.Resources.alidns_yellow;
if( localIP.Text == domainIP.Text )
if( label_localIP.Text == label_domainIP.Text )
this.notifyIcon_sysTray.Icon = Properties.Resources.alidns_green;
}
}
@ -816,12 +837,11 @@ namespace net.nutcore.aliddns
MessageBox.Show("获取新版本信息失败!");
}
private void checkBox_ngrok_CheckedChanged(object sender, EventArgs e)
private void checkBox_ngrokAuto_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_ngrok.Checked == true)
if (checkBox_ngrokAuto.Checked == true)
{
button_ngrok.Enabled = false;
cfg.SaveAppSetting("ngrokauto", "On");
//检测ngrok.exe是否存在
if (ngrok.IsExists())
@ -838,29 +858,50 @@ namespace net.nutcore.aliddns
{
cfg.SaveAppSetting("ngrokauto", "Off");
ngrok.Stop();
button_ngrok.Enabled = true;
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok功能关闭再次启动将不会加载" + "\r\n");
}
}
private void button_ngrok_Click(object sender, EventArgs e)
private void checkBox_ngrokExists_CheckedChanged(object sender, EventArgs e)
{
Form_ngrok ngrok = new Form_ngrok();
ngrok.Show(this);
if (checkBox_ngrokExists.Checked == true)
{
cfg.SaveAppSetting("ngrokexists", "On");
//检测ngrok.exe是否存在
if (ngrok.IsExists())
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "启动时检测ngrok.exe是否存在。" + "\r\n");
}
else
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件运行目录没有发现ngrok.exe请往官网下载自行编译https://ngrok.com/download" + "\r\n");
}
}
else
{
cfg.SaveAppSetting("ngrokexists", "Off");
ngrok.Stop();
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "启动时不再检测ngrok.exe是否存在。" + "\r\n");
}
}
private void mainForm_Shown(object sender, EventArgs e)
private void Form_main_Shown(object sender, EventArgs e)
{
//检测ngrok.exe是否存在
if (( checkBox_ngrok.Checked == true ) && ( !ngrok.IsExists() ))
//提醒ngrok.exe是否存在
if ( checkBox_ngrokExists.Checked == true )
{
MessageBox.Show("软件运行目录没有发现ngrok.exe请往官网下载自行编译。\nNgrok官网https://ngrok.com/download");
//检测ngrok.exe是否存在
if (!ngrok.IsExists())
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件运行目录没有发现ngrok.exe请往官网下载自行编译https://ngrok.com/download" + "\r\n");
MessageBox.Show("软件运行目录没有发现ngrok.exe请往官网下载自行编译。\nNgrok官网https://ngrok.com/download");
}
}
}
private void fullDomainName_Leave(object sender, EventArgs e)
{
cfg.SaveAppSetting("fullDomainName", this.fullDomainName.Text.ToString());
cfg.SaveAppSetting("fullDomainName", this.textBox_fullDomainName.Text.ToString());
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "域名已经保存,点击测试连接将查询域名是否存在,当不存在时点击添加域名会创建新域名记录!" + "\r\n");
}
@ -914,5 +955,210 @@ namespace net.nutcore.aliddns
cfg.AddAppSetting("whatIsUrl", newItem);
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "新增公网IP查询网址保存成功" + "\r\n");
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/wisdomwei201804/AliDDNS/");
}
private void checkBox_autoCheckUpdate_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_autoCheckUpdate.Checked == true)
{
cfg.SaveAppSetting("autoCheckUpdate", "On");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件自动检测升级启用!" + "\r\n");
}
else
{
cfg.SaveAppSetting("autoCheckUpdate", "Off");
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "软件自动检测升级关闭!" + "\r\n");
}
}
private void button_ngrokApply_Click(object sender, EventArgs e)
{
if (ngrok.IsExists())
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok穿透功能已经启动\r\n本机浏览器打开http://127.0.0.1:4040 查看运行状态。" + "\r\n");
ngrok.Start();
}
else
{
MessageBox.Show("设置在当前目录没有发现ngrok.exe请往官网下载自行编译。\nNgrok官网https://ngrok.com/download");
}
}
private void ngrokConfig_Load()
{
//读取配置文件
try
{
textBox_AuthToken.Text = ngrok.ngrokConfig.authtoken;
textBox_serverAddr.Text = ngrok.ngrokConfig.server_addr;
//List<NgrokHelper.Protocol> tunnel = new List<NgrokHelper.Protocol>();
ArrayList row = new ArrayList();
Dictionary<object,object> tunnelItems = (Dictionary<object, object>)ngrok.ngrokConfig.tunnels;
int count = tunnelItems.Count;
int k = 0;
foreach (KeyValuePair<object, object> kvp in tunnelItems)
{
row.Add(kvp.Key);
Dictionary<object, object> items = (Dictionary<object, object>)kvp.Value;
foreach (KeyValuePair<object, object> items_kvp in items)
{
if(items_kvp.Key.ToString() == "proto")
{
Dictionary<object, object> protos = (Dictionary<object, object>)items_kvp.Value;
foreach (KeyValuePair<object, object> protos_kvp in protos)
{
row.Add(protos_kvp.Key);
row.Add(protos_kvp.Value);
if(protos_kvp.Key.ToString() == "http" || protos_kvp.Key.ToString() == "https")
{
row.Add(null);
}
}
}
if (items_kvp.Key.ToString() == "subdomain")
{
row.Add(items_kvp.Value);
}
if (items_kvp.Key.ToString() == "remote_port")
{
row.Add(items_kvp.Value);
row.Add(null);
}
}
}
listView_ngrok.BeginUpdate(); //数据更新UI暂时挂起直到EndUpdate绘制控件可以有效避免闪烁并大大提高加载速度
for (int i = 1; i <= count; i++) //添加数据
{
ListViewItem lvi = new ListViewItem();
//lvi.ImageIndex = i; //通过与imageList绑定显示imageList中第i项图标
lvi.Text = i.ToString();
for (int j = 2; j <= 6; j++)
{
lvi.SubItems.Add((string)row[k]);
k++;
}
listView_ngrok.Items.Add(lvi);
}
listView_ngrok.EndUpdate(); //结束数据处理UI界面一次性绘制。
}
catch (Exception error)
{
MessageBox.Show("配置文件ngrok.cfg读取出错请修改文件内容或者格式也可以删除错误文件自动生成新文件。" + error, "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button_ngrokSave_Click(object sender, EventArgs e)
{
Dictionary<object,object> tunnel_saved = new Dictionary<object, object>();
for (int i = 0; i < listView_ngrok.Items.Count; i++)
{
Dictionary<object, object> item_saved = new Dictionary<object, object>();
Dictionary<object, object> proto_saved = new Dictionary<object, object>();
if (listView_ngrok.Items[i].SubItems[2].Text == "http")
{
proto_saved.Add("http", listView_ngrok.Items[i].SubItems[3].Text);
item_saved.Add("proto", proto_saved);
item_saved.Add("subdomain", listView_ngrok.Items[i].SubItems[5].Text);
}
if (listView_ngrok.Items[i].SubItems[2].Text == "https")
{
proto_saved.Add("https", listView_ngrok.Items[i].SubItems[3].Text);
item_saved.Add("proto", proto_saved);
item_saved.Add("subdomain", listView_ngrok.Items[i].SubItems[5].Text);
}
if (listView_ngrok.Items[i].SubItems[2].Text == "tcp")
{
proto_saved.Add("tcp", listView_ngrok.Items[i].SubItems[3].Text);
item_saved.Add("proto", proto_saved);
item_saved.Add("remote_port", listView_ngrok.Items[i].SubItems[4].Text);
}
tunnel_saved.Add(listView_ngrok.Items[i].SubItems[1].Text, item_saved);
}
ngrok.ngrokConfig.authtoken = textBox_AuthToken.Text.ToString();
ngrok.ngrokConfig.server_addr = textBox_serverAddr.Text.ToString();
ngrok.ngrokConfig.tunnels = tunnel_saved;
ngrok.Save();
}
private void button_addnew_Click(object sender, EventArgs e)
{
Form_tunnelEdit tunnelEditForm = new Form_tunnelEdit();
tunnelEditForm.Owner = this;
tunnelEditForm.tunnelMode = "addNew";
tunnelEditForm.tunnelIndex = listView_ngrok.Items.Count;
tunnelEditForm.ShowDialog();
}
private void button_delete_Click(object sender, EventArgs e)
{
/*foreach (ListViewItem lvi in listView_ngrok.SelectedItems) //选中项遍历
{
//listView_ngrok.Items.RemoveAt(lvi.Index); // 按索引移除
listView_ngrok.Items.Remove(lvi); //按项移除
}*/
if(listView_ngrok.SelectedItems.Count > 0)
{
listView_ngrok.SelectedItems[0].Remove();
}
for (int i = 0; i < listView_ngrok.Items.Count; i++)
{
listView_ngrok.Items[i].Text = (i+1).ToString();
}
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "网络穿透隧道删除成功!" + "\r\n");
}
private void button_edit_Click(object sender, EventArgs e)
{
if (listView_ngrok.SelectedItems.Count < 1)
{
MessageBox.Show("请选择需要编辑的项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
Form_tunnelEdit tunnelEditForm = new Form_tunnelEdit();
tunnelEditForm.Owner = this;
int index = listView_ngrok.SelectedIndices[0];
tunnelEditForm.tunnelIndex = index;
tunnelEditForm.textBox_symbol.Text = listView_ngrok.Items[index].SubItems[1].Text;
tunnelEditForm.comboBox_proto.Text = listView_ngrok.Items[index].SubItems[2].Text;
if (listView_ngrok.Items[index].SubItems[2].Text == "tcp")
{
tunnelEditForm.textBox_subdomain.Enabled = false;
}
else
{
tunnelEditForm.textBox_subdomain.Text = listView_ngrok.Items[index].SubItems[5].Text;
}
tunnelEditForm.textBox_localPort.Text = listView_ngrok.Items[index].SubItems[3].Text;
if(listView_ngrok.Items[index].SubItems[2].Text == "http" || listView_ngrok.Items[index].SubItems[2].Text == "https")
{
tunnelEditForm.textBox_serverPort.Enabled = false;
}
else
{
tunnelEditForm.textBox_serverPort.Text = listView_ngrok.Items[index].SubItems[4].Text;
}
tunnelEditForm.ShowDialog();
}
}
private void button_stop_Click(object sender, EventArgs e)
{
if (ngrok.IsExists())
{
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok穿透功能关闭。" + "\r\n");
ngrok.Stop();
}
}
}
}

View File

@ -204,7 +204,7 @@
</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>56</value>
<value>39</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -1,447 +0,0 @@
namespace net.nutcore.aliddns
{
partial class Form_ngrok
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
"http",
"www",
"http",
"8081",
"80"}, -1);
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_ngrok));
this.groupBox_AuthToken = new System.Windows.Forms.GroupBox();
this.textBox_AuthToken = new System.Windows.Forms.TextBox();
this.groupBox_Ngrokserver = new System.Windows.Forms.GroupBox();
this.textBox_serverAddr = new System.Windows.Forms.TextBox();
this.label_NgrokDomain = new System.Windows.Forms.Label();
this.groupBox_Url = new System.Windows.Forms.GroupBox();
this.textBox_lanPort4 = new System.Windows.Forms.TextBox();
this.textBox_remotePort4 = new System.Windows.Forms.TextBox();
this.label_tunnel4 = new System.Windows.Forms.Label();
this.textBox_lanPort3 = new System.Windows.Forms.TextBox();
this.textBox_remotePort3 = new System.Windows.Forms.TextBox();
this.label_tunnel3 = new System.Windows.Forms.Label();
this.label_tunnel2 = new System.Windows.Forms.Label();
this.label_tunnel1 = new System.Windows.Forms.Label();
this.textBox_lanPort2 = new System.Windows.Forms.TextBox();
this.textBox_remotePort2 = new System.Windows.Forms.TextBox();
this.textBox_lanPort1 = new System.Windows.Forms.TextBox();
this.textBox_remotePort1 = new System.Windows.Forms.TextBox();
this.label_lanport = new System.Windows.Forms.Label();
this.label_remoteport = new System.Windows.Forms.Label();
this.label_tunnels = new System.Windows.Forms.Label();
this.textBox_lanHttps = new System.Windows.Forms.TextBox();
this.textBox_lanHttp = new System.Windows.Forms.TextBox();
this.textBox_subDomain = new System.Windows.Forms.TextBox();
this.label_lanHttps = new System.Windows.Forms.Label();
this.label_lanHttp = new System.Windows.Forms.Label();
this.label_subDomain = new System.Windows.Forms.Label();
this.button_cancel = new System.Windows.Forms.Button();
this.button_save = new System.Windows.Forms.Button();
this.listView_setup = new System.Windows.Forms.ListView();
this.columnHeader_proto = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_remoteport = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_lanport = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_subdomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_symbol = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBox_AuthToken.SuspendLayout();
this.groupBox_Ngrokserver.SuspendLayout();
this.groupBox_Url.SuspendLayout();
this.SuspendLayout();
//
// groupBox_AuthToken
//
this.groupBox_AuthToken.Controls.Add(this.textBox_AuthToken);
this.groupBox_AuthToken.Location = new System.Drawing.Point(6, 12);
this.groupBox_AuthToken.Name = "groupBox_AuthToken";
this.groupBox_AuthToken.Size = new System.Drawing.Size(242, 50);
this.groupBox_AuthToken.TabIndex = 0;
this.groupBox_AuthToken.TabStop = false;
this.groupBox_AuthToken.Text = "认证令牌";
//
// textBox_AuthToken
//
this.textBox_AuthToken.Location = new System.Drawing.Point(11, 21);
this.textBox_AuthToken.Name = "textBox_AuthToken";
this.textBox_AuthToken.Size = new System.Drawing.Size(219, 21);
this.textBox_AuthToken.TabIndex = 0;
//
// groupBox_Ngrokserver
//
this.groupBox_Ngrokserver.Controls.Add(this.textBox_serverAddr);
this.groupBox_Ngrokserver.Controls.Add(this.label_NgrokDomain);
this.groupBox_Ngrokserver.Location = new System.Drawing.Point(6, 68);
this.groupBox_Ngrokserver.Name = "groupBox_Ngrokserver";
this.groupBox_Ngrokserver.Size = new System.Drawing.Size(242, 48);
this.groupBox_Ngrokserver.TabIndex = 1;
this.groupBox_Ngrokserver.TabStop = false;
this.groupBox_Ngrokserver.Text = "服务端Ngrokd";
//
// textBox_serverAddr
//
this.textBox_serverAddr.Location = new System.Drawing.Point(50, 18);
this.textBox_serverAddr.Name = "textBox_serverAddr";
this.textBox_serverAddr.Size = new System.Drawing.Size(180, 21);
this.textBox_serverAddr.TabIndex = 1;
//
// label_NgrokDomain
//
this.label_NgrokDomain.AutoSize = true;
this.label_NgrokDomain.Location = new System.Drawing.Point(11, 21);
this.label_NgrokDomain.Name = "label_NgrokDomain";
this.label_NgrokDomain.Size = new System.Drawing.Size(35, 12);
this.label_NgrokDomain.TabIndex = 0;
this.label_NgrokDomain.Text = "地址:";
//
// groupBox_Url
//
this.groupBox_Url.Controls.Add(this.textBox_lanPort4);
this.groupBox_Url.Controls.Add(this.textBox_remotePort4);
this.groupBox_Url.Controls.Add(this.label_tunnel4);
this.groupBox_Url.Controls.Add(this.textBox_lanPort3);
this.groupBox_Url.Controls.Add(this.textBox_remotePort3);
this.groupBox_Url.Controls.Add(this.label_tunnel3);
this.groupBox_Url.Controls.Add(this.label_tunnel2);
this.groupBox_Url.Controls.Add(this.label_tunnel1);
this.groupBox_Url.Controls.Add(this.textBox_lanPort2);
this.groupBox_Url.Controls.Add(this.textBox_remotePort2);
this.groupBox_Url.Controls.Add(this.textBox_lanPort1);
this.groupBox_Url.Controls.Add(this.textBox_remotePort1);
this.groupBox_Url.Controls.Add(this.label_lanport);
this.groupBox_Url.Controls.Add(this.label_remoteport);
this.groupBox_Url.Controls.Add(this.label_tunnels);
this.groupBox_Url.Controls.Add(this.textBox_lanHttps);
this.groupBox_Url.Controls.Add(this.textBox_lanHttp);
this.groupBox_Url.Controls.Add(this.textBox_subDomain);
this.groupBox_Url.Controls.Add(this.label_lanHttps);
this.groupBox_Url.Controls.Add(this.label_lanHttp);
this.groupBox_Url.Controls.Add(this.label_subDomain);
this.groupBox_Url.Location = new System.Drawing.Point(6, 123);
this.groupBox_Url.Name = "groupBox_Url";
this.groupBox_Url.Size = new System.Drawing.Size(242, 197);
this.groupBox_Url.TabIndex = 2;
this.groupBox_Url.TabStop = false;
this.groupBox_Url.Text = "内网端Ngrok";
//
// textBox_lanPort4
//
this.textBox_lanPort4.Location = new System.Drawing.Point(171, 166);
this.textBox_lanPort4.Name = "textBox_lanPort4";
this.textBox_lanPort4.Size = new System.Drawing.Size(50, 21);
this.textBox_lanPort4.TabIndex = 20;
//
// textBox_remotePort4
//
this.textBox_remotePort4.Location = new System.Drawing.Point(87, 166);
this.textBox_remotePort4.Name = "textBox_remotePort4";
this.textBox_remotePort4.Size = new System.Drawing.Size(50, 21);
this.textBox_remotePort4.TabIndex = 19;
//
// label_tunnel4
//
this.label_tunnel4.AutoSize = true;
this.label_tunnel4.Location = new System.Drawing.Point(17, 169);
this.label_tunnel4.Name = "label_tunnel4";
this.label_tunnel4.Size = new System.Drawing.Size(53, 12);
this.label_tunnel4.TabIndex = 18;
this.label_tunnel4.Text = "Tunnel4:";
//
// textBox_lanPort3
//
this.textBox_lanPort3.Location = new System.Drawing.Point(171, 140);
this.textBox_lanPort3.Name = "textBox_lanPort3";
this.textBox_lanPort3.Size = new System.Drawing.Size(50, 21);
this.textBox_lanPort3.TabIndex = 17;
//
// textBox_remotePort3
//
this.textBox_remotePort3.Location = new System.Drawing.Point(87, 140);
this.textBox_remotePort3.Name = "textBox_remotePort3";
this.textBox_remotePort3.Size = new System.Drawing.Size(50, 21);
this.textBox_remotePort3.TabIndex = 16;
//
// label_tunnel3
//
this.label_tunnel3.AutoSize = true;
this.label_tunnel3.Location = new System.Drawing.Point(17, 142);
this.label_tunnel3.Name = "label_tunnel3";
this.label_tunnel3.Size = new System.Drawing.Size(53, 12);
this.label_tunnel3.TabIndex = 15;
this.label_tunnel3.Text = "Tunnel3:";
//
// label_tunnel2
//
this.label_tunnel2.AutoSize = true;
this.label_tunnel2.Location = new System.Drawing.Point(17, 115);
this.label_tunnel2.Name = "label_tunnel2";
this.label_tunnel2.Size = new System.Drawing.Size(53, 12);
this.label_tunnel2.TabIndex = 12;
this.label_tunnel2.Text = "Tunnel2:";
//
// label_tunnel1
//
this.label_tunnel1.AutoSize = true;
this.label_tunnel1.Location = new System.Drawing.Point(17, 88);
this.label_tunnel1.Name = "label_tunnel1";
this.label_tunnel1.Size = new System.Drawing.Size(53, 12);
this.label_tunnel1.TabIndex = 9;
this.label_tunnel1.Text = "Tunnel1:";
//
// textBox_lanPort2
//
this.textBox_lanPort2.Location = new System.Drawing.Point(171, 112);
this.textBox_lanPort2.Name = "textBox_lanPort2";
this.textBox_lanPort2.Size = new System.Drawing.Size(50, 21);
this.textBox_lanPort2.TabIndex = 14;
//
// textBox_remotePort2
//
this.textBox_remotePort2.Location = new System.Drawing.Point(87, 112);
this.textBox_remotePort2.Name = "textBox_remotePort2";
this.textBox_remotePort2.Size = new System.Drawing.Size(50, 21);
this.textBox_remotePort2.TabIndex = 13;
//
// textBox_lanPort1
//
this.textBox_lanPort1.Location = new System.Drawing.Point(171, 85);
this.textBox_lanPort1.Name = "textBox_lanPort1";
this.textBox_lanPort1.Size = new System.Drawing.Size(50, 21);
this.textBox_lanPort1.TabIndex = 11;
//
// textBox_remotePort1
//
this.textBox_remotePort1.Location = new System.Drawing.Point(87, 85);
this.textBox_remotePort1.Name = "textBox_remotePort1";
this.textBox_remotePort1.Size = new System.Drawing.Size(50, 21);
this.textBox_remotePort1.TabIndex = 10;
//
// label_lanport
//
this.label_lanport.AutoSize = true;
this.label_lanport.Location = new System.Drawing.Point(169, 65);
this.label_lanport.Name = "label_lanport";
this.label_lanport.Size = new System.Drawing.Size(53, 12);
this.label_lanport.TabIndex = 8;
this.label_lanport.Text = "内网端口";
//
// label_remoteport
//
this.label_remoteport.AutoSize = true;
this.label_remoteport.Location = new System.Drawing.Point(87, 65);
this.label_remoteport.Name = "label_remoteport";
this.label_remoteport.Size = new System.Drawing.Size(53, 12);
this.label_remoteport.TabIndex = 7;
this.label_remoteport.Text = "远程端口";
//
// label_tunnels
//
this.label_tunnels.AutoSize = true;
this.label_tunnels.Location = new System.Drawing.Point(12, 65);
this.label_tunnels.Name = "label_tunnels";
this.label_tunnels.Size = new System.Drawing.Size(71, 12);
this.label_tunnels.TabIndex = 6;
this.label_tunnels.Text = "TCP穿透服务";
//
// textBox_lanHttps
//
this.textBox_lanHttps.Location = new System.Drawing.Point(171, 37);
this.textBox_lanHttps.Name = "textBox_lanHttps";
this.textBox_lanHttps.Size = new System.Drawing.Size(50, 21);
this.textBox_lanHttps.TabIndex = 5;
//
// textBox_lanHttp
//
this.textBox_lanHttp.Location = new System.Drawing.Point(87, 37);
this.textBox_lanHttp.Name = "textBox_lanHttp";
this.textBox_lanHttp.Size = new System.Drawing.Size(50, 21);
this.textBox_lanHttp.TabIndex = 4;
//
// textBox_subDomain
//
this.textBox_subDomain.Location = new System.Drawing.Point(20, 37);
this.textBox_subDomain.Name = "textBox_subDomain";
this.textBox_subDomain.Size = new System.Drawing.Size(50, 21);
this.textBox_subDomain.TabIndex = 3;
//
// label_lanHttps
//
this.label_lanHttps.AutoSize = true;
this.label_lanHttps.Location = new System.Drawing.Point(167, 17);
this.label_lanHttps.Name = "label_lanHttps";
this.label_lanHttps.Size = new System.Drawing.Size(59, 12);
this.label_lanHttps.TabIndex = 2;
this.label_lanHttps.Text = "https端口";
//
// label_lanHttp
//
this.label_lanHttp.AutoSize = true;
this.label_lanHttp.Location = new System.Drawing.Point(87, 18);
this.label_lanHttp.Name = "label_lanHttp";
this.label_lanHttp.Size = new System.Drawing.Size(53, 12);
this.label_lanHttp.TabIndex = 1;
this.label_lanHttp.Text = "http端口";
//
// label_subDomain
//
this.label_subDomain.AutoSize = true;
this.label_subDomain.Location = new System.Drawing.Point(19, 18);
this.label_subDomain.Name = "label_subDomain";
this.label_subDomain.Size = new System.Drawing.Size(53, 12);
this.label_subDomain.TabIndex = 0;
this.label_subDomain.Text = "次级域名";
//
// button_cancel
//
this.button_cancel.Location = new System.Drawing.Point(33, 324);
this.button_cancel.Name = "button_cancel";
this.button_cancel.Size = new System.Drawing.Size(80, 23);
this.button_cancel.TabIndex = 4;
this.button_cancel.Text = "取消";
this.button_cancel.UseVisualStyleBackColor = true;
this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
//
// button_save
//
this.button_save.Location = new System.Drawing.Point(145, 324);
this.button_save.Name = "button_save";
this.button_save.Size = new System.Drawing.Size(80, 23);
this.button_save.TabIndex = 3;
this.button_save.Text = "保存";
this.button_save.UseVisualStyleBackColor = true;
this.button_save.Click += new System.EventHandler(this.button_save_Click);
//
// listView_setup
//
this.listView_setup.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader_symbol,
this.columnHeader_subdomain,
this.columnHeader_proto,
this.columnHeader_remoteport,
this.columnHeader_lanport});
this.listView_setup.GridLines = true;
this.listView_setup.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1});
this.listView_setup.Location = new System.Drawing.Point(254, 188);
this.listView_setup.Name = "listView_setup";
this.listView_setup.Size = new System.Drawing.Size(247, 151);
this.listView_setup.TabIndex = 5;
this.listView_setup.UseCompatibleStateImageBehavior = false;
this.listView_setup.View = System.Windows.Forms.View.Details;
//
// columnHeader_proto
//
this.columnHeader_proto.Text = "proto";
this.columnHeader_proto.Width = 43;
//
// columnHeader_remoteport
//
this.columnHeader_remoteport.Text = "remoteport";
//
// columnHeader_lanport
//
this.columnHeader_lanport.Text = "Lanport";
//
// columnHeader_subdomain
//
this.columnHeader_subdomain.Text = "subdomain";
this.columnHeader_subdomain.Width = 69;
//
// columnHeader_symbol
//
this.columnHeader_symbol.Text = "symbol";
this.columnHeader_symbol.Width = 50;
//
// Form_ngrok
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(513, 351);
this.Controls.Add(this.listView_setup);
this.Controls.Add(this.button_save);
this.Controls.Add(this.button_cancel);
this.Controls.Add(this.groupBox_Url);
this.Controls.Add(this.groupBox_Ngrokserver);
this.Controls.Add(this.groupBox_AuthToken);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form_ngrok";
this.Tag = "";
this.Text = "Ngrok设置";
this.Shown += new System.EventHandler(this.Form_ngrok_Shown);
this.groupBox_AuthToken.ResumeLayout(false);
this.groupBox_AuthToken.PerformLayout();
this.groupBox_Ngrokserver.ResumeLayout(false);
this.groupBox_Ngrokserver.PerformLayout();
this.groupBox_Url.ResumeLayout(false);
this.groupBox_Url.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox_AuthToken;
private System.Windows.Forms.GroupBox groupBox_Ngrokserver;
private System.Windows.Forms.GroupBox groupBox_Url;
private System.Windows.Forms.Button button_cancel;
private System.Windows.Forms.Button button_save;
private System.Windows.Forms.TextBox textBox_AuthToken;
private System.Windows.Forms.TextBox textBox_serverAddr;
private System.Windows.Forms.Label label_NgrokDomain;
private System.Windows.Forms.TextBox textBox_lanHttp;
private System.Windows.Forms.TextBox textBox_subDomain;
private System.Windows.Forms.Label label_lanHttp;
private System.Windows.Forms.Label label_subDomain;
private System.Windows.Forms.TextBox textBox_lanPort2;
private System.Windows.Forms.TextBox textBox_remotePort2;
private System.Windows.Forms.TextBox textBox_lanPort1;
private System.Windows.Forms.Label label_lanport;
private System.Windows.Forms.Label label_remoteport;
private System.Windows.Forms.Label label_tunnels;
private System.Windows.Forms.TextBox textBox_remotePort1;
private System.Windows.Forms.TextBox textBox_lanPort3;
private System.Windows.Forms.TextBox textBox_remotePort3;
private System.Windows.Forms.Label label_tunnel3;
private System.Windows.Forms.Label label_tunnel2;
private System.Windows.Forms.Label label_tunnel1;
private System.Windows.Forms.TextBox textBox_lanHttps;
private System.Windows.Forms.Label label_lanHttps;
private System.Windows.Forms.TextBox textBox_lanPort4;
private System.Windows.Forms.TextBox textBox_remotePort4;
private System.Windows.Forms.Label label_tunnel4;
private System.Windows.Forms.ListView listView_setup;
private System.Windows.Forms.ColumnHeader columnHeader_symbol;
private System.Windows.Forms.ColumnHeader columnHeader_subdomain;
private System.Windows.Forms.ColumnHeader columnHeader_proto;
private System.Windows.Forms.ColumnHeader columnHeader_remoteport;
private System.Windows.Forms.ColumnHeader columnHeader_lanport;
}
}

View File

@ -1,104 +0,0 @@
using System;
using System.Windows.Forms;
namespace net.nutcore.aliddns
{
public partial class Form_ngrok : Form
{
//初始化ngrok操作类
private NgrokHelper ngrok = new NgrokHelper();
public Form_ngrok()
{
InitializeComponent();
this.MinimizeBox = false; //取消窗口最小化按钮
this.MaximizeBox = false; //取消窗口最大化按钮
}
private void button_cancel_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
private void button_save_Click(object sender, EventArgs e)
{
var token = textBox_AuthToken.Text.ToString();
var server_addr = textBox_serverAddr.Text.ToString();
var lanhttp = 80;
int.TryParse(textBox_lanHttp.Text, out lanhttp);
textBox_lanHttp.Text = lanhttp.ToString();
var lanhttps = 443;
int.TryParse(textBox_lanHttps.Text, out lanhttps);
textBox_lanHttps.Text = lanhttps.ToString();
var subdomain = textBox_subDomain.Text.ToString();
var remoteport1 = 2221;
int.TryParse(textBox_remotePort1.Text, out remoteport1);
textBox_remotePort1.Text = remoteport1.ToString();
var lanport1 = 21;
int.TryParse(textBox_lanPort1.Text, out lanport1);
textBox_lanPort1.Text = lanport1.ToString();
var remoteport2 = 2222;
int.TryParse(textBox_remotePort2.Text, out remoteport2);
textBox_remotePort2.Text = remoteport2.ToString();
var lanport2 = 22;
int.TryParse(textBox_lanPort2.Text, out lanport2);
textBox_lanPort2.Text = lanport2.ToString();
var remoteport3 = 33890;
int.TryParse(textBox_remotePort3.Text, out remoteport3);
textBox_remotePort3.Text = remoteport3.ToString();
var lanport3 = 3389;
int.TryParse(textBox_lanPort3.Text, out lanport3);
textBox_lanPort3.Text = lanport3.ToString();
var remoteport4 = 10099;
int.TryParse(textBox_remotePort4.Text, out remoteport4);
textBox_remotePort4.Text = remoteport4.ToString();
var lanport4 = 9000;
int.TryParse(textBox_lanPort4.Text, out lanport4);
textBox_lanPort4.Text = lanport4.ToString();
ngrok.Save(token, server_addr, subdomain, lanhttp, lanhttps, remoteport1, lanport1, remoteport2, lanport2, remoteport3, lanport3, remoteport4, lanport4, false, true, true);
this.Close();
this.Dispose();
}
private void Form_ngrok_Shown(object sender, EventArgs e)
{
//检测ngrok.exe是否存在
if (!ngrok.IsExists())
{
MessageBox.Show("设置在当前目录没有发现ngrok.exe请往官网下载自行编译。\nNgrok官网https://ngrok.com/download");
}
//读取配置文件
try
{
var config = ngrok.Load();
textBox_AuthToken.Text = config.authtoken;
textBox_serverAddr.Text = config.server_addr;
textBox_subDomain.Text = config.tunnels.website_http.subdomain.ToString();
textBox_lanHttp.Text = config.tunnels.website_http.proto.http.ToString();
textBox_lanHttps.Text = config.tunnels.website_https.proto.https.ToString();
textBox_remotePort1.Text = config.tunnels.tcp1.remote_port.ToString();
textBox_lanPort1.Text = config.tunnels.tcp1.proto.tcp.ToString();
textBox_remotePort2.Text = config.tunnels.tcp2.remote_port.ToString();
textBox_lanPort2.Text = config.tunnels.tcp2.proto.tcp.ToString();
textBox_remotePort3.Text = config.tunnels.tcp3.remote_port.ToString();
textBox_lanPort3.Text = config.tunnels.tcp3.proto.tcp.ToString();
textBox_remotePort4.Text = config.tunnels.tcp4.remote_port.ToString();
textBox_lanPort4.Text = config.tunnels.tcp4.proto.tcp.ToString();
}
catch (Exception)
{
MessageBox.Show("配置文件ngrok.cfg读取出错请修改文件内容或者格式也可以删除错误文件自动生成新文件。","警告",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.Dispose();
}
}
}
}

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA
AAAAAAAARU36AEVN+gBFTfoHRU36IUVN+kBFTfpgRU36hEVN+rJFTfrWRU365kVN+u9FTfr2RU36/EVN
+v9FTfr/RU36/0VN+v9FTfr+RU36+UVN+vJFTfrpRU363EVN+r1FTfqPRU36aEVN+kdFTfomRU36CEVN
+gBFTfoAAAAAAEVN+gBFTfoBRU36L0VN+plFTfrbRU368EVN+vpFTfr+RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr7RU3680VN
+t9FTfqgRU36MkVN+gFFTfoARU36AEVN+jBFTfrWRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfraRU36MEVN+gBFTfoFRU36okVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfqaRU36BkVN+h5FTfrXRU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/REz6/0RM+v9ETPr/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+ttFTfoiRU36PUVN+u1FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/Qkr4/0ZO9f9PVvL/VFvw/1Vb7/9QV/D/R0/y/0JK
9f9DS/n/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU368EVN+kJFTfpxRU36+kVN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/Q0v4/1FY9P9zefD/p6v0/8nL+f/S1Pr/09X6/8zO
+f+xtPT/fIHs/1Vb7P9DS/T/REz6/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr6RU36YUVN
+qZFTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/REz6/0ZO9/9yePP/w8X5/+Xm/v/r7P//6+z//+Xm
///k5f//6er//+zt///n6P7/ztD5/4CF7P9IUO//REz5/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfqERU36wEVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0RM+v9IUPj/j5T2/+Hi/f/u7///6+z//+3u
//+8v/v/cHb7/2ty+/+anv3/5+j//+zt///u7///5+n+/6Km8f9NVO7/REz5/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+rNFTfrSRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/Rk75/46T9//o6f7/7vD//8TH
/f/P0v3/7O3+/3l/9/8+R/n/QEj5/1de+v/Y2v7/5OX9/8LF+f/p6///7u/+/6Sn8f9JUPD/REz6/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU3610VN+uBFTfr/RU36/0VN+v9FTfr/RU36/0NM+v9udfj/4eP9//Hy
//+ytfv/YGb3/9DS/f/l5/3/cXfw/1lf7/9bYe//XWPv/8jL+v/r7P7/c3nv/5me+P/s7f//7O3+/4OI
7v9DS/X/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrmRU366UVN+v9FTfr/RU36/0VN+v9FTfr/TFT5/8DD
/P/29///2Nr7/32C7/+VmfH/6uv+//Hx/v/h4vv/4uP7/+Lj+//f4Pv/6+z9//P0//+vsvL/dXrr/8XH
9//29v//1tj5/1de8P9ETPr/RU36/0VN+v9FTfr/RU36/0VN+vBFTfrwRU36/0VN+v9FTfr/RU36/0NL
+v9rcfr/6er+//f3///t7v3/7u/9//f3///29///8PH+/+jp///k5v//5Ob//+fo///t7v//9fb///f3
///x8f3/6uv8//X2///z9P7/gobv/0JK9/9FTfr/RU36/0VN+v9FTfr/RU3690VN+vVFTfr/RU36/0VN
+v9FTfr/REz6/6Gl+//5+f//9/j//+nq///P0f7/4OH+//r7//+usvf/Ymn5/15l+/9eZfv/YGf7/4iN
/P/y8v//7e79/87Q/P/k5f//9fb///v7//+8v/b/SVD1/0VN+v9FTfr/RU36/0VN+v9FTfr9RU36+EVN
+v9FTfr/RU36/0VN+v9IUPr/wsX9//////+/wvn/ZWz6/05W+v+2uv3//v///42S8/9ASPj/Q0z6/0NM
+v9BSfr/ZWz7/+/w///e3/v/W2L2/1xj+/+nqv3/+vv//9vd+v9TWvX/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr6RU36/0VN+v9FTfr/RU36/0tT+v/O0P7//////4uQ8/9ASPj/Rk76/7y//f//////iIzy/z5G
9v9BSfb/QUn2/z9H9v9haPn/7u/+/+Pk/P9XXvb/QEj6/3B2+//29///5uf8/1lg9v9ETPr/RU36/0VN
+v9FTfr/RU36/0VN+vpFTfr/RU36/0VN+v9FTfr/S1P6/87Q/v//////j5Tx/0BI9/9DS/f/vL/7////
//+lqPH/dnvs/4GG7f+Ch+z/en7s/4iM7//z9P7/4+T7/1Ra8v8/R/j/dHr7//n5///m5/z/WWD3/0RM
+v9FTfr/RU36/0VN+v9FTfr/RU3690VN+v9FTfr/RU36/0VN+v9IT/r/wcT9//////+3uvT/W2Lv/4OI
8P/e4Pr///////v7/v/9/f7////+/////v/+/v7/+/v+///////y8v3/lZnu/11j6/+coPf//////9zd
/P9SWvj/REz6/0VN+v9FTfr/RU36/0VN+v9FTfr0RU36/0VN+v9FTfr/RU36/0NL+v+anvz///////T1
/f/n6Pv//f3+//39////////8PD9/87Q/f/FyP7/xMf9/8rM/v/i4/7//v7///7+///+/v//7Oz7/+7u
/P//////t7r5/0hP+f9FTfr/RU36/0VN+v9FTfr/RU36/kVN+u5FTfr/RU36/0VN+v9FTfr/Q0v6/2Rr
+//s7f7///////Pz/f+1uPv/o6f9//v8///P0fj/UFf2/0hQ+v9IUPr/SFD6/5uf+///////xcf5/6qt
+//o6f7///////n6/v99gvj/Qkr6/0VN+v9FTfr/RU36/0VN+v9FTfr5RU365kVN+v9FTfr/RU36/0VN
+v9FTfr/SVH6/7q9/f//////6On7/2Jo7P9dZPf/7+///+Lj+v9VXPT/REz6/0VN+v9GTvr/ur38////
//+Fivb/Uln1/9PV+///////1Nb8/1Rb+f9ETPr/RU36/0VN+v9FTfr/RU36/0VN+vJFTfrcRU36/0VN
+v9FTfr/RU36/0VN+v9DTPr/ZGv7/+Pk/v//////0dL2/21z7P/W1/v/9PX9/2hu8f9DS/n/REz6/09X
+v/W2P3/9PT9/32C8/+6vfj//v7///Pz/v96gPr/Q0v6/0VN+v9FTfr/RU36/0VN+v9FTfr/RU366UVN
+s1FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/gYb8/+7v////////4+T5/+Lj+v//////io/v/z5G
8/8/R/X/Y2r3/+7v/v/z9P3/4OH6//39///4+P//mp77/0dP+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfrbRU36ukVN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/gYb8/+Tl/v//////////////
///Y2vj/j5Ps/4qO7f+8vvT//f3/////////////7+/+/5eb/P9JUfr/REz6/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+rxFTfqbRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9ETPr/ZGv7/7q9
/f/t7v///f3////////////////////////+/v//8vL//8nL/f9zefv/Rk76/0RM+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36jkVN+mRFTfr4RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9DTPr/SVH6/2Rr+/+anvz/wsT9/8/R/v/Q0v7/xcj9/6Wp/f9tc/v/TVT6/0NL+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+vtFTfpmRU36N0VN+upFTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/Q0v6/0NL+v9IT/r/S1P6/0tT+v9IUPr/REz6/0NL+v9ETPr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU368kVN+kVFTfoaRU360kVN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrdRU36JUVN+gRFTfqaRU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+p9FTfoHRU36AEVN
+ixFTfrSRU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfrWRU36MEVN
+gBFTfoARU36AEVN+i5FTfqfRU3610VN+u5FTfr6RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN
+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr/RU36/0VN+v9FTfr+RU36+EVN+utFTfrURU36nUVN
+i5FTfoARU36AAAAAABFTfoARU36AEVN+gZFTfodRU36PUVN+m9FTfqkRU36wEVN+tJFTfrfRU366EVN
+vBFTfr1RU36+EVN+vpFTfr6RU36+EVN+vRFTfrtRU365UVN+txFTfrORU36u0VN+pxFTfplRU36OEVN
+htFTfoFRU36AEVN+gAAAAAA4AAAB4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAAABgAAAAeAAAAc=
</value>
</data>
</root>

View File

@ -0,0 +1,262 @@
namespace net.nutcore.aliddns
{
partial class Form_tunnelEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox_symbol = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox_localPort = new System.Windows.Forms.TextBox();
this.comboBox_proto = new System.Windows.Forms.ComboBox();
this.textBox_serverPort = new System.Windows.Forms.TextBox();
this.textBox_subdomain = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.groupBox_tunnel = new System.Windows.Forms.GroupBox();
this.button_confirm = new System.Windows.Forms.Button();
this.button_cancel = new System.Windows.Forms.Button();
this.groupBox_tunnel.SuspendLayout();
this.SuspendLayout();
//
// textBox_symbol
//
this.textBox_symbol.Location = new System.Drawing.Point(77, 14);
this.textBox_symbol.MaxLength = 5;
this.textBox_symbol.Name = "textBox_symbol";
this.textBox_symbol.Size = new System.Drawing.Size(87, 21);
this.textBox_symbol.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 1;
this.label1.Text = "英文标识:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 2;
this.label2.Text = "网络协议:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 97);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 3;
this.label3.Text = "本地端口:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 124);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(77, 12);
this.label4.TabIndex = 4;
this.label4.Text = "服务器端口:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 70);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 5;
this.label5.Text = "域名:";
//
// textBox_localPort
//
this.textBox_localPort.Location = new System.Drawing.Point(77, 94);
this.textBox_localPort.MaxLength = 5;
this.textBox_localPort.Name = "textBox_localPort";
this.textBox_localPort.Size = new System.Drawing.Size(87, 21);
this.textBox_localPort.TabIndex = 6;
//
// comboBox_proto
//
this.comboBox_proto.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_proto.FormattingEnabled = true;
this.comboBox_proto.Items.AddRange(new object[] {
"http",
"https",
"tcp"});
this.comboBox_proto.Location = new System.Drawing.Point(77, 41);
this.comboBox_proto.Name = "comboBox_proto";
this.comboBox_proto.Size = new System.Drawing.Size(87, 20);
this.comboBox_proto.TabIndex = 7;
this.comboBox_proto.TextChanged += new System.EventHandler(this.comboBox_proto_TextChanged);
//
// textBox_serverPort
//
this.textBox_serverPort.Location = new System.Drawing.Point(77, 121);
this.textBox_serverPort.MaxLength = 5;
this.textBox_serverPort.Name = "textBox_serverPort";
this.textBox_serverPort.Size = new System.Drawing.Size(87, 21);
this.textBox_serverPort.TabIndex = 8;
//
// textBox_subdomain
//
this.textBox_subdomain.Location = new System.Drawing.Point(77, 67);
this.textBox_subdomain.MaxLength = 10;
this.textBox_subdomain.Name = "textBox_subdomain";
this.textBox_subdomain.Size = new System.Drawing.Size(87, 21);
this.textBox_subdomain.TabIndex = 9;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(167, 17);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(47, 12);
this.label6.TabIndex = 10;
this.label6.Text = "(2-5位)";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(167, 70);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 12);
this.label7.TabIndex = 11;
this.label7.Text = "(2-10位)";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(167, 97);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(59, 12);
this.label8.TabIndex = 12;
this.label8.Text = "(1-65535)";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(167, 124);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(59, 12);
this.label9.TabIndex = 13;
this.label9.Text = "(1-65535)";
//
// groupBox_tunnel
//
this.groupBox_tunnel.Controls.Add(this.label7);
this.groupBox_tunnel.Controls.Add(this.label9);
this.groupBox_tunnel.Controls.Add(this.label6);
this.groupBox_tunnel.Controls.Add(this.label8);
this.groupBox_tunnel.Controls.Add(this.textBox_subdomain);
this.groupBox_tunnel.Controls.Add(this.textBox_serverPort);
this.groupBox_tunnel.Controls.Add(this.comboBox_proto);
this.groupBox_tunnel.Controls.Add(this.textBox_localPort);
this.groupBox_tunnel.Controls.Add(this.label5);
this.groupBox_tunnel.Controls.Add(this.label4);
this.groupBox_tunnel.Controls.Add(this.label3);
this.groupBox_tunnel.Controls.Add(this.label2);
this.groupBox_tunnel.Controls.Add(this.label1);
this.groupBox_tunnel.Controls.Add(this.textBox_symbol);
this.groupBox_tunnel.Location = new System.Drawing.Point(5, 7);
this.groupBox_tunnel.Name = "groupBox_tunnel";
this.groupBox_tunnel.Size = new System.Drawing.Size(244, 149);
this.groupBox_tunnel.TabIndex = 14;
this.groupBox_tunnel.TabStop = false;
this.groupBox_tunnel.Text = "Tunnel";
//
// button_confirm
//
this.button_confirm.Location = new System.Drawing.Point(139, 162);
this.button_confirm.Name = "button_confirm";
this.button_confirm.Size = new System.Drawing.Size(58, 25);
this.button_confirm.TabIndex = 15;
this.button_confirm.Text = "确定";
this.button_confirm.UseVisualStyleBackColor = true;
this.button_confirm.Click += new System.EventHandler(this.button_confirm_Click);
//
// button_cancel
//
this.button_cancel.Location = new System.Drawing.Point(57, 162);
this.button_cancel.Name = "button_cancel";
this.button_cancel.Size = new System.Drawing.Size(59, 25);
this.button_cancel.TabIndex = 16;
this.button_cancel.Text = "取消";
this.button_cancel.UseVisualStyleBackColor = true;
this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
//
// Form_tunnelEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(254, 198);
this.Controls.Add(this.button_cancel);
this.Controls.Add(this.button_confirm);
this.Controls.Add(this.groupBox_tunnel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::net.nutcore.aliddns.Properties.Resources.alidns;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form_tunnelEdit";
this.Text = "编辑";
this.Load += new System.EventHandler(this.Form_tunnelEdit_Load);
this.groupBox_tunnel.ResumeLayout(false);
this.groupBox_tunnel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.TextBox textBox_symbol;
public System.Windows.Forms.TextBox textBox_localPort;
public System.Windows.Forms.ComboBox comboBox_proto;
public System.Windows.Forms.TextBox textBox_serverPort;
public System.Windows.Forms.TextBox textBox_subdomain;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
public System.Windows.Forms.GroupBox groupBox_tunnel;
private System.Windows.Forms.Button button_confirm;
private System.Windows.Forms.Button button_cancel;
}
}

View File

@ -0,0 +1,92 @@
using System;
using System.Windows.Forms;
namespace net.nutcore.aliddns
{
public partial class Form_tunnelEdit : Form
{
public int tunnelIndex;
public string tunnelMode;
public Form_tunnelEdit()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterParent; //在调用本窗体前需使用tunnel.Owner=this;为本窗体指定Parent
}
private void Form_tunnelEdit_Load(object sender, EventArgs e)
{
}
private void button_confirm_Click(object sender, EventArgs e)
{
if (textBox_symbol.Text == "" || comboBox_proto.Text == "" || textBox_localPort.Text == "")
{
MessageBox.Show("录入参数出错,请检查录入。\r\n1、英文标识应为2-5位英文\r\n2、网络协议应在http、https、tcp中三选一\r\n3、域名应为2-5位英文\r\n4、当网络协议为tcp时域名可以为空\r\n5、网络端口应为1-65535之间正整数",
"提示",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
return;
}
Form_main mainform = (Form_main)this.Owner;
mainform.listView_ngrok.BeginUpdate();
if(tunnelMode == "addNew")
{
ListViewItem item = mainform.listView_ngrok.Items.Add((tunnelIndex + 1).ToString());
item.SubItems.Add(textBox_symbol.Text);
item.SubItems.Add(comboBox_proto.Text);
item.SubItems.Add(textBox_localPort.Text);
item.SubItems.Add(textBox_serverPort.Text);
item.SubItems.Add(textBox_subdomain.Text);
item.EnsureVisible();
mainform.textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "网络穿透隧道添加成功!" + "\r\n");
}
else
{
if (mainform.listView_ngrok.SelectedItems.Count > 0)
{
mainform.listView_ngrok.SelectedItems[0].SubItems[1].Text = textBox_symbol.Text;
mainform.listView_ngrok.SelectedItems[0].SubItems[2].Text = comboBox_proto.Text;
mainform.listView_ngrok.SelectedItems[0].SubItems[3].Text = textBox_localPort.Text;
mainform.listView_ngrok.SelectedItems[0].SubItems[4].Text = textBox_serverPort.Text;
mainform.listView_ngrok.SelectedItems[0].SubItems[5].Text = textBox_subdomain.Text;
mainform.textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "网络穿透隧道修改成功!" + "\r\n");
}
}
mainform.listView_ngrok.EndUpdate();
this.Dispose();
}
private void button_cancel_Click(object sender, EventArgs e)
{
this.Dispose();
}
private void comboBox_proto_TextChanged(object sender, EventArgs e)
{
if (comboBox_proto.Text == "tcp")
{
textBox_subdomain.Enabled = false;
textBox_subdomain.Text = null;
}
else
{
textBox_subdomain.Enabled = true;
}
if (comboBox_proto.Text == "http" || comboBox_proto.Text == "https")
{
textBox_serverPort.Enabled = false;
textBox_serverPort.Text = null;
}
else
{
textBox_serverPort.Enabled = true;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -4,7 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using YamlDotNet.Serialization;
@ -12,12 +11,31 @@ namespace net.nutcore.aliddns
{
internal class NgrokHelper
{
private static readonly string NgrokExecutable = "ngrok.exe";
private static readonly string NgrokYamlConfig = "ngrok.cfg";
public static readonly string CurrentDirectory = Path.GetDirectoryName(Application.ExecutablePath);
public static readonly string FileNgrokExecutable = Path.Combine(CurrentDirectory, NgrokExecutable);
public static readonly string FileConfig = Path.Combine(CurrentDirectory, NgrokYamlConfig);
private static string LocalHost = "localhost:4040";
private static readonly string ngrokExecutable = "ngrok.exe";
private static readonly string ngrokYamlConfig = "ngrok.cfg";
public static readonly string currentDirectory = Path.GetDirectoryName(Application.ExecutablePath);
public static readonly string ngrokExecutableFile = Path.Combine(currentDirectory, ngrokExecutable);
public static readonly string ngrokConfigFile = Path.Combine(currentDirectory, ngrokYamlConfig);
private static string localHost = "localhost:4040";
public Config ngrokConfig = new Config();
public NgrokHelper()
{
if (!File.Exists(ngrokConfigFile))
{
this.CreateDefaultConfig(ngrokConfigFile);
this.Load();
}
else
{
FileInfo filereader = new FileInfo(ngrokConfigFile);
if (filereader.Length == 0)
{
this.CreateDefaultConfig(ngrokConfigFile);
}
this.Load();
}
}
public class Config
{
@ -32,24 +50,21 @@ namespace net.nutcore.aliddns
public bool trust_host_root_certs { get; set; }
public bool run_website { get; set; }
public bool run_tcp { get; set; }
public Tunnel tunnels { get; set; }
//public Tunnel tunnels { get; set; }
public object tunnels { get; set; }
}
public class Tunnel
{
public Protocol website_http { get; set; }
public Protocol website_https { get; set; }
public Protocol tcp1 { get; set; }
public Protocol tcp2 { get; set; }
public Protocol tcp3 { get; set; }
public Protocol tcp4 { get; set; }
public Protocol weisite { get; set; }
public Protocol tcp { get; set; }
}
public class Protocol
{
public string subdomain { get; set; }
public int remote_port { get; set; }
public Proto proto { get; set; }
public int remote_port { get; set; }
public string subdomain { get; set; }
public string auth { get; set; }
}
@ -72,86 +87,36 @@ namespace net.nutcore.aliddns
public string proto { get; set; }
}
public NgrokHelper()
public void CreateDefaultConfig(String ngrokConfigFile)
{
if (!File.Exists(FileConfig))
{
var config = new Config
{
authtoken = string.Empty,
server_addr = "tunnels.ngrok.io:4443",
console_ui = true,
region = "us",
log_level = "info",
log_format = "logfmt",
log = "ngrok.log",
web_addr = LocalHost,
trust_host_root_certs = false,
run_website = true,
run_tcp = true,
tunnels = new Tunnel
{
website_http = new Protocol
{
subdomain = "subdomain",
proto = new Proto
{
http = 80
}
var config = new Config();
config.authtoken = string.Empty;
config.server_addr = "tunnels.ngrok.io:4443";
config.console_ui = true;
config.region = "us";
config.log_level = "info";
config.log_format = "logfmt";
config.log = "ngrok.log";
config.web_addr = "localhost:4040";
config.trust_host_root_certs = false;
config.run_website = true;
config.run_tcp = true;
Protocol tunnel0 = new Protocol { proto = new Proto { http = 80 }, subdomain = "web1" };
Protocol tunnel1 = new Protocol { proto = new Proto { https = 443 }, subdomain = "web1" };
Protocol tunnel2 = new Protocol { proto = new Proto { tcp = 21 }, remote_port = 8021 };
Protocol tunnel3 = new Protocol { proto = new Proto { tcp = 3306 }, remote_port = 8306 };
Protocol tunnel4 = new Protocol { proto = new Proto { tcp = 3389 }, remote_port = 8389 };
Protocol tunnel5 = new Protocol { proto = new Proto { tcp = 9000 }, remote_port = 8900 };
config.tunnels = new { item0 = tunnel0, item1 = tunnel1, item2 = tunnel2, item3 = tunnel3, item4 = tunnel4, item5 = tunnel5 };
},
website_https = new Protocol
{
subdomain = "subdomain",
proto = new Proto
{
https = 443
}
},
tcp1 = new Protocol
{
remote_port = 10001,
proto = new Proto
{
tcp = 21
}
},
tcp2 = new Protocol
{
remote_port = 10002,
proto = new Proto
{
tcp = 22
}
},
tcp3 = new Protocol
{
remote_port = 10003,
proto = new Proto
{
tcp = 3389
}
},
tcp4 = new Protocol
{
remote_port = 10099,
proto = new Proto
{
tcp = 9000
}
}
}
};
var serializer = new SerializerBuilder().Build();
var yaml = serializer.Serialize(config);
File.WriteAllText(FileConfig, yaml);
}
var serializer = new SerializerBuilder().Build();
var yaml = serializer.Serialize(config);
File.WriteAllText(ngrokConfigFile, yaml);
}
public bool IsExists()
{
return File.Exists(FileNgrokExecutable);
return File.Exists(ngrokExecutableFile);
}
public Response GetResponse()
@ -160,7 +125,7 @@ namespace net.nutcore.aliddns
{
using (WebClient web = new WebClient())
{
var content = web.DownloadString($"http://{LocalHost}/api/tunnels");
var content = web.DownloadString($"http://{localHost}/api/tunnels");
return JsonConvert.DeserializeObject<NgrokHelper.Response>(content);
}
}
@ -170,77 +135,28 @@ namespace net.nutcore.aliddns
}
}
public Config Load()
public void Load()
{
var yaml = File.ReadAllText(FileConfig);
var deserializer = new DeserializerBuilder().Build();
var config = deserializer.Deserialize<Config>(yaml);
LocalHost = config.web_addr;
return config;
var yaml = File.ReadAllText(ngrokConfigFile);
var deserializer = new Deserializer();
this.ngrokConfig = deserializer.Deserialize<Config>(yaml);
}
public void Save(string token, string server_addr, string subdomain, int http, int https, int remoteport1, int lanport1, int remoteport2, int lanport2, int remoteport3, int lanport3, int remoteport4, int lanport4, bool root_certs, bool run_website, bool run_tcp)
public void Save()
{
var config = Load();
config.authtoken = token;
config.server_addr = server_addr;
config.tunnels.website_http.subdomain = subdomain;
config.tunnels.website_http.proto.http = http;
config.tunnels.website_https.subdomain = subdomain;
config.tunnels.website_https.proto.https = https;
config.tunnels.tcp1.remote_port = remoteport1;
config.tunnels.tcp1.proto.tcp = lanport1;
config.tunnels.tcp2.remote_port = remoteport2;
config.tunnels.tcp2.proto.tcp = lanport2;
config.tunnels.tcp3.remote_port = remoteport3;
config.tunnels.tcp3.proto.tcp = lanport3;
config.tunnels.tcp4.remote_port = remoteport4;
config.tunnels.tcp4.proto.tcp = lanport4;
config.trust_host_root_certs = root_certs;
config.run_website = run_website;
config.run_tcp = run_tcp;
var serializer = new SerializerBuilder().Build();
var yaml = serializer.Serialize(config);
File.WriteAllText(FileConfig, yaml);
var yaml = serializer.Serialize(this.ngrokConfig);
File.WriteAllText(ngrokConfigFile, yaml);
}
public void Start(int code = 0)
{
var exec = new ProcessStartInfo();
exec.WorkingDirectory = CurrentDirectory;
exec.FileName = NgrokExecutable;
exec.WorkingDirectory = currentDirectory;
exec.FileName = ngrokExecutable;
exec.CreateNoWindow = true;
exec.UseShellExecute = false;
exec.Arguments = $"-config \"{NgrokYamlConfig}\" start ";
switch (code)
{
case 1:
exec.Arguments += "website_http";
break;
case 2:
exec.Arguments += "website_http website_https";
break;
case 3:
exec.Arguments += "website_http website_https tcp1";
break;
case 4:
exec.Arguments += "website_http website_https tcp1 tcp2";
break;
case 5:
exec.Arguments += "website_http website_https tcp1 tcp2 tcp3";
break;
default:
exec.Arguments += "website_http website_https tcp1 tcp2 tcp3 tcp4";
break;
}
exec.Arguments = $"-config \"{ngrokYamlConfig}\" start-all ";
try
{

View File

@ -25,7 +25,7 @@ namespace net.nutcore.aliddns
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new mainForm());
Application.Run(new Form_main());
}
else
{

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.8.6.7")]
[assembly: AssemblyFileVersion("3.8.6.7")]
[assembly: AssemblyVersion("3.9.0.0")]
[assembly: AssemblyFileVersion("3.9.0.0")]

View File

@ -10,8 +10,9 @@
namespace net.nutcore.aliddns.Properties {
using System;
using System.Drawing;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
@ -45,7 +46,12 @@ namespace net.nutcore.aliddns.Properties {
return resourceMan;
}
}
internal static Icon GetObject(string v)
{
throw new NotImplementedException();
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace net.nutcore.aliddns
{
class Yaml
class YamlHelper
{
// 所有行
private String[] lines;
@ -16,40 +16,50 @@ namespace net.nutcore.aliddns
// 文件所在地址
private String path;
public Yaml(String path)
public YamlHelper(String path)
{
this.path = path;
this.lines = File.ReadAllLines(path);
for (int i = 0; i < lines.Length; i++)
if (!File.Exists(this.path))
{
String line = lines[i];
if (line.Trim() == "")
StreamWriter stream = File.CreateText(this.path);
stream.Flush();
stream.Close();
}
else
{
this.lines = File.ReadAllLines(path);
for (int i = 0; i < lines.Length; i++)
{
Console.WriteLine("空白行,行号:" + (i + 1));
continue;
}
else if (line.Trim().Substring(0, 1) == "#")
{
Console.WriteLine("注释行,行号:" + (i + 1));
continue;
String line = lines[i];
if (line.Trim() == "")
{
Console.WriteLine("空白行,行号:" + (i + 1));
continue;
}
else if (line.Trim().Substring(0, 1) == "#")
{
Console.WriteLine("注释行,行号:" + (i + 1));
continue;
}
String[] kv = Regex.Split(line, ":", RegexOptions.IgnoreCase);
findPreSpace(line);
Node node = new Node();
node.space = findPreSpace(line);
node.name = kv[0].Trim();
// 去除前后空白符
String fline = line.Trim();
int first = fline.IndexOf(':');
node.value = first == fline.Length - 1 ? null : fline.Substring(first + 2, fline.Length - first - 2);
node.parent = findParent(node.space);
nodeList.Add(node);
}
String[] kv = Regex.Split(line, ":", RegexOptions.IgnoreCase);
findPreSpace(line);
Node node = new Node();
node.space = findPreSpace(line);
node.name = kv[0].Trim();
// 去除前后空白符
String fline = line.Trim();
int first = fline.IndexOf(':');
node.value = first == fline.Length - 1 ? null : fline.Substring(first + 2, fline.Length - first - 2);
node.parent = findParent(node.space);
nodeList.Add(node);
this.formatting();
}
this.formatting();
}
// 修改值 允许key为多级 例如spring.datasource.url

View File

@ -89,20 +89,14 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AppConfigHelper.cs" />
<Compile Include="Form_tunnelEdit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form_tunnelEdit.Designer.cs">
<DependentUpon>Form_tunnelEdit.cs</DependentUpon>
</Compile>
<Compile Include="YamlHelper.cs" />
<Compile Include="EncryptHelper.cs" />
<Compile Include="Form_About.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form_About.Designer.cs">
<DependentUpon>Form_About.cs</DependentUpon>
</Compile>
<Compile Include="Form_ngrok.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form_ngrok.Designer.cs">
<DependentUpon>Form_ngrok.cs</DependentUpon>
</Compile>
<Compile Include="Form_main.cs">
<SubType>Form</SubType>
</Compile>
@ -112,11 +106,8 @@
<Compile Include="NgrokHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form_About.resx">
<DependentUpon>Form_About.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form_ngrok.resx">
<DependentUpon>Form_ngrok.cs</DependentUpon>
<EmbeddedResource Include="Form_tunnelEdit.resx">
<DependentUpon>Form_tunnelEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form_main.resx">
<DependentUpon>Form_main.cs</DependentUpon>

View File

@ -1,128 +1,277 @@
v3.9.0.0
1、重新设计窗口标签布局。
2、扩展ngrok功能能添加更多穿透项目。
v3.8.6.7
1、增加一个tunnel端口。2、跳过v3.8.6.6对配置文件读写优化。
1、增加一个tunnel端口。
2、跳过v3.8.6.6对配置文件读写优化。
v3.8.6.5
1、增加ngrok https穿透。
v3.8.6.4
1、当Ngrok选项被选定时IP地址更新后Ngrok穿透功能自动重启避免IP地址更新后Ngrok穿透失效。
v3.8.6.3
1、修改测试存储逻辑锁定Recordid编辑框避免添加域名成功后手工修改造成配置文件存储Recordid与服务器不一致时造成的自动更新出错。
v3.8.6.2
1、修复配置文件参数TTL和WaitingTime写入BUG。2、增加更新逻辑当获取WAN口IP返回0.0.0.0时不更新阿里云DNS记录提示手工修改。
1、修复配置文件参数TTL和WaitingTime写入BUG。
2、增加更新逻辑当获取WAN口IP返回0.0.0.0时不更新阿里云DNS记录提示手工修改。
v3.8.6.1
1、细化xp运行时多线程出错异常处理代码避免程序崩溃。2、锁定recordId控件避免新手随意修改造成的错误。
1、细化xp运行时多线程出错异常处理代码避免程序崩溃。
2、锁定recordId控件避免新手随意修改造成的错误。
v3.8.6.0
1、修改代码.net框架版本由4.5降低到4.0可在WinXP系统运行WinXP系统最高支持.net 4.0。
v3.8.5.0
1、设置修改实时保存。2、可添加多个公网IP网址自动运行是逐个查询当有返回值时停止。3、简化代码。
1、设置修改实时保存。
2、可添加多个公网IP网址自动运行是逐个查询当有返回值时停止。
3、简化代码。
v3.8.4.8
1、实现实时更新配置文件。2、调整简化代码实现。3、DEBUG...
1、实现实时更新配置文件。
2、调整简化代码实现。
3、DEBUG...
v3.8.4.1
1、配置文件操作优化中...
v3.8.4.0
1、增加Ngrok网络穿透功能。2、调整倒计时控件宽度修复当倒计时超过3位时被遮挡的问题。3、精简代码。
1、增加Ngrok网络穿透功能。
2、调整倒计时控件宽度修复当倒计时超过3位时被遮挡的问题。
3、精简代码。
v3.8.3.5
1、最近Teamviewer老是出状况先实现ngrok吧。2、自动升级功能继续调试中...。
1、最近Teamviewer老是出状况先实现ngrok吧。
2、自动升级功能继续调试中...。
v3.8.3.0
1、增加自动升级检测功能ing...。2、修复BUG。
1、增加自动升级检测功能ing...。
2、修复BUG。
v3.8.2.1
1、增加角色权限检测。2、更多功能日志输出。
1、增加角色权限检测。
2、更多功能日志输出。
v3.8.1.0
1、在配置文件中对accessKeyId和accessKeySecret进行加密存储。注意现有配置文件中未加密参数将失效。
v3.8.0.0
1、增加TTL参数。2、修复代码BUG。
1、增加TTL参数。
2、修复代码BUG。
v3.7.1.7
1、修补BUG。2、调整关于窗体属性。
1、修补BUG。
2、调整关于窗体属性。
v3.7.1.6
1、调整系统托盘图标刷新监测逻辑减少监测次数减少刷新频率。
v3.7.1.5
1、调整代码逻辑修复BUG。
v3.7.1.2
1、简化系统托盘图标刷新状态监测代码。
v3.7.1.1
1、修复系统托盘图标刷新BUG。
v3.7.1.0
1、增加系统托盘图标状态更新功能红色-获取WAN口IP或者获取域名绑定IP失败。黄色-获取成功但WAN口IP和域名绑定IP不一致。绿色-获取成功WAN口IP和域名绑定IP一致。灰色-WAN口网络不通。
2、修改代码和窗体标签刷新BUG。
v3.7.0.4
1、增加根据连接状态刷新系统托盘图标功能。
v3.7.0.3
1、增加线程判断代码确保当前用户只运行一个实例避免程序重复运行。
v3.7.0.2
1、优化配置文件读取和初始化代码避免配置文件读取出错时程序运行不正常。
v3.7.0.1
1、修复窗体布局修改造成的功能实现失常的BUG。2、代码中增加手工输入IP时的格式校验。
1、修复窗体布局修改造成的功能实现失常的BUG。
2、代码中增加手工输入IP时的格式校验。
v3.7.0
1、版本修改为v3.7.0.0。2、增加手工指定IP功能当从网址不能获取WAN口IP时作为临时救急功能。
1、版本修改为v3.7.0.0。
2、增加手工指定IP功能当从网址不能获取WAN口IP时作为临时救急功能。
v3.6.1.1
1、系统托盘右键菜单“关于”窗体增加升级信息浏览功能。
v3.6.0.1
1、调整WAN口IP获取功能使用正则表达式过滤http返回信息从中查找xxx.xxx.xxx.xxx格式的数字作为WAN口IP返回使用范围更广。2、增加万网网址作为IP查询地址。
1、调整WAN口IP获取功能使用正则表达式过滤http返回信息从中查找xxx.xxx.xxx.xxx格式的数字作为WAN口IP返回使用范围更广。
2、增加万网网址作为IP查询地址。
v3.6.0
1、版本号修改为3.6.0。
2、增加日志自动转储功能。
3、修复代码BUG。
4、窗体布局微调。
v3.5.0.1
1、版本号更新为3.5.0.1。
2、修复窗体标题栏仍然显示3.2.0的BUG。
3、增加随系统启动功能。
4、增加启动时最小化驻留系统托盘功能。
5、完善当域名不存在时作为新记录添加。
v3.5.0
1、增加随系统启动功能。
2、增加启动时最小化驻留系统托盘功能。
3、完善当域名不存在时作为新记录添加。
4、版本号更新为3.5.0。
v3.4.0
1、修改程序BUG。
2、调整细化功能实现返回日志。
3、将是否自动更新和WAN口IP获取网址作为参数写入配置文件config.xml。
v3.3.0
1、完善设置检测逻辑。
2、域名修改后增加测试提示。
v3.2.0
1、窗体修改布局修改。
2、调整程序功能分别显示WAN口网络状态和域名绑定状态。
3、隐藏录入的Aliyun域名账号信息。
v3.1.0
1、界面调整。
2、源码BUG修改。
3、功能实现细节修改。
v3.0.0
Fork from http://github.com/dtsdao/AliDDNS
1、根据需求进行调整和开发。
初始代码Fork from http://github.com/dtsdao/AliDDNS
阿里云开发者论坛https://bbs.aliyun.com/read/289624.html