@@ -1,4 +1,5 @@ | |||
using Shadowsocks.Controller; | |||
using Shadowsocks.View; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Drawing; | |||
@@ -116,5 +117,21 @@ namespace Shadowsocks.Util | |||
graphics.Dispose(); | |||
return dpi; | |||
} | |||
public static string InputBox(string Prompt, string Title = "", string DefaultResponse = "", int XPos = -1, int YPos = -1) | |||
{ | |||
var result = DefaultResponse; | |||
var box = new InputBox() | |||
{ | |||
Prompt = Prompt, | |||
Text = Title ?? "Input", | |||
Response = DefaultResponse | |||
}; | |||
if (box.ShowDialog()== DialogResult.OK) | |||
{ | |||
result = box.Response; | |||
} | |||
return result; | |||
} | |||
} | |||
} |
@@ -28,80 +28,81 @@ | |||
/// </summary> | |||
private void InitializeComponent() | |||
{ | |||
this.factorNum = new System.Windows.Forms.NumericUpDown(); | |||
this.multiply = new System.Windows.Forms.Label(); | |||
this.plus = new System.Windows.Forms.Label(); | |||
this.valueLabel = new System.Windows.Forms.Label(); | |||
((System.ComponentModel.ISupportInitialize)(this.factorNum)).BeginInit(); | |||
this.SuspendLayout(); | |||
// | |||
// factorNum | |||
// | |||
this.factorNum.DecimalPlaces = 2; | |||
this.factorNum.Dock = System.Windows.Forms.DockStyle.Right; | |||
this.factorNum.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.factorNum.Increment = new decimal(new int[] { | |||
1, | |||
0, | |||
0, | |||
131072}); | |||
this.factorNum.Location = new System.Drawing.Point(236, 0); | |||
this.factorNum.Minimum = new decimal(new int[] { | |||
1000, | |||
0, | |||
0, | |||
-2147418112}); | |||
this.factorNum.Name = "factorNum"; | |||
this.factorNum.Size = new System.Drawing.Size(86, 34); | |||
this.factorNum.TabIndex = 6; | |||
// | |||
// multiply | |||
// | |||
this.multiply.AutoSize = true; | |||
this.multiply.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.multiply.Location = new System.Drawing.Point(202, 2); | |||
this.multiply.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); | |||
this.multiply.Name = "multiply"; | |||
this.multiply.Size = new System.Drawing.Size(26, 28); | |||
this.multiply.TabIndex = 2; | |||
this.multiply.Text = "×"; | |||
// | |||
// plus | |||
// | |||
this.plus.AutoSize = true; | |||
this.plus.Font = new System.Drawing.Font("Segoe UI", 10F); | |||
this.plus.Location = new System.Drawing.Point(5, 2); | |||
this.plus.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); | |||
this.plus.Name = "plus"; | |||
this.plus.Size = new System.Drawing.Size(26, 28); | |||
this.plus.TabIndex = 3; | |||
this.plus.Text = "+"; | |||
// | |||
// valueLabel | |||
// | |||
this.valueLabel.AutoSize = true; | |||
this.valueLabel.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.valueLabel.Location = new System.Drawing.Point(39, 6); | |||
this.valueLabel.Name = "valueLabel"; | |||
this.valueLabel.Size = new System.Drawing.Size(118, 24); | |||
this.valueLabel.TabIndex = 7; | |||
this.valueLabel.Text = "PackageLoss"; | |||
// | |||
// CalculationControl | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.Controls.Add(this.valueLabel); | |||
this.Controls.Add(this.factorNum); | |||
this.Controls.Add(this.multiply); | |||
this.Controls.Add(this.plus); | |||
this.Margin = new System.Windows.Forms.Padding(0); | |||
this.Name = "CalculationControl"; | |||
this.Size = new System.Drawing.Size(322, 34); | |||
((System.ComponentModel.ISupportInitialize)(this.factorNum)).EndInit(); | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
this.factorNum = new System.Windows.Forms.NumericUpDown(); | |||
this.multiply = new System.Windows.Forms.Label(); | |||
this.plus = new System.Windows.Forms.Label(); | |||
this.valueLabel = new System.Windows.Forms.Label(); | |||
((System.ComponentModel.ISupportInitialize)(this.factorNum)).BeginInit(); | |||
this.SuspendLayout(); | |||
// | |||
// factorNum | |||
// | |||
this.factorNum.DecimalPlaces = 2; | |||
this.factorNum.Dock = System.Windows.Forms.DockStyle.Right; | |||
this.factorNum.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.factorNum.Increment = new decimal(new int[] { | |||
1, | |||
0, | |||
0, | |||
131072}); | |||
this.factorNum.Location = new System.Drawing.Point(210, 0); | |||
this.factorNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); | |||
this.factorNum.Minimum = new decimal(new int[] { | |||
1000, | |||
0, | |||
0, | |||
-2147418112}); | |||
this.factorNum.Name = "factorNum"; | |||
this.factorNum.Size = new System.Drawing.Size(76, 30); | |||
this.factorNum.TabIndex = 6; | |||
// | |||
// multiply | |||
// | |||
this.multiply.AutoSize = true; | |||
this.multiply.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.multiply.Location = new System.Drawing.Point(180, 2); | |||
this.multiply.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.multiply.Name = "multiply"; | |||
this.multiply.Size = new System.Drawing.Size(22, 23); | |||
this.multiply.TabIndex = 2; | |||
this.multiply.Text = "×"; | |||
// | |||
// plus | |||
// | |||
this.plus.AutoSize = true; | |||
this.plus.Font = new System.Drawing.Font("Segoe UI", 10F); | |||
this.plus.Location = new System.Drawing.Point(4, 2); | |||
this.plus.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); | |||
this.plus.Name = "plus"; | |||
this.plus.Size = new System.Drawing.Size(22, 23); | |||
this.plus.TabIndex = 3; | |||
this.plus.Text = "+"; | |||
// | |||
// valueLabel | |||
// | |||
this.valueLabel.AutoSize = true; | |||
this.valueLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
this.valueLabel.Location = new System.Drawing.Point(35, 4); | |||
this.valueLabel.Name = "valueLabel"; | |||
this.valueLabel.Size = new System.Drawing.Size(101, 20); | |||
this.valueLabel.TabIndex = 7; | |||
this.valueLabel.Text = "PackageLoss"; | |||
// | |||
// CalculationControl | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.Controls.Add(this.valueLabel); | |||
this.Controls.Add(this.factorNum); | |||
this.Controls.Add(this.multiply); | |||
this.Controls.Add(this.plus); | |||
this.Margin = new System.Windows.Forms.Padding(0); | |||
this.Name = "CalculationControl"; | |||
this.Size = new System.Drawing.Size(286, 26); | |||
((System.ComponentModel.ISupportInitialize)(this.factorNum)).EndInit(); | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
} | |||
#endregion | |||
@@ -1,120 +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> | |||
<?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> |
@@ -71,7 +71,7 @@ | |||
// | |||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; | |||
this.btnOK.Location = new System.Drawing.Point(416, 9); | |||
this.btnOK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.btnOK.Margin = new System.Windows.Forms.Padding(4); | |||
this.btnOK.Name = "btnOK"; | |||
this.btnOK.Size = new System.Drawing.Size(154, 39); | |||
this.btnOK.TabIndex = 0; | |||
@@ -83,7 +83,7 @@ | |||
// | |||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |||
this.btnCancel.Location = new System.Drawing.Point(254, 9); | |||
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.btnCancel.Margin = new System.Windows.Forms.Padding(4); | |||
this.btnCancel.Name = "btnCancel"; | |||
this.btnCancel.Size = new System.Drawing.Size(154, 39); | |||
this.btnCancel.TabIndex = 1; | |||
@@ -95,7 +95,7 @@ | |||
// | |||
this.btnRegisterAll.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |||
this.btnRegisterAll.Location = new System.Drawing.Point(92, 9); | |||
this.btnRegisterAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.btnRegisterAll.Margin = new System.Windows.Forms.Padding(4); | |||
this.btnRegisterAll.Name = "btnRegisterAll"; | |||
this.btnRegisterAll.Size = new System.Drawing.Size(154, 39); | |||
this.btnRegisterAll.TabIndex = 2; | |||
@@ -125,7 +125,7 @@ | |||
this.tableLayoutPanel1.Controls.Add(this.RegHotkeysAtStartupCheckBox, 1, 6); | |||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; | |||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); | |||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); | |||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); | |||
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; | |||
this.tableLayoutPanel1.RowCount = 8; | |||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16726F)); | |||
@@ -0,0 +1,100 @@ | |||
namespace Shadowsocks.View | |||
{ | |||
partial class InputBox | |||
{ | |||
/// <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.label1 = new System.Windows.Forms.Label(); | |||
this.textBox1 = new System.Windows.Forms.TextBox(); | |||
this.btnOK = new System.Windows.Forms.Button(); | |||
this.button2 = new System.Windows.Forms.Button(); | |||
this.SuspendLayout(); | |||
// | |||
// label1 | |||
// | |||
this.label1.AutoSize = true; | |||
this.label1.Location = new System.Drawing.Point(12, 9); | |||
this.label1.Name = "label1"; | |||
this.label1.Size = new System.Drawing.Size(55, 15); | |||
this.label1.TabIndex = 0; | |||
this.label1.Text = "label1"; | |||
// | |||
// textBox1 | |||
// | |||
this.textBox1.Location = new System.Drawing.Point(13, 51); | |||
this.textBox1.Name = "textBox1"; | |||
this.textBox1.Size = new System.Drawing.Size(484, 25); | |||
this.textBox1.TabIndex = 1; | |||
// | |||
// btnOK | |||
// | |||
this.btnOK.Location = new System.Drawing.Point(321, 91); | |||
this.btnOK.Name = "btnOK"; | |||
this.btnOK.Size = new System.Drawing.Size(75, 31); | |||
this.btnOK.TabIndex = 2; | |||
this.btnOK.Text = "OK"; | |||
this.btnOK.UseVisualStyleBackColor = true; | |||
// | |||
// button2 | |||
// | |||
this.button2.Location = new System.Drawing.Point(422, 91); | |||
this.button2.Name = "button2"; | |||
this.button2.Size = new System.Drawing.Size(75, 31); | |||
this.button2.TabIndex = 3; | |||
this.button2.Text = "Cancel"; | |||
this.button2.UseVisualStyleBackColor = true; | |||
// | |||
// InputBox | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.ClientSize = new System.Drawing.Size(554, 134); | |||
this.Controls.Add(this.button2); | |||
this.Controls.Add(this.btnOK); | |||
this.Controls.Add(this.textBox1); | |||
this.Controls.Add(this.label1); | |||
this.DoubleBuffered = true; | |||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |||
this.MaximizeBox = false; | |||
this.MinimizeBox = false; | |||
this.Name = "InputBox"; | |||
this.ShowInTaskbar = false; | |||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |||
this.Text = "InputBox"; | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
} | |||
#endregion | |||
private System.Windows.Forms.Label label1; | |||
private System.Windows.Forms.TextBox textBox1; | |||
private System.Windows.Forms.Button btnOK; | |||
private System.Windows.Forms.Button button2; | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Data; | |||
using System.Drawing; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Forms; | |||
namespace Shadowsocks.View | |||
{ | |||
internal partial class InputBox : Form | |||
{ | |||
public InputBox() | |||
{ | |||
InitializeComponent(); | |||
} | |||
internal string Prompt { get { return label1.Text; } set { label1.Text = value; } } | |||
internal string Response { get { return textBox1.Text; } set { textBox1.Text = value; } } | |||
} | |||
} |
@@ -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> |
@@ -38,7 +38,7 @@ namespace Shadowsocks.View | |||
private ToolStripMenuItem disableItem; | |||
private ToolStripMenuItem AutoStartupItem; | |||
private ToolStripMenuItem ShareOverLANItem; | |||
private ToolStripMenuItem SeperatorItem; | |||
private ToolStripSeparator SeperatorItem; | |||
private ToolStripMenuItem ConfigItem; | |||
private ToolStripMenuItem ServersItem; | |||
private ToolStripMenuItem globalModeItem; | |||
@@ -280,7 +280,7 @@ namespace Shadowsocks.View | |||
return new ToolStripMenuItem(I18N.GetString(text),null, click); | |||
} | |||
private ToolStripMenuItem CreateMenuGroup(string text, ToolStripMenuItem[] items) | |||
private ToolStripMenuItem CreateMenuGroup(string text, ToolStripItem[] items) | |||
{ | |||
return new ToolStripMenuItem(I18N.GetString(text), null,items); | |||
} | |||
@@ -294,19 +294,19 @@ namespace Shadowsocks.View | |||
this.PACModeItem = CreateToolStripMenuItem("PAC", new EventHandler(this.PACModeItem_Click)), | |||
this.globalModeItem = CreateToolStripMenuItem("Global", new EventHandler(this.GlobalModeItem_Click)) | |||
}), | |||
this.ServersItem = CreateMenuGroup("Servers", new ToolStripMenuItem[] { | |||
this.SeperatorItem = new ToolStripMenuItem("-"), | |||
this.ServersItem = CreateMenuGroup("Servers", new ToolStripItem [] { | |||
this.SeperatorItem = new ToolStripSeparator(), | |||
this.ConfigItem = CreateToolStripMenuItem("Edit Servers...", new EventHandler(this.Config_Click)), | |||
CreateToolStripMenuItem("Statistics Config...", StatisticsConfigItem_Click), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
CreateToolStripMenuItem("Share Server Config...", new EventHandler(this.QRCodeItem_Click)), | |||
CreateToolStripMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click)), | |||
CreateToolStripMenuItem("Import URL from Clipboard...", new EventHandler(this.ImportURLItem_Click)) | |||
}), | |||
CreateMenuGroup("PAC ", new ToolStripMenuItem[] { | |||
CreateMenuGroup("PAC ", new ToolStripItem[] { | |||
this.localPACItem = CreateToolStripMenuItem("Local PAC", new EventHandler(this.LocalPACItem_Click)), | |||
this.onlinePACItem = CreateToolStripMenuItem("Online PAC", new EventHandler(this.OnlinePACItem_Click)), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
this.editLocalPACItem = CreateToolStripMenuItem("Edit Local PAC File...", new EventHandler(this.EditPACFileItem_Click)), | |||
this.updateFromGFWListItem = CreateToolStripMenuItem("Update Local PAC from GFWList", new EventHandler(this.UpdatePACFromGFWListItem_Click)), | |||
this.editGFWUserRuleItem = CreateToolStripMenuItem("Edit User Rule for GFWList...", new EventHandler(this.EditUserRuleFileForGFWListItem_Click)), | |||
@@ -315,25 +315,25 @@ namespace Shadowsocks.View | |||
this.editOnlinePACItem = CreateToolStripMenuItem("Edit Online PAC URL...", new EventHandler(this.UpdateOnlinePACURLItem_Click)), | |||
}), | |||
this.proxyItem = CreateToolStripMenuItem("Forward Proxy...", new EventHandler(this.proxyItem_Click)), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
this.AutoStartupItem = CreateToolStripMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)), | |||
this.ShareOverLANItem = CreateToolStripMenuItem("Allow other Devices to connect", new EventHandler(this.ShareOverLANItem_Click)), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
this.hotKeyItem = CreateToolStripMenuItem("Edit Hotkeys...", new EventHandler(this.hotKeyItem_Click)), | |||
CreateMenuGroup("Help", new ToolStripMenuItem[] { | |||
CreateMenuGroup("Help", new ToolStripItem[] { | |||
CreateToolStripMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)), | |||
this.VerboseLoggingToggleItem = CreateToolStripMenuItem( "Verbose Logging", new EventHandler(this.VerboseLoggingToggleItem_Click) ), | |||
this.ShowPluginOutputToggleItem = CreateToolStripMenuItem("Show Plugin Output", new EventHandler(this.ShowPluginOutputToggleItem_Click)), | |||
this.WriteI18NFileItem = CreateToolStripMenuItem("Write translation template",new EventHandler(WriteI18NFileItem_Click)), | |||
CreateMenuGroup("Updates...", new ToolStripMenuItem[] { | |||
CreateMenuGroup("Updates...", new ToolStripItem[] { | |||
CreateToolStripMenuItem("Check for Updates...", new EventHandler(this.checkUpdatesItem_Click)), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
this.autoCheckUpdatesToggleItem = CreateToolStripMenuItem("Check for Updates at Startup", new EventHandler(this.autoCheckUpdatesToggleItem_Click)), | |||
this.checkPreReleaseToggleItem = CreateToolStripMenuItem("Check Pre-release Version", new EventHandler(this.checkPreReleaseToggleItem_Click)), | |||
}), | |||
CreateToolStripMenuItem("About...", new EventHandler(this.AboutItem_Click)), | |||
}), | |||
new ToolStripMenuItem("-"), | |||
new ToolStripSeparator(), | |||
CreateToolStripMenuItem("Quit", new EventHandler(this.Quit_Click)) | |||
}); | |||
} | |||
@@ -469,7 +469,7 @@ namespace Shadowsocks.View | |||
} | |||
// user wants a seperator item between strategy and servers menugroup | |||
items.Add(new ToolStripMenuItem("-")); | |||
items .Add(new ToolStripSeparator()); | |||
int serverCount = 0; | |||
Configuration configuration = controller.GetConfigurationCopy(); | |||
@@ -485,11 +485,12 @@ namespace Shadowsocks.View | |||
} | |||
} | |||
foreach (ToolStripMenuItem item in items) | |||
foreach (var item in items) | |||
{ | |||
if (item.Tag != null && (item.Tag.ToString() == configuration.index.ToString() || item.Tag.ToString() == configuration.strategy)) | |||
var menuItem = item as ToolStripMenuItem; | |||
if (menuItem != null && menuItem.Tag != null && (menuItem.Tag.ToString() == configuration.index.ToString() || menuItem.Tag.ToString() == configuration.strategy)) | |||
{ | |||
item.Checked = true; | |||
menuItem.Checked = true; | |||
} | |||
} | |||
} | |||
@@ -881,14 +882,21 @@ namespace Shadowsocks.View | |||
private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e) | |||
{ | |||
string origPacUrl = controller.GetConfigurationCopy().pacUrl; | |||
//string pacUrl = Microsoft.VisualBasic.Interaction.InputBox( | |||
// I18N.GetString("Please input PAC Url"), | |||
// I18N.GetString("Edit Online PAC URL"), | |||
// origPacUrl, -1, -1); | |||
//if (!pacUrl.IsNullOrEmpty() && pacUrl != origPacUrl) | |||
//{ | |||
// controller.SavePACUrl(pacUrl); | |||
//} | |||
#if NET472 | |||
string pacUrl = Microsoft.VisualBasic.Interaction.InputBox( | |||
I18N.GetString("Please input PAC Url"), | |||
I18N.GetString("Edit Online PAC URL"), | |||
origPacUrl, -1, -1); | |||
#else | |||
string pacUrl = ViewUtils.InputBox( | |||
I18N.GetString("Please input PAC Url"), | |||
I18N.GetString("Edit Online PAC URL"), | |||
origPacUrl, -1, -1); | |||
#endif | |||
if (!pacUrl.IsNullOrEmpty() && pacUrl != origPacUrl) | |||
{ | |||
controller.SavePACUrl(pacUrl); | |||
} | |||
} | |||
private void SecureLocalPacUrlToggleItem_Click(object sender, EventArgs e) | |||
@@ -2,7 +2,7 @@ | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks> | |||
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks> | |||
<RootNamespace>Shadowsocks</RootNamespace> | |||
<UseWindowsForms>true</UseWindowsForms> | |||
<Authors>clowwindy & community 2020</Authors> | |||