add tun mode
This commit is contained in:
9
clashN/clashN/Forms/AddProfileForm.Designer.cs
generated
9
clashN/clashN/Forms/AddProfileForm.Designer.cs
generated
@@ -31,6 +31,7 @@
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddProfileForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddProfileForm));
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.chkEnableTun = new System.Windows.Forms.CheckBox();
|
||||||
this.chkEnabled = new System.Windows.Forms.CheckBox();
|
this.chkEnabled = new System.Windows.Forms.CheckBox();
|
||||||
this.txtUserAgent = new System.Windows.Forms.TextBox();
|
this.txtUserAgent = new System.Windows.Forms.TextBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
@@ -62,6 +63,7 @@
|
|||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.chkEnableTun);
|
||||||
this.groupBox1.Controls.Add(this.chkEnabled);
|
this.groupBox1.Controls.Add(this.chkEnabled);
|
||||||
this.groupBox1.Controls.Add(this.txtUserAgent);
|
this.groupBox1.Controls.Add(this.txtUserAgent);
|
||||||
this.groupBox1.Controls.Add(this.label2);
|
this.groupBox1.Controls.Add(this.label2);
|
||||||
@@ -80,6 +82,12 @@
|
|||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// chkEnableTun
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.chkEnableTun, "chkEnableTun");
|
||||||
|
this.chkEnableTun.Name = "chkEnableTun";
|
||||||
|
this.chkEnableTun.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// chkEnabled
|
// chkEnabled
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.chkEnabled, "chkEnabled");
|
resources.ApplyResources(this.chkEnabled, "chkEnabled");
|
||||||
@@ -217,5 +225,6 @@
|
|||||||
private System.Windows.Forms.TextBox txtUrl;
|
private System.Windows.Forms.TextBox txtUrl;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
private System.Windows.Forms.CheckBox chkEnabled;
|
private System.Windows.Forms.CheckBox chkEnabled;
|
||||||
|
private System.Windows.Forms.CheckBox chkEnableTun;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,7 @@ namespace clashN.Forms
|
|||||||
txtUrl.Text = profileItem.url;
|
txtUrl.Text = profileItem.url;
|
||||||
chkEnabled.Checked = profileItem.enabled;
|
chkEnabled.Checked = profileItem.enabled;
|
||||||
txtUserAgent.Text = profileItem.userAgent;
|
txtUserAgent.Text = profileItem.userAgent;
|
||||||
|
chkEnableTun.Checked = profileItem.enableTun;
|
||||||
|
|
||||||
if (profileItem.coreType == null)
|
if (profileItem.coreType == null)
|
||||||
{
|
{
|
||||||
@@ -86,6 +87,7 @@ namespace clashN.Forms
|
|||||||
profileItem.url = txtUrl.Text.TrimEx();
|
profileItem.url = txtUrl.Text.TrimEx();
|
||||||
profileItem.enabled = chkEnabled.Checked;
|
profileItem.enabled = chkEnabled.Checked;
|
||||||
profileItem.userAgent = txtUserAgent.Text.TrimEx();
|
profileItem.userAgent = txtUserAgent.Text.TrimEx();
|
||||||
|
profileItem.enableTun = chkEnableTun.Checked;
|
||||||
|
|
||||||
if (Utils.IsNullOrEmpty(cmbCoreType.Text))
|
if (Utils.IsNullOrEmpty(cmbCoreType.Text))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,28 +83,61 @@
|
|||||||
<data name=">>btnClose.ZOrder" xml:space="preserve">
|
<data name=">>btnClose.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.AutoSize" type="System.Boolean, mscorlib">
|
<data name="chkEnableTun.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="chkEnableTun.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnableTun.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>261, 266</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="chkEnableTun.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
|
<value>4, 4, 4, 4</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnableTun.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>219, 21</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnableTun.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>49</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnableTun.Text" xml:space="preserve">
|
||||||
|
<value>Enable tun mode (Run As Admin)</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>chkEnableTun.Name" xml:space="preserve">
|
||||||
|
<value>chkEnableTun</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>chkEnableTun.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>chkEnableTun.Parent" xml:space="preserve">
|
||||||
|
<value>groupBox1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>chkEnableTun.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnabled.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
<data name="chkEnabled.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
<data name="chkEnabled.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>274, 267</value>
|
<value>143, 309</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="chkEnabled.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="chkEnabled.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>4, 4, 4, 4</value>
|
<value>4, 4, 4, 4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>66, 21</value>
|
<value>188, 21</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.TabIndex" type="System.Int32, mscorlib">
|
<data name="chkEnabled.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>48</value>
|
<value>48</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.Text" xml:space="preserve">
|
<data name="chkEnabled.Text" xml:space="preserve">
|
||||||
<value>Enable</value>
|
<value>Enable Update subscription</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnabled.Name" xml:space="preserve">
|
<data name=">>chkEnabled.Name" xml:space="preserve">
|
||||||
<value>chkEnabled</value>
|
<value>chkEnabled</value>
|
||||||
@@ -116,7 +149,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnabled.ZOrder" xml:space="preserve">
|
<data name=">>chkEnabled.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtUserAgent.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="txtUserAgent.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>143, 222</value>
|
<value>143, 222</value>
|
||||||
@@ -140,7 +173,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtUserAgent.ZOrder" xml:space="preserve">
|
<data name=">>txtUserAgent.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -173,7 +206,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||||
<value>2</value>
|
<value>3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>143, 62</value>
|
<value>143, 62</value>
|
||||||
@@ -203,7 +236,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtUrl.ZOrder" xml:space="preserve">
|
<data name=">>txtUrl.ZOrder" xml:space="preserve">
|
||||||
<value>3</value>
|
<value>4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -236,7 +269,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label3.ZOrder" xml:space="preserve">
|
<data name=">>label3.ZOrder" xml:space="preserve">
|
||||||
<value>4</value>
|
<value>5</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnEdit.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
<data name="btnEdit.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
@@ -263,7 +296,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnEdit.ZOrder" xml:space="preserve">
|
<data name=">>btnEdit.ZOrder" xml:space="preserve">
|
||||||
<value>5</value>
|
<value>6</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="cmbCoreType.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="cmbCoreType.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>143, 264</value>
|
<value>143, 264</value>
|
||||||
@@ -284,7 +317,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>cmbCoreType.ZOrder" xml:space="preserve">
|
<data name=">>cmbCoreType.ZOrder" xml:space="preserve">
|
||||||
<value>6</value>
|
<value>7</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="labCoreType.AutoSize" type="System.Boolean, mscorlib">
|
<data name="labCoreType.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -314,7 +347,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>labCoreType.ZOrder" xml:space="preserve">
|
<data name=">>labCoreType.ZOrder" xml:space="preserve">
|
||||||
<value>7</value>
|
<value>8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnBrowse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
<data name="btnBrowse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
@@ -341,7 +374,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnBrowse.ZOrder" xml:space="preserve">
|
<data name=">>btnBrowse.ZOrder" xml:space="preserve">
|
||||||
<value>8</value>
|
<value>9</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtAddress.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="txtAddress.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>143, 123</value>
|
<value>143, 123</value>
|
||||||
@@ -365,7 +398,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtAddress.ZOrder" xml:space="preserve">
|
<data name=">>txtAddress.ZOrder" xml:space="preserve">
|
||||||
<value>9</value>
|
<value>10</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -392,7 +425,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label13.ZOrder" xml:space="preserve">
|
<data name=">>label13.ZOrder" xml:space="preserve">
|
||||||
<value>10</value>
|
<value>11</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>143, 23</value>
|
<value>143, 23</value>
|
||||||
@@ -413,7 +446,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtRemarks.ZOrder" xml:space="preserve">
|
<data name=">>txtRemarks.ZOrder" xml:space="preserve">
|
||||||
<value>11</value>
|
<value>12</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -440,7 +473,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label6.ZOrder" xml:space="preserve">
|
<data name=">>label6.ZOrder" xml:space="preserve">
|
||||||
<value>12</value>
|
<value>13</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -467,7 +500,7 @@
|
|||||||
<value>groupBox1</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||||
<value>13</value>
|
<value>14</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
@@ -496,18 +529,6 @@
|
|||||||
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>357, 17</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>75, 23</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.Text" xml:space="preserve">
|
|
||||||
<value>&OK</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>btnOK.Name" xml:space="preserve">
|
<data name=">>btnOK.Name" xml:space="preserve">
|
||||||
<value>btnOK</value>
|
<value>btnOK</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -544,6 +565,30 @@
|
|||||||
<data name=">>panel2.ZOrder" xml:space="preserve">
|
<data name=">>panel2.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>357, 17</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>75, 23</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>5</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.Text" xml:space="preserve">
|
||||||
|
<value>&OK</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Name" xml:space="preserve">
|
||||||
|
<value>btnOK</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Parent" xml:space="preserve">
|
||||||
|
<value>panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Top</value>
|
<value>Top</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,4 +1,64 @@
|
|||||||
<root>
|
<?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
@@ -68,7 +128,7 @@
|
|||||||
<value>51, 21</value>
|
<value>51, 21</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnabled.Text" xml:space="preserve">
|
<data name="chkEnabled.Text" xml:space="preserve">
|
||||||
<value>启用</value>
|
<value>启用更新订阅</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>79, 17</value>
|
<value>79, 17</value>
|
||||||
@@ -112,4 +172,7 @@
|
|||||||
<data name="$this.Text" xml:space="preserve">
|
<data name="$this.Text" xml:space="preserve">
|
||||||
<value>配置文件</value>
|
<value>配置文件</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chkEnableTun.Text" xml:space="preserve">
|
||||||
|
<value>启用 tun 模式 (以管理员身份运行)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -35,7 +35,7 @@ namespace clashN.Forms
|
|||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.WindowState = FormWindowState.Minimized;
|
this.WindowState = FormWindowState.Minimized;
|
||||||
HideForm();
|
HideForm();
|
||||||
this.Text = Utils.GetVersion();
|
this.Text = Utils.GetVersion(); //Utils.IsAdministrator();
|
||||||
Global.processJob = new Job();
|
Global.processJob = new Job();
|
||||||
|
|
||||||
Application.ApplicationExit += (sender, args) =>
|
Application.ApplicationExit += (sender, args) =>
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace clashN.Handler
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
class CoreConfigHandler
|
class CoreConfigHandler
|
||||||
{
|
{
|
||||||
|
private static string SampleTun = "clashN.Sample.SampleTun.yaml";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成配置文件
|
/// 生成配置文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -74,6 +76,11 @@ namespace clashN.Handler
|
|||||||
|
|
||||||
var config = LazyConfig.Instance.GetConfig();
|
var config = LazyConfig.Instance.GetConfig();
|
||||||
var fileContent = Utils.FromYaml<Dictionary<string, object>>(File.ReadAllText(fileName));
|
var fileContent = Utils.FromYaml<Dictionary<string, object>>(File.ReadAllText(fileName));
|
||||||
|
if (fileContent == null)
|
||||||
|
{
|
||||||
|
msg = ResUI.FailedGenDefaultConfiguration;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
//port
|
//port
|
||||||
ModifyContent(fileContent, "port", config.httpPort);
|
ModifyContent(fileContent, "port", config.httpPort);
|
||||||
//socks-port
|
//socks-port
|
||||||
@@ -93,6 +100,17 @@ namespace clashN.Handler
|
|||||||
ModifyContent(fileContent, "allow-lan", "false");
|
ModifyContent(fileContent, "allow-lan", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//enable tun mode
|
||||||
|
if (node.enableTun)
|
||||||
|
{
|
||||||
|
string tun = Utils.GetEmbedText(SampleTun);
|
||||||
|
if (!Utils.IsNullOrEmpty(tun))
|
||||||
|
{
|
||||||
|
var tunContent = Utils.FromYaml<Dictionary<string, object>>(tun);
|
||||||
|
ModifyContent(fileContent, "tun", tunContent["tun"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File.WriteAllText(fileName, Utils.ToYaml(fileContent));
|
File.WriteAllText(fileName, Utils.ToYaml(fileContent));
|
||||||
|
|
||||||
msg = string.Format(ResUI.SuccessfulConfiguration, $"{node.GetSummary()}");
|
msg = string.Format(ResUI.SuccessfulConfiguration, $"{node.GetSummary()}");
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace clashN.Handler
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowMsg(true, msg);
|
ShowMsg(true, msg);
|
||||||
CoreRestart();
|
CoreRestart(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,10 +57,10 @@ namespace clashN.Handler
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Core重启
|
/// Core重启
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CoreRestart()
|
private void CoreRestart(ProfileItem item)
|
||||||
{
|
{
|
||||||
CoreStop();
|
CoreStop();
|
||||||
CoreStart();
|
CoreStart(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -159,7 +159,7 @@ namespace clashN.Handler
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Core启动
|
/// Core启动
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CoreStart()
|
private void CoreStart(ProfileItem item)
|
||||||
{
|
{
|
||||||
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
|
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
|
||||||
|
|
||||||
@@ -182,6 +182,10 @@ namespace clashN.Handler
|
|||||||
StandardOutputEncoding = Encoding.UTF8
|
StandardOutputEncoding = Encoding.UTF8
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (item.enableTun)
|
||||||
|
{
|
||||||
|
p.StartInfo.Verb = "runas";
|
||||||
|
}
|
||||||
p.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
|
p.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(e.Data))
|
if (!String.IsNullOrEmpty(e.Data))
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace clashN.Mode
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region function
|
#region function
|
||||||
|
|
||||||
public int FindIndexId(string id)
|
public int FindIndexId(string id)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
@@ -113,6 +113,7 @@ namespace clashN.Mode
|
|||||||
remarks = string.Empty;
|
remarks = string.Empty;
|
||||||
testResult = string.Empty;
|
testResult = string.Empty;
|
||||||
groupId = string.Empty;
|
groupId = string.Empty;
|
||||||
|
enableTun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region function
|
#region function
|
||||||
@@ -173,6 +174,8 @@ namespace clashN.Mode
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
} = string.Empty;
|
} = string.Empty;
|
||||||
|
|
||||||
|
public bool enableTun { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|||||||
6
clashN/clashN/Sample/SampleTun.yaml
Normal file
6
clashN/clashN/Sample/SampleTun.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
tun:
|
||||||
|
enable: true
|
||||||
|
stack: gvisor
|
||||||
|
dns-hijack:
|
||||||
|
- 0.0.0.0:53
|
||||||
|
auto-route: true
|
||||||
@@ -88,6 +88,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="clashN.ico" />
|
<Content Include="clashN.ico" />
|
||||||
<Content Include="Resources\help.png" />
|
<Content Include="Resources\help.png" />
|
||||||
|
<EmbeddedResource Include="Sample\SampleTun.yaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="log4net">
|
<PackageReference Include="log4net">
|
||||||
@@ -108,6 +109,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Remove="Sample\SampleTun.yaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
|||||||
@@ -47,6 +47,9 @@
|
|||||||
<EmbeddedResource Update="Forms\AddProfileForm.resx">
|
<EmbeddedResource Update="Forms\AddProfileForm.resx">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Forms\AddProfileForm.zh-Hans.resx">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Forms\MainForm.resx">
|
<EmbeddedResource Update="Forms\MainForm.resx">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
Reference in New Issue
Block a user