Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c877a76c6 | ||
|
|
c24714e168 | ||
|
|
46d40fec67 | ||
|
|
aacc4edf69 | ||
|
|
acc192df34 | ||
|
|
eae0b1cfac | ||
|
|
63980b3a12 | ||
|
|
a4c4967f5f | ||
|
|
55c19187c7 | ||
|
|
7c73aaa1cf | ||
|
|
77a93a9140 |
@@ -1,3 +1,9 @@
|
||||
4.0.7 2017-12-09
|
||||
- Fix QR code and ss:// protocol import issue
|
||||
- Add an option to show password
|
||||
- User rules have higher priority in PAC file
|
||||
- Bug fixes and improvements
|
||||
|
||||
4.0.6 2017-09-09
|
||||
- SIP002 support
|
||||
- SIP003 support
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
|
||||
public string LatestVersionLocalName;
|
||||
public event EventHandler CheckUpdateCompleted;
|
||||
|
||||
public const string Version = "4.0.6";
|
||||
public const string Version = "4.0.7";
|
||||
|
||||
private class CheckUpdateTimer : System.Timers.Timer
|
||||
{
|
||||
|
||||
@@ -329,13 +329,13 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
|
||||
public string GetQRCodeForCurrentServer()
|
||||
public string GetServerURLForCurrentServer()
|
||||
{
|
||||
Server server = GetCurrentServer();
|
||||
return GetQRCode(server);
|
||||
return GetServerURL(server);
|
||||
}
|
||||
|
||||
public static string GetQRCode(Server server)
|
||||
public static string GetServerURL(Server server)
|
||||
{
|
||||
string tag = string.Empty;
|
||||
string url = string.Empty;
|
||||
@@ -618,7 +618,7 @@ namespace Shadowsocks.Controller
|
||||
UpdatePACFromGFWList();
|
||||
return;
|
||||
}
|
||||
List<string> lines = GFWListUpdater.ParseResult(FileManager.NonExclusiveReadAllText(Utils.GetTempPath("gfwlist.txt")));
|
||||
List<string> lines = new List<string>();
|
||||
if (File.Exists(PACServer.USER_RULE_FILE))
|
||||
{
|
||||
string local = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
|
||||
@@ -632,6 +632,7 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
lines.AddRange(GFWListUpdater.ParseResult(FileManager.NonExclusiveReadAllText(Utils.GetTempPath("gfwlist.txt"))));
|
||||
string abpContent;
|
||||
if (File.Exists(PACServer.USER_ABP_FILE))
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ Server=サーバー
|
||||
Server Addr=サーバーアドレス
|
||||
Server Port=サーバーポート
|
||||
Password=パスワード
|
||||
Show Password=パスワードを表示する
|
||||
Encryption=暗号化
|
||||
Plugin=プラグイン
|
||||
Plugin Options=プラグインのオプション
|
||||
|
||||
@@ -49,6 +49,7 @@ Server=服务器
|
||||
Server Addr=服务器地址
|
||||
Server Port=服务器端口
|
||||
Password=密码
|
||||
Show Password=显示密码
|
||||
Encryption=加密
|
||||
Plugin=插件
|
||||
Plugin Options=插件选项
|
||||
|
||||
@@ -49,6 +49,7 @@ Server=伺服器
|
||||
Server Addr=伺服器位址
|
||||
Server Port=伺服器連接埠
|
||||
Password=密碼
|
||||
Show Password=顯示密碼
|
||||
Encryption=加密
|
||||
Plugin=插件
|
||||
Plugin Options=插件選項
|
||||
|
||||
@@ -4,12 +4,19 @@ using System.Collections.Specialized;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Shadowsocks.Controller;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Shadowsocks.Model
|
||||
{
|
||||
[Serializable]
|
||||
public class Server
|
||||
{
|
||||
#region ParseLegacyURL
|
||||
public static readonly Regex
|
||||
UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase),
|
||||
DetailsParser = new Regex(@"^((?<method>.+?):(?<password>.*)@(?<hostname>.+?):(?<port>\d+?))$", RegexOptions.IgnoreCase);
|
||||
#endregion ParseLegacyURL
|
||||
|
||||
private const int DefaultServerTimeoutSec = 5;
|
||||
public const int MaxServerTimeoutSec = 20;
|
||||
|
||||
@@ -70,6 +77,38 @@ namespace Shadowsocks.Model
|
||||
timeout = DefaultServerTimeoutSec;
|
||||
}
|
||||
|
||||
private static Server ParseLegacyURL(string ssURL)
|
||||
{
|
||||
var match = UrlFinder.Match(ssURL);
|
||||
if (!match.Success)
|
||||
return null;
|
||||
|
||||
Server server = new Server();
|
||||
var base64 = match.Groups["base64"].Value.TrimEnd('/');
|
||||
var tag = match.Groups["tag"].Value;
|
||||
if (!tag.IsNullOrEmpty())
|
||||
{
|
||||
server.remarks = HttpUtility.UrlDecode(tag, Encoding.UTF8);
|
||||
}
|
||||
Match details = null;
|
||||
try
|
||||
{
|
||||
details = DetailsParser.Match(Encoding.UTF8.GetString(Convert.FromBase64String(
|
||||
base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '='))));
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!details.Success)
|
||||
return null;
|
||||
server.method = details.Groups["method"].Value;
|
||||
server.password = details.Groups["password"].Value;
|
||||
server.server = details.Groups["hostname"].Value;
|
||||
server.server_port = int.Parse(details.Groups["port"].Value);
|
||||
return server;
|
||||
}
|
||||
|
||||
public static List<Server> GetServers(string ssURL)
|
||||
{
|
||||
var serverUrls = ssURL.Split('\r', '\n');
|
||||
@@ -77,92 +116,70 @@ namespace Shadowsocks.Model
|
||||
List<Server> servers = new List<Server>();
|
||||
foreach (string serverUrl in serverUrls)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(serverUrl))
|
||||
string _serverUrl = serverUrl.Trim();
|
||||
if (!_serverUrl.BeginWith("ss://", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Uri parsedUrl;
|
||||
try
|
||||
Server legacyServer = ParseLegacyURL(serverUrl);
|
||||
if (legacyServer != null) //legacy
|
||||
{
|
||||
parsedUrl = new Uri(serverUrl);
|
||||
servers.Add(legacyServer);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
else //SIP002
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Server tmp = new Server
|
||||
{
|
||||
remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)
|
||||
};
|
||||
|
||||
string possiblyUnpaddedBase64 = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.Unescaped);
|
||||
bool isOldFormatUrl = possiblyUnpaddedBase64.Length == 0;
|
||||
if (isOldFormatUrl)
|
||||
{
|
||||
int prefixLength = "ss://".Length;
|
||||
int indexOfHashOrSlash = serverUrl.LastIndexOfAny(
|
||||
new[] { '/', '#' },
|
||||
serverUrl.Length - 1,
|
||||
serverUrl.Length - prefixLength);
|
||||
|
||||
int substringLength = serverUrl.Length - prefixLength;
|
||||
if (indexOfHashOrSlash >= 0)
|
||||
Uri parsedUrl;
|
||||
try
|
||||
{
|
||||
substringLength = indexOfHashOrSlash - prefixLength;
|
||||
parsedUrl = new Uri(serverUrl);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Server server = new Server
|
||||
{
|
||||
remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
|
||||
server = parsedUrl.GetComponents(UriComponents.Host, UriFormat.Unescaped),
|
||||
server_port = parsedUrl.Port,
|
||||
};
|
||||
|
||||
// parse base64 UserInfo
|
||||
string rawUserInfo = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.Unescaped);
|
||||
string base64 = rawUserInfo.Replace('-', '+').Replace('_', '/'); // Web-safe base64 to normal base64
|
||||
string userInfo = "";
|
||||
try
|
||||
{
|
||||
userInfo = Encoding.UTF8.GetString(Convert.FromBase64String(
|
||||
base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '=')));
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string[] userInfoParts = userInfo.Split(new char[] { ':' }, 2);
|
||||
if (userInfoParts.Length != 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
server.method = userInfoParts[0];
|
||||
server.password = userInfoParts[1];
|
||||
|
||||
NameValueCollection queryParameters = HttpUtility.ParseQueryString(parsedUrl.Query);
|
||||
string[] pluginParts = HttpUtility.UrlDecode(queryParameters["plugin"] ?? "").Split(new[] { ';' }, 2);
|
||||
if (pluginParts.Length > 0)
|
||||
{
|
||||
server.plugin = pluginParts[0] ?? "";
|
||||
}
|
||||
|
||||
possiblyUnpaddedBase64 = serverUrl.Substring(prefixLength, substringLength).TrimEnd('/');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Web-safe base64 to normal base64
|
||||
possiblyUnpaddedBase64 = possiblyUnpaddedBase64.Replace('-', '+').Replace('_', '/');
|
||||
}
|
||||
if (pluginParts.Length > 1)
|
||||
{
|
||||
server.plugin_opts = pluginParts[1] ?? "";
|
||||
}
|
||||
|
||||
string base64 = possiblyUnpaddedBase64.PadRight(
|
||||
possiblyUnpaddedBase64.Length + (4 - possiblyUnpaddedBase64.Length % 4) % 4,
|
||||
'=');
|
||||
|
||||
string innerUserInfoOrUrl = Encoding.UTF8.GetString(Convert.FromBase64String(base64));
|
||||
string userInfo;
|
||||
if (isOldFormatUrl)
|
||||
{
|
||||
Uri innerUrl = new Uri("inner://" + innerUserInfoOrUrl);
|
||||
userInfo = innerUrl.GetComponents(UriComponents.UserInfo, UriFormat.Unescaped);
|
||||
tmp.server = innerUrl.GetComponents(UriComponents.Host, UriFormat.Unescaped);
|
||||
tmp.server_port = innerUrl.Port;
|
||||
servers.Add(server);
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo = innerUserInfoOrUrl;
|
||||
tmp.server = parsedUrl.GetComponents(UriComponents.Host, UriFormat.Unescaped);
|
||||
tmp.server_port = parsedUrl.Port;
|
||||
}
|
||||
|
||||
string[] userInfoParts = userInfo.Split(new[] { ':' }, 2);
|
||||
if (userInfoParts.Length != 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp.method = userInfoParts[0];
|
||||
tmp.password = userInfoParts[1];
|
||||
|
||||
NameValueCollection queryParameters = HttpUtility.ParseQueryString(parsedUrl.Query);
|
||||
string[] pluginParts = HttpUtility.UrlDecode(queryParameters["plugin"] ?? "").Split(new[] { ';' }, 2);
|
||||
if (pluginParts.Length > 0)
|
||||
{
|
||||
tmp.plugin = pluginParts[0] ?? "";
|
||||
}
|
||||
|
||||
if (pluginParts.Length > 1)
|
||||
{
|
||||
tmp.plugin_opts = pluginParts[1] ?? "";
|
||||
}
|
||||
|
||||
servers.Add(tmp);
|
||||
}
|
||||
return servers;
|
||||
}
|
||||
|
||||
@@ -122,11 +122,19 @@ namespace Shadowsocks
|
||||
Logging.Info("os wake up");
|
||||
if (MainController != null)
|
||||
{
|
||||
System.Timers.Timer timer = new System.Timers.Timer(10 * 1000);
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.AutoReset = false;
|
||||
timer.Enabled = true;
|
||||
timer.Start();
|
||||
System.Threading.Tasks.Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(10 * 1000);
|
||||
try
|
||||
{
|
||||
MainController.Start();
|
||||
Logging.Info("controller started");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogUsefulException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case PowerModes.Suspend:
|
||||
@@ -140,36 +148,6 @@ namespace Shadowsocks
|
||||
}
|
||||
}
|
||||
|
||||
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainController != null)
|
||||
{
|
||||
MainController.Start();
|
||||
Logging.Info("controller started");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogUsefulException(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Timers.Timer timer = (System.Timers.Timer)sender;
|
||||
timer.Enabled = false;
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogUsefulException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Application_ApplicationExit(object sender, EventArgs e)
|
||||
{
|
||||
// detach static event handlers
|
||||
|
||||
+78
-58
@@ -45,6 +45,7 @@
|
||||
this.TimeoutTextBox = new System.Windows.Forms.TextBox();
|
||||
this.PluginLabel = new System.Windows.Forms.Label();
|
||||
this.PluginOptionsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.ShowPasswdCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.MyCancelButton = new System.Windows.Forms.Button();
|
||||
@@ -78,27 +79,28 @@
|
||||
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.PluginOptionsLabel, 0, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.IPTextBox, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ServerPortTextBox, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ShowPasswdCheckBox, 1, 3);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tableLayoutPanel1.RowCount = 9;
|
||||
this.tableLayoutPanel1.RowCount = 10;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
@@ -108,36 +110,37 @@
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
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(253, 215);
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(267, 243);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// PluginOptionsLabel
|
||||
//
|
||||
this.PluginOptionsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.PluginOptionsLabel.AutoSize = true;
|
||||
this.PluginOptionsLabel.Location = new System.Drawing.Point(6, 140);
|
||||
this.PluginOptionsLabel.Location = new System.Drawing.Point(6, 166);
|
||||
this.PluginOptionsLabel.Name = "PluginOptionsLabel";
|
||||
this.PluginOptionsLabel.Size = new System.Drawing.Size(75, 13);
|
||||
this.PluginOptionsLabel.Size = new System.Drawing.Size(89, 12);
|
||||
this.PluginOptionsLabel.TabIndex = 15;
|
||||
this.PluginOptionsLabel.Text = "Plugin Options";
|
||||
//
|
||||
// PluginTextBox
|
||||
//
|
||||
this.PluginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PluginTextBox.Location = new System.Drawing.Point(87, 111);
|
||||
this.PluginTextBox.Location = new System.Drawing.Point(101, 135);
|
||||
this.PluginTextBox.MaxLength = 256;
|
||||
this.PluginTextBox.Name = "PluginTextBox";
|
||||
this.PluginTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.PluginTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.PluginTextBox.TabIndex = 4;
|
||||
this.PluginTextBox.WordWrap = false;
|
||||
//
|
||||
// RemarksTextBox
|
||||
//
|
||||
this.RemarksTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.RemarksTextBox.Location = new System.Drawing.Point(87, 163);
|
||||
this.RemarksTextBox.Location = new System.Drawing.Point(101, 189);
|
||||
this.RemarksTextBox.MaxLength = 32;
|
||||
this.RemarksTextBox.Name = "RemarksTextBox";
|
||||
this.RemarksTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.RemarksTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.RemarksTextBox.TabIndex = 6;
|
||||
this.RemarksTextBox.WordWrap = false;
|
||||
//
|
||||
@@ -145,9 +148,9 @@
|
||||
//
|
||||
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.RemarksLabel.AutoSize = true;
|
||||
this.RemarksLabel.Location = new System.Drawing.Point(32, 166);
|
||||
this.RemarksLabel.Location = new System.Drawing.Point(48, 193);
|
||||
this.RemarksLabel.Name = "RemarksLabel";
|
||||
this.RemarksLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.RemarksLabel.Size = new System.Drawing.Size(47, 12);
|
||||
this.RemarksLabel.TabIndex = 9;
|
||||
this.RemarksLabel.Text = "Remarks";
|
||||
//
|
||||
@@ -155,9 +158,9 @@
|
||||
//
|
||||
this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.IPLabel.AutoSize = true;
|
||||
this.IPLabel.Location = new System.Drawing.Point(30, 9);
|
||||
this.IPLabel.Location = new System.Drawing.Point(36, 10);
|
||||
this.IPLabel.Name = "IPLabel";
|
||||
this.IPLabel.Size = new System.Drawing.Size(51, 13);
|
||||
this.IPLabel.Size = new System.Drawing.Size(59, 12);
|
||||
this.IPLabel.TabIndex = 0;
|
||||
this.IPLabel.Text = "Server IP";
|
||||
//
|
||||
@@ -165,9 +168,9 @@
|
||||
//
|
||||
this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.ServerPortLabel.AutoSize = true;
|
||||
this.ServerPortLabel.Location = new System.Drawing.Point(21, 35);
|
||||
this.ServerPortLabel.Location = new System.Drawing.Point(24, 37);
|
||||
this.ServerPortLabel.Name = "ServerPortLabel";
|
||||
this.ServerPortLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.ServerPortLabel.Size = new System.Drawing.Size(71, 12);
|
||||
this.ServerPortLabel.TabIndex = 1;
|
||||
this.ServerPortLabel.Text = "Server Port";
|
||||
//
|
||||
@@ -175,39 +178,40 @@
|
||||
//
|
||||
this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.PasswordLabel.AutoSize = true;
|
||||
this.PasswordLabel.Location = new System.Drawing.Point(28, 61);
|
||||
this.PasswordLabel.Location = new System.Drawing.Point(42, 64);
|
||||
this.PasswordLabel.Name = "PasswordLabel";
|
||||
this.PasswordLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.PasswordLabel.Size = new System.Drawing.Size(53, 12);
|
||||
this.PasswordLabel.TabIndex = 2;
|
||||
this.PasswordLabel.Text = "Password";
|
||||
this.PasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// IPTextBox
|
||||
//
|
||||
this.IPTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.IPTextBox.Location = new System.Drawing.Point(87, 6);
|
||||
this.IPTextBox.Location = new System.Drawing.Point(101, 6);
|
||||
this.IPTextBox.MaxLength = 512;
|
||||
this.IPTextBox.Name = "IPTextBox";
|
||||
this.IPTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.IPTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.IPTextBox.TabIndex = 0;
|
||||
this.IPTextBox.WordWrap = false;
|
||||
//
|
||||
// ServerPortTextBox
|
||||
//
|
||||
this.ServerPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ServerPortTextBox.Location = new System.Drawing.Point(87, 32);
|
||||
this.ServerPortTextBox.Location = new System.Drawing.Point(101, 33);
|
||||
this.ServerPortTextBox.MaxLength = 10;
|
||||
this.ServerPortTextBox.Name = "ServerPortTextBox";
|
||||
this.ServerPortTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.ServerPortTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.ServerPortTextBox.TabIndex = 1;
|
||||
this.ServerPortTextBox.WordWrap = false;
|
||||
//
|
||||
// PasswordTextBox
|
||||
//
|
||||
this.PasswordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PasswordTextBox.Location = new System.Drawing.Point(87, 58);
|
||||
this.PasswordTextBox.Location = new System.Drawing.Point(101, 60);
|
||||
this.PasswordTextBox.MaxLength = 256;
|
||||
this.PasswordTextBox.Name = "PasswordTextBox";
|
||||
this.PasswordTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.PasswordTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.PasswordTextBox.TabIndex = 2;
|
||||
this.PasswordTextBox.UseSystemPasswordChar = true;
|
||||
this.PasswordTextBox.WordWrap = false;
|
||||
@@ -216,9 +220,9 @@
|
||||
//
|
||||
this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.EncryptionLabel.AutoSize = true;
|
||||
this.EncryptionLabel.Location = new System.Drawing.Point(24, 88);
|
||||
this.EncryptionLabel.Location = new System.Drawing.Point(30, 113);
|
||||
this.EncryptionLabel.Name = "EncryptionLabel";
|
||||
this.EncryptionLabel.Size = new System.Drawing.Size(57, 13);
|
||||
this.EncryptionLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.EncryptionLabel.TabIndex = 8;
|
||||
this.EncryptionLabel.Text = "Encryption";
|
||||
//
|
||||
@@ -229,7 +233,7 @@
|
||||
this.EncryptionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.EncryptionSelect.FormattingEnabled = true;
|
||||
this.EncryptionSelect.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.EncryptionSelect.ItemHeight = 13;
|
||||
this.EncryptionSelect.ItemHeight = 12;
|
||||
this.EncryptionSelect.Items.AddRange(new object[] {
|
||||
"rc4-md5",
|
||||
"salsa20",
|
||||
@@ -249,51 +253,65 @@
|
||||
"aes-192-gcm",
|
||||
"aes-256-gcm",
|
||||
"chacha20-ietf-poly1305"});
|
||||
this.EncryptionSelect.Location = new System.Drawing.Point(87, 84);
|
||||
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109);
|
||||
this.EncryptionSelect.Name = "EncryptionSelect";
|
||||
this.EncryptionSelect.Size = new System.Drawing.Size(160, 21);
|
||||
this.EncryptionSelect.Size = new System.Drawing.Size(160, 20);
|
||||
this.EncryptionSelect.TabIndex = 3;
|
||||
//
|
||||
// TimeoutLabel
|
||||
//
|
||||
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.TimeoutLabel.AutoSize = true;
|
||||
this.TimeoutLabel.Location = new System.Drawing.Point(11, 192);
|
||||
this.TimeoutLabel.Location = new System.Drawing.Point(18, 220);
|
||||
this.TimeoutLabel.Name = "TimeoutLabel";
|
||||
this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.TimeoutLabel.Size = new System.Drawing.Size(70, 13);
|
||||
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
|
||||
this.TimeoutLabel.TabIndex = 10;
|
||||
this.TimeoutLabel.Text = "Timeout(Sec)";
|
||||
//
|
||||
// TimeoutTextBox
|
||||
//
|
||||
this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TimeoutTextBox.Location = new System.Drawing.Point(87, 189);
|
||||
this.TimeoutTextBox.Location = new System.Drawing.Point(101, 216);
|
||||
this.TimeoutTextBox.MaxLength = 5;
|
||||
this.TimeoutTextBox.Name = "TimeoutTextBox";
|
||||
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.TimeoutTextBox.TabIndex = 7;
|
||||
//
|
||||
// PluginLabel
|
||||
//
|
||||
this.PluginLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.PluginLabel.AutoSize = true;
|
||||
this.PluginLabel.Location = new System.Drawing.Point(45, 114);
|
||||
this.PluginLabel.Location = new System.Drawing.Point(54, 139);
|
||||
this.PluginLabel.Name = "PluginLabel";
|
||||
this.PluginLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.PluginLabel.Size = new System.Drawing.Size(41, 12);
|
||||
this.PluginLabel.TabIndex = 12;
|
||||
this.PluginLabel.Text = "Plugin";
|
||||
//
|
||||
// PluginOptionsTextBox
|
||||
//
|
||||
this.PluginOptionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PluginOptionsTextBox.Location = new System.Drawing.Point(87, 137);
|
||||
this.PluginOptionsTextBox.Location = new System.Drawing.Point(101, 162);
|
||||
this.PluginOptionsTextBox.MaxLength = 256;
|
||||
this.PluginOptionsTextBox.Name = "PluginOptionsTextBox";
|
||||
this.PluginOptionsTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.PluginOptionsTextBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.PluginOptionsTextBox.TabIndex = 5;
|
||||
this.PluginOptionsTextBox.WordWrap = false;
|
||||
//
|
||||
// ShowPasswdCheckBox
|
||||
//
|
||||
this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ShowPasswdCheckBox.AutoSize = true;
|
||||
this.ShowPasswdCheckBox.Location = new System.Drawing.Point(101, 87);
|
||||
this.ShowPasswdCheckBox.Name = "ShowPasswdCheckBox";
|
||||
this.ShowPasswdCheckBox.Size = new System.Drawing.Size(102, 16);
|
||||
this.ShowPasswdCheckBox.TabIndex = 16;
|
||||
this.ShowPasswdCheckBox.Text = "Show Password";
|
||||
this.ShowPasswdCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.ShowPasswdCheckBox.UseVisualStyleBackColor = true;
|
||||
this.ShowPasswdCheckBox.CheckedChanged += new System.EventHandler(this.ShowPasswdCheckBox_CheckedChanged);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
@@ -362,7 +380,7 @@
|
||||
this.ServerGroupBox.Location = new System.Drawing.Point(178, 0);
|
||||
this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0);
|
||||
this.ServerGroupBox.Name = "ServerGroupBox";
|
||||
this.ServerGroupBox.Size = new System.Drawing.Size(264, 252);
|
||||
this.ServerGroupBox.Size = new System.Drawing.Size(278, 281);
|
||||
this.ServerGroupBox.TabIndex = 0;
|
||||
this.ServerGroupBox.TabStop = false;
|
||||
this.ServerGroupBox.Text = "Server";
|
||||
@@ -371,6 +389,7 @@
|
||||
//
|
||||
this.ServersListBox.FormattingEnabled = true;
|
||||
this.ServersListBox.IntegralHeight = false;
|
||||
this.ServersListBox.ItemHeight = 12;
|
||||
this.ServersListBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.ServersListBox.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ServersListBox.Name = "ServersListBox";
|
||||
@@ -398,7 +417,7 @@
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(442, 348);
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(456, 377);
|
||||
this.tableLayoutPanel2.TabIndex = 7;
|
||||
//
|
||||
// tableLayoutPanel6
|
||||
@@ -411,7 +430,7 @@
|
||||
this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0);
|
||||
this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0);
|
||||
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 316);
|
||||
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 345);
|
||||
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
|
||||
this.tableLayoutPanel6.RowCount = 1;
|
||||
@@ -454,7 +473,7 @@
|
||||
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0);
|
||||
this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0);
|
||||
this.tableLayoutPanel5.Location = new System.Drawing.Point(256, 252);
|
||||
this.tableLayoutPanel5.Location = new System.Drawing.Point(260, 281);
|
||||
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
|
||||
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3);
|
||||
@@ -464,16 +483,16 @@
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
|
||||
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
|
||||
this.tableLayoutPanel5.Size = new System.Drawing.Size(186, 64);
|
||||
this.tableLayoutPanel5.Size = new System.Drawing.Size(196, 64);
|
||||
this.tableLayoutPanel5.TabIndex = 9;
|
||||
//
|
||||
// ProxyPortTextBox
|
||||
//
|
||||
this.ProxyPortTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.ProxyPortTextBox.Location = new System.Drawing.Point(67, 22);
|
||||
this.ProxyPortTextBox.Location = new System.Drawing.Point(77, 21);
|
||||
this.ProxyPortTextBox.MaxLength = 10;
|
||||
this.ProxyPortTextBox.Name = "ProxyPortTextBox";
|
||||
this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 20);
|
||||
this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 21);
|
||||
this.ProxyPortTextBox.TabIndex = 8;
|
||||
this.ProxyPortTextBox.WordWrap = false;
|
||||
//
|
||||
@@ -481,9 +500,9 @@
|
||||
//
|
||||
this.ProxyPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.ProxyPortLabel.AutoSize = true;
|
||||
this.ProxyPortLabel.Location = new System.Drawing.Point(6, 25);
|
||||
this.ProxyPortLabel.Location = new System.Drawing.Point(6, 26);
|
||||
this.ProxyPortLabel.Name = "ProxyPortLabel";
|
||||
this.ProxyPortLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.ProxyPortLabel.TabIndex = 3;
|
||||
this.ProxyPortLabel.Text = "Proxy Port";
|
||||
//
|
||||
@@ -498,7 +517,7 @@
|
||||
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0);
|
||||
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(283, 319);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(297, 348);
|
||||
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 1;
|
||||
@@ -517,7 +536,7 @@
|
||||
this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0);
|
||||
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 252);
|
||||
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 281);
|
||||
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
|
||||
this.tableLayoutPanel4.RowCount = 2;
|
||||
@@ -546,7 +565,7 @@
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.CancelButton = this.MyCancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(574, 367);
|
||||
this.ClientSize = new System.Drawing.Size(574, 398);
|
||||
this.Controls.Add(this.tableLayoutPanel2);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
@@ -584,7 +603,6 @@
|
||||
private System.Windows.Forms.Label PasswordLabel;
|
||||
private System.Windows.Forms.TextBox IPTextBox;
|
||||
private System.Windows.Forms.TextBox ServerPortTextBox;
|
||||
private System.Windows.Forms.TextBox PasswordTextBox;
|
||||
private System.Windows.Forms.Label EncryptionLabel;
|
||||
private System.Windows.Forms.ComboBox EncryptionSelect;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
@@ -612,6 +630,8 @@
|
||||
private System.Windows.Forms.TextBox PluginTextBox;
|
||||
private System.Windows.Forms.Label PluginLabel;
|
||||
private System.Windows.Forms.TextBox PluginOptionsTextBox;
|
||||
private System.Windows.Forms.CheckBox ShowPasswdCheckBox;
|
||||
private System.Windows.Forms.TextBox PasswordTextBox;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Shadowsocks.View
|
||||
IPLabel.Text = I18N.GetString("Server Addr");
|
||||
ServerPortLabel.Text = I18N.GetString("Server Port");
|
||||
PasswordLabel.Text = I18N.GetString("Password");
|
||||
ShowPasswdCheckBox.Text = I18N.GetString("Show Password");
|
||||
EncryptionLabel.Text = I18N.GetString("Encryption");
|
||||
PluginLabel.Text = I18N.GetString("Plugin");
|
||||
PluginOptionsLabel.Text = I18N.GetString("Plugin Options");
|
||||
@@ -358,5 +359,10 @@ namespace Shadowsocks.View
|
||||
MoveConfigItem(+1); // +1 means move forward
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowPasswdCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.PasswordTextBox.UseSystemPasswordChar = !this.ShowPasswdCheckBox.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,112 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="tableLayoutPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PluginOptionsLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PluginTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RemarksTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RemarksLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="IPLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ServerPortLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PasswordLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="IPTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ServerPortTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PasswordTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="EncryptionLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="EncryptionSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TimeoutLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TimeoutTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PluginLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="PluginOptionsTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ShowPasswdCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="panel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="OKButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MyCancelButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DeleteButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="AddButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ServerGroupBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ServersListBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tableLayoutPanel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tableLayoutPanel6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MoveDownButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="MoveUpButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tableLayoutPanel5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ProxyPortTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ProxyPortLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tableLayoutPanel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tableLayoutPanel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DuplicateButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -659,7 +659,7 @@ namespace Shadowsocks.View
|
||||
|
||||
private void QRCodeItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
QRCodeForm qrCodeForm = new QRCodeForm(controller.GetQRCodeForCurrentServer());
|
||||
QRCodeForm qrCodeForm = new QRCodeForm(controller.GetServerURLForCurrentServer());
|
||||
//qrCodeForm.Icon = this.Icon;
|
||||
// TODO
|
||||
qrCodeForm.Show();
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Shadowsocks.View
|
||||
var servers = Configuration.Load();
|
||||
var serverDatas = servers.configs.Select(
|
||||
server =>
|
||||
new KeyValuePair<string, string>(ShadowsocksController.GetQRCode(server), server.FriendlyName())
|
||||
new KeyValuePair<string, string>(ShadowsocksController.GetServerURL(server), server.FriendlyName())
|
||||
).ToList();
|
||||
listBox1.DataSource = serverDatas;
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -37,8 +39,6 @@
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
||||
+92
-8
@@ -27,12 +27,13 @@ namespace test
|
||||
Assert.IsTrue(UpdateChecker.Asset.CompareVersion("1.3.2", "1.3.1") > 0);
|
||||
}
|
||||
|
||||
[ TestMethod ]
|
||||
public void TestHotKey2Str() {
|
||||
Assert.AreEqual( "Ctrl+A", HotKeys.HotKey2Str( Key.A, ModifierKeys.Control ) );
|
||||
Assert.AreEqual( "Ctrl+Alt+D2", HotKeys.HotKey2Str( Key.D2, (ModifierKeys.Alt | ModifierKeys.Control) ) );
|
||||
Assert.AreEqual("Ctrl+Alt+Shift+NumPad7", HotKeys.HotKey2Str(Key.NumPad7, (ModifierKeys.Alt|ModifierKeys.Control|ModifierKeys.Shift)));
|
||||
Assert.AreEqual( "Ctrl+Alt+Shift+F6", HotKeys.HotKey2Str( Key.F6, (ModifierKeys.Alt|ModifierKeys.Control|ModifierKeys.Shift)));
|
||||
[TestMethod]
|
||||
public void TestHotKey2Str()
|
||||
{
|
||||
Assert.AreEqual("Ctrl+A", HotKeys.HotKey2Str(Key.A, ModifierKeys.Control));
|
||||
Assert.AreEqual("Ctrl+Alt+D2", HotKeys.HotKey2Str(Key.D2, (ModifierKeys.Alt | ModifierKeys.Control)));
|
||||
Assert.AreEqual("Ctrl+Alt+Shift+NumPad7", HotKeys.HotKey2Str(Key.NumPad7, (ModifierKeys.Alt | ModifierKeys.Control | ModifierKeys.Shift)));
|
||||
Assert.AreEqual("Ctrl+Alt+Shift+F6", HotKeys.HotKey2Str(Key.F6, (ModifierKeys.Alt | ModifierKeys.Control | ModifierKeys.Shift)));
|
||||
Assert.AreNotEqual("Ctrl+Shift+Alt+F6", HotKeys.HotKey2Str(Key.F6, (ModifierKeys.Alt | ModifierKeys.Control | ModifierKeys.Shift)));
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace test
|
||||
Assert.IsTrue(HotKeys.Str2HotKey("Ctrl+A").Equals(new HotKey(Key.A, ModifierKeys.Control)));
|
||||
Assert.IsTrue(HotKeys.Str2HotKey("Ctrl+Alt+A").Equals(new HotKey(Key.A, (ModifierKeys.Control | ModifierKeys.Alt))));
|
||||
Assert.IsTrue(HotKeys.Str2HotKey("Ctrl+Shift+A").Equals(new HotKey(Key.A, (ModifierKeys.Control | ModifierKeys.Shift))));
|
||||
Assert.IsTrue(HotKeys.Str2HotKey("Ctrl+Alt+Shift+A").Equals(new HotKey(Key.A, (ModifierKeys.Control | ModifierKeys.Alt| ModifierKeys.Shift))));
|
||||
Assert.IsTrue(HotKeys.Str2HotKey("Ctrl+Alt+Shift+A").Equals(new HotKey(Key.A, (ModifierKeys.Control | ModifierKeys.Alt | ModifierKeys.Shift))));
|
||||
HotKey testKey0 = HotKeys.Str2HotKey("Ctrl+Alt+Shift+A");
|
||||
Assert.IsTrue(testKey0 != null && testKey0.Equals(new HotKey(Key.A, (ModifierKeys.Control | ModifierKeys.Alt | ModifierKeys.Shift))));
|
||||
HotKey testKey1 = HotKeys.Str2HotKey("Ctrl+Alt+Shift+F2");
|
||||
@@ -238,6 +239,15 @@ namespace test
|
||||
};
|
||||
var serverCanonUrl = "ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4";
|
||||
|
||||
var server2 = new Server
|
||||
{
|
||||
server = "192.168.1.1",
|
||||
server_port = 8388,
|
||||
password = "test",
|
||||
method = "bf-cfb"
|
||||
};
|
||||
var server2CanonUrl = "ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xLjE6ODM4OA==";
|
||||
|
||||
var serverWithRemark = new Server
|
||||
{
|
||||
server = server.server,
|
||||
@@ -248,6 +258,16 @@ namespace test
|
||||
};
|
||||
var serverWithRemarkCanonUrl = "ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4#example-server";
|
||||
|
||||
var server2WithRemark = new Server
|
||||
{
|
||||
server = server2.server,
|
||||
server_port = server2.server_port,
|
||||
password = server2.password,
|
||||
method = server2.method,
|
||||
remarks = "example-server"
|
||||
};
|
||||
var server2WithRemarkCanonUrl = "ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xLjE6ODM4OA==#example-server";
|
||||
|
||||
var serverWithPlugin = new Server
|
||||
{
|
||||
server = server.server,
|
||||
@@ -260,6 +280,18 @@ namespace test
|
||||
var serverWithPluginCanonUrl =
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com";
|
||||
|
||||
var server2WithPlugin = new Server
|
||||
{
|
||||
server = server2.server,
|
||||
server_port = server2.server_port,
|
||||
password = server2.password,
|
||||
method = server2.method,
|
||||
plugin = "obfs-local",
|
||||
plugin_opts = "obfs=http;obfs-host=google.com"
|
||||
};
|
||||
var server2WithPluginCanonUrl =
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com";
|
||||
|
||||
var serverWithPluginAndRemark = new Server
|
||||
{
|
||||
server = server.server,
|
||||
@@ -273,6 +305,20 @@ namespace test
|
||||
var serverWithPluginAndRemarkCanonUrl =
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com#example-server";
|
||||
|
||||
var server2WithPluginAndRemark = new Server
|
||||
{
|
||||
server = server2.server,
|
||||
server_port = server2.server_port,
|
||||
password = server2.password,
|
||||
method = server2.method,
|
||||
plugin = server2WithPlugin.plugin,
|
||||
plugin_opts = server2WithPlugin.plugin_opts,
|
||||
remarks = server2WithRemark.remarks
|
||||
};
|
||||
var server2WithPluginAndRemarkCanonUrl =
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com#example-server";
|
||||
|
||||
|
||||
RunParseShadowsocksUrlTest(
|
||||
string.Join(
|
||||
"\r\n",
|
||||
@@ -289,6 +335,22 @@ namespace test
|
||||
serverWithRemark
|
||||
});
|
||||
|
||||
RunParseShadowsocksUrlTest(
|
||||
string.Join(
|
||||
"\r\n",
|
||||
server2CanonUrl,
|
||||
"\r\n",
|
||||
"ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xLjE6ODM4OA==/",
|
||||
server2WithRemarkCanonUrl,
|
||||
"ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xLjE6ODM4OA==/#example-server"),
|
||||
new[]
|
||||
{
|
||||
server2,
|
||||
server2,
|
||||
server2WithRemark,
|
||||
server2WithRemark
|
||||
});
|
||||
|
||||
RunParseShadowsocksUrlTest(
|
||||
string.Join(
|
||||
"\r\n",
|
||||
@@ -311,6 +373,28 @@ namespace test
|
||||
serverWithPluginAndRemark
|
||||
});
|
||||
|
||||
RunParseShadowsocksUrlTest(
|
||||
string.Join(
|
||||
"\r\n",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388",
|
||||
"\r\n",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388/",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388#example-server",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388/#example-server",
|
||||
server2WithPluginCanonUrl,
|
||||
server2WithPluginAndRemarkCanonUrl,
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.1.1:8388/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com&unsupported=1#example-server"),
|
||||
new[]
|
||||
{
|
||||
server2,
|
||||
server2,
|
||||
server2WithRemark,
|
||||
server2WithRemark,
|
||||
server2WithPlugin,
|
||||
server2WithPluginAndRemark,
|
||||
server2WithPluginAndRemark
|
||||
});
|
||||
|
||||
var generateUrlCases = new Dictionary<string, Server>
|
||||
{
|
||||
[serverCanonUrl] = server,
|
||||
@@ -352,7 +436,7 @@ namespace test
|
||||
string expected = testCase.Key;
|
||||
Server config = testCase.Value;
|
||||
|
||||
var actual = ShadowsocksController.GetQRCode(config);
|
||||
var actual = ShadowsocksController.GetServerURL(config);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user