@@ -45,7 +45,7 @@ QRCode=二维码 | |||
Local PAC=使用本地 PAC | |||
Online PAC=使用在线 PAC | |||
Update Online PAC URL=更新在线 PAC 网址 | |||
PAC Url=PAC 网址 | |||
Please input PAC Url=请输入 PAC 网址 | |||
# Messages | |||
@@ -38,7 +38,6 @@ namespace Shadowsocks.View | |||
private MenuItem localPACItem; | |||
private MenuItem onlinePACItem; | |||
private ConfigForm configForm; | |||
private PACUrlForm pacUrlForm; | |||
private string _urlToOpen; | |||
public MenuViewController(ShadowsocksController controller) | |||
@@ -513,30 +512,17 @@ namespace Shadowsocks.View | |||
} | |||
} | |||
private void showPACUrlForm() | |||
private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e) | |||
{ | |||
if (pacUrlForm != null) | |||
{ | |||
pacUrlForm.Activate(); | |||
} | |||
else | |||
string origPacUrl = controller.GetConfiguration().pacUrl; | |||
string pacUrl = Microsoft.VisualBasic.Interaction.InputBox( | |||
I18N.GetString("Please input PAC Url"), | |||
I18N.GetString("Update Online PAC URL"), | |||
origPacUrl, -1, -1); | |||
if (!string.IsNullOrEmpty(pacUrl) && pacUrl != origPacUrl) | |||
{ | |||
pacUrlForm = new PACUrlForm(controller); | |||
pacUrlForm.Show(); | |||
pacUrlForm.FormClosed += pacUrlForm_FormClosed; | |||
controller.SavePACUrl(pacUrl); | |||
} | |||
} | |||
private void pacUrlForm_FormClosed(object sender, FormClosedEventArgs e) | |||
{ | |||
pacUrlForm = null; | |||
Util.Utils.ReleaseMemory(); | |||
ShowFirstTimeBalloon(); | |||
} | |||
private void UpdateOnlinePACURLItem_Click(object sender, EventArgs e) | |||
{ | |||
showPACUrlForm(); | |||
} | |||
} | |||
} |
@@ -1,151 +0,0 @@ | |||
namespace Shadowsocks.View | |||
{ | |||
partial class PACUrlForm | |||
{ | |||
/// <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.PACUrlTextBox = new System.Windows.Forms.TextBox(); | |||
this.PACUrlLabel = new System.Windows.Forms.Label(); | |||
this.OkButton = new System.Windows.Forms.Button(); | |||
this.MyCancelButton = new System.Windows.Forms.Button(); | |||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); | |||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); | |||
this.tableLayoutPanel1.SuspendLayout(); | |||
this.tableLayoutPanel2.SuspendLayout(); | |||
this.SuspendLayout(); | |||
// | |||
// PACUrlTextBox | |||
// | |||
this.PACUrlTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left; | |||
this.PACUrlTextBox.Location = new System.Drawing.Point(53, 3); | |||
this.PACUrlTextBox.MaxLength = 256; | |||
this.PACUrlTextBox.Name = "PACUrlTextBox"; | |||
this.PACUrlTextBox.Size = new System.Drawing.Size(245, 20); | |||
this.PACUrlTextBox.TabIndex = 4; | |||
this.PACUrlTextBox.WordWrap = false; | |||
// | |||
// PACUrlLabel | |||
// | |||
this.PACUrlLabel.Anchor = System.Windows.Forms.AnchorStyles.Left; | |||
this.PACUrlLabel.AutoSize = true; | |||
this.PACUrlLabel.Location = new System.Drawing.Point(3, 6); | |||
this.PACUrlLabel.Margin = new System.Windows.Forms.Padding(3); | |||
this.PACUrlLabel.Name = "PACUrlLabel"; | |||
this.PACUrlLabel.Size = new System.Drawing.Size(44, 13); | |||
this.PACUrlLabel.TabIndex = 3; | |||
this.PACUrlLabel.Text = "PAC Url"; | |||
this.PACUrlLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; | |||
// | |||
// OkButton | |||
// | |||
this.OkButton.Location = new System.Drawing.Point(3, 3); | |||
this.OkButton.Name = "OkButton"; | |||
this.OkButton.Size = new System.Drawing.Size(75, 23); | |||
this.OkButton.TabIndex = 5; | |||
this.OkButton.Text = "OK"; | |||
this.OkButton.UseVisualStyleBackColor = true; | |||
this.OkButton.Click += new System.EventHandler(this.OkButton_Click); | |||
// | |||
// MyCancelButton | |||
// | |||
this.MyCancelButton.Location = new System.Drawing.Point(84, 3); | |||
this.MyCancelButton.Name = "MyCancelButton"; | |||
this.MyCancelButton.Size = new System.Drawing.Size(75, 23); | |||
this.MyCancelButton.TabIndex = 6; | |||
this.MyCancelButton.Text = "Cancel"; | |||
this.MyCancelButton.UseVisualStyleBackColor = true; | |||
this.MyCancelButton.Click += new System.EventHandler(this.MyCancelButton_Click); | |||
// | |||
// tableLayoutPanel1 | |||
// | |||
this.tableLayoutPanel1.AutoSize = true; | |||
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; | |||
this.tableLayoutPanel1.ColumnCount = 2; | |||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); | |||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); | |||
this.tableLayoutPanel1.Controls.Add(this.PACUrlLabel, 0, 0); | |||
this.tableLayoutPanel1.Controls.Add(this.PACUrlTextBox, 1, 0); | |||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 1, 1); | |||
this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 9); | |||
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; | |||
this.tableLayoutPanel1.RowCount = 2; | |||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); | |||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); | |||
this.tableLayoutPanel1.Size = new System.Drawing.Size(301, 61); | |||
this.tableLayoutPanel1.TabIndex = 7; | |||
// | |||
// tableLayoutPanel2 | |||
// | |||
this.tableLayoutPanel2.Anchor = System.Windows.Forms.AnchorStyles.Right; | |||
this.tableLayoutPanel2.AutoSize = true; | |||
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; | |||
this.tableLayoutPanel2.ColumnCount = 2; | |||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); | |||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); | |||
this.tableLayoutPanel2.Controls.Add(this.OkButton, 0, 0); | |||
this.tableLayoutPanel2.Controls.Add(this.MyCancelButton, 1, 0); | |||
this.tableLayoutPanel2.Location = new System.Drawing.Point(136, 29); | |||
this.tableLayoutPanel2.Name = "tableLayoutPanel2"; | |||
this.tableLayoutPanel2.RowCount = 1; | |||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); | |||
this.tableLayoutPanel2.Size = new System.Drawing.Size(162, 29); | |||
this.tableLayoutPanel2.TabIndex = 5; | |||
// | |||
// PACUrlForm | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.AutoSize = true; | |||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; | |||
this.ClientSize = new System.Drawing.Size(351, 101); | |||
this.Controls.Add(this.tableLayoutPanel1); | |||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; | |||
this.MaximizeBox = false; | |||
this.MinimizeBox = false; | |||
this.Name = "PACUrlForm"; | |||
this.Padding = new System.Windows.Forms.Padding(3); | |||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; | |||
this.Text = "Update Online PAC URL"; | |||
this.Load += new System.EventHandler(this.PACUrlForm_Load); | |||
this.tableLayoutPanel1.ResumeLayout(false); | |||
this.tableLayoutPanel1.PerformLayout(); | |||
this.tableLayoutPanel2.ResumeLayout(false); | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
} | |||
#endregion | |||
private System.Windows.Forms.TextBox PACUrlTextBox; | |||
private System.Windows.Forms.Label PACUrlLabel; | |||
private System.Windows.Forms.Button OkButton; | |||
private System.Windows.Forms.Button MyCancelButton; | |||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; | |||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; | |||
} | |||
} |
@@ -1,69 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Data; | |||
using System.Drawing; | |||
using System.Text; | |||
using System.Windows.Forms; | |||
using Shadowsocks.Controller; | |||
using Shadowsocks.Model; | |||
using Shadowsocks.Properties; | |||
namespace Shadowsocks.View | |||
{ | |||
public partial class PACUrlForm : Form | |||
{ | |||
private ShadowsocksController controller; | |||
private string orig_pacUrl; | |||
public PACUrlForm(ShadowsocksController controller) | |||
{ | |||
this.Font = System.Drawing.SystemFonts.MessageBoxFont; | |||
InitializeComponent(); | |||
UpdateTexts(); | |||
this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); | |||
this.controller = controller; | |||
controller.ConfigChanged += controller_ConfigChanged; | |||
} | |||
private void UpdateTexts() | |||
{ | |||
OkButton.Text = I18N.GetString("OK"); | |||
MyCancelButton.Text = I18N.GetString("Cancel"); | |||
PACUrlLabel.Text = I18N.GetString("PAC Url"); | |||
this.Text = I18N.GetString("Update Online PAC URL"); | |||
} | |||
private void controller_ConfigChanged(object sender, EventArgs e) | |||
{ | |||
orig_pacUrl = PACUrlTextBox.Text = controller.GetConfiguration().pacUrl; | |||
} | |||
private void PACUrlForm_Load(object sender, EventArgs e) | |||
{ | |||
PACUrlTextBox.Text = controller.GetConfiguration().pacUrl; | |||
} | |||
private void OkButton_Click(object sender, EventArgs e) | |||
{ | |||
string pacUrl = PACUrlTextBox.Text.Trim(); | |||
if (string.IsNullOrEmpty(pacUrl)) | |||
{ | |||
MessageBox.Show(I18N.GetString("PAC Url can not be blank")); | |||
return; | |||
} | |||
if (pacUrl != this.orig_pacUrl) | |||
{ | |||
controller.SavePACUrl(pacUrl); | |||
} | |||
this.Close(); | |||
} | |||
private void MyCancelButton_Click(object sender, EventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -1,120 +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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
</root> |
@@ -63,6 +63,7 @@ | |||
<ApplicationManifest>app.manifest</ApplicationManifest> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Microsoft.VisualBasic" /> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Drawing" /> | |||
@@ -162,12 +163,6 @@ | |||
<Compile Include="Controller\ShadowsocksController.cs" /> | |||
<Compile Include="Controller\SystemProxy.cs" /> | |||
<Compile Include="View\MenuViewController.cs" /> | |||
<Compile Include="View\PACUrlForm.cs"> | |||
<SubType>Form</SubType> | |||
</Compile> | |||
<Compile Include="View\PACUrlForm.Designer.cs"> | |||
<DependentUpon>PACUrlForm.cs</DependentUpon> | |||
</Compile> | |||
<Compile Include="View\QRCodeForm.cs"> | |||
<SubType>Form</SubType> | |||
</Compile> | |||
@@ -186,9 +181,6 @@ | |||
<SubType>Designer</SubType> | |||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="View\PACUrlForm.resx"> | |||
<DependentUpon>PACUrlForm.cs</DependentUpon> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="View\QRCodeForm.resx"> | |||
<DependentUpon>QRCodeForm.cs</DependentUpon> | |||
</EmbeddedResource> | |||