Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c877a76c6 | ||
|
|
c24714e168 | ||
|
|
46d40fec67 | ||
|
|
aacc4edf69 | ||
|
|
acc192df34 | ||
|
|
eae0b1cfac | ||
|
|
63980b3a12 | ||
|
|
a4c4967f5f | ||
|
|
55c19187c7 | ||
|
|
7c73aaa1cf | ||
|
|
77a93a9140 | ||
|
|
08f06f7177 | ||
|
|
cb3afafd54 | ||
|
|
05df449826 | ||
|
|
d0e692a491 | ||
|
|
b0a2c2735b | ||
|
|
f239244af2 | ||
|
|
a316b95f45 | ||
|
|
cf5de91acb | ||
|
|
71120e5c3e | ||
|
|
caa96ad334 | ||
|
|
f04b497d79 |
@@ -1,3 +1,13 @@
|
||||
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
|
||||
|
||||
4.0.5 2017-08-09
|
||||
- Fix crash when user-wininet.json fail to parse. (#1178)
|
||||
- Bug fixes and improvements.
|
||||
|
||||
@@ -13,6 +13,7 @@ Shadowsocks for Windows
|
||||
4. Supports HTTP proxy
|
||||
5. Supports server auto switching
|
||||
6. Supports UDP relay (see Usage)
|
||||
7. Supports plugins
|
||||
|
||||
#### Download
|
||||
|
||||
@@ -58,11 +59,17 @@ If you want to manage multiple servers using other tools like SwitchyOmega,
|
||||
you can start multiple Shadowsocks instances. To avoid configuration conflicts,
|
||||
copy Shadowsocks to a new directory and choose a different local port.
|
||||
|
||||
#### Plugins
|
||||
|
||||
If you would like to connect to server via a plugin, please set the plugin's
|
||||
path (relative or absolute) on Edit Servers form.
|
||||
Note: Forward Proxy will not be used while a plugin is enabled.
|
||||
|
||||
#### Global hotkeys
|
||||
|
||||
Hotkeys are NOT registered automatically. You should re-register all hotkeys after
|
||||
restarting Shadowsocks. If you are using multiple instances of Shadowsocks,
|
||||
you must set different key combination for other instances.
|
||||
you must set different key combination for each instance.
|
||||
|
||||
##### How to input?
|
||||
|
||||
@@ -102,8 +109,8 @@ Please visit [Servers] for more information.
|
||||
GPLv3
|
||||
|
||||
|
||||
[Appveyor]: https://ci.appveyor.com/project/wongsyrone/shadowsocks-windows-yqdou
|
||||
[Build Status]: https://ci.appveyor.com/api/projects/status/yieb7lo96irmuc28/branch/master?svg=true
|
||||
[Appveyor]: https://ci.appveyor.com/project/celeron533/shadowsocks-windows
|
||||
[Build Status]: https://ci.appveyor.com/api/projects/status/tfw57q6eecippsl5/branch/master?svg=true
|
||||
[latest release]: https://github.com/shadowsocks/shadowsocks-csharp/releases
|
||||
[GFWList]: https://github.com/gfwlist/gfwlist
|
||||
[Servers]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#linux--server-side
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using Shadowsocks.Model;
|
||||
using Shadowsocks.Util.ProcessManagement;
|
||||
|
||||
namespace Shadowsocks.Controller.Service
|
||||
{
|
||||
// https://github.com/shadowsocks/shadowsocks-org/wiki/Plugin
|
||||
public sealed class Sip003Plugin : IDisposable
|
||||
{
|
||||
public IPEndPoint LocalEndPoint { get; private set; }
|
||||
public int ProcessId => _started ? _pluginProcess.Id : 0;
|
||||
|
||||
private readonly object _startProcessLock = new object();
|
||||
private readonly Job _pluginJob;
|
||||
private readonly Process _pluginProcess;
|
||||
private bool _started;
|
||||
private bool _disposed;
|
||||
|
||||
public static Sip003Plugin CreateIfConfigured(Server server)
|
||||
{
|
||||
if (server == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(server));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(server.plugin))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Sip003Plugin(server.plugin, server.plugin_opts, server.server, server.server_port);
|
||||
}
|
||||
|
||||
private Sip003Plugin(string plugin, string pluginOpts, string serverAddress, int serverPort)
|
||||
{
|
||||
if (plugin == null) throw new ArgumentNullException(nameof(plugin));
|
||||
if (string.IsNullOrWhiteSpace(serverAddress))
|
||||
{
|
||||
throw new ArgumentException("Value cannot be null or whitespace.", nameof(serverAddress));
|
||||
}
|
||||
if ((ushort)serverPort != serverPort)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("serverPort");
|
||||
}
|
||||
|
||||
var appPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath);
|
||||
|
||||
_pluginProcess = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = plugin,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
ErrorDialog = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
WorkingDirectory = appPath ?? Environment.CurrentDirectory,
|
||||
Environment =
|
||||
{
|
||||
["SS_REMOTE_HOST"] = serverAddress,
|
||||
["SS_REMOTE_PORT"] = serverPort.ToString(),
|
||||
["SS_PLUGIN_OPTIONS"] = pluginOpts
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_pluginJob = new Job();
|
||||
}
|
||||
|
||||
public bool StartIfNeeded()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException(GetType().FullName);
|
||||
}
|
||||
|
||||
lock (_startProcessLock)
|
||||
{
|
||||
if (_started && !_pluginProcess.HasExited)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var localPort = GetNextFreeTcpPort();
|
||||
LocalEndPoint = new IPEndPoint(IPAddress.Loopback, localPort);
|
||||
|
||||
_pluginProcess.StartInfo.Environment["SS_LOCAL_HOST"] = LocalEndPoint.Address.ToString();
|
||||
_pluginProcess.StartInfo.Environment["SS_LOCAL_PORT"] = LocalEndPoint.Port.ToString();
|
||||
_pluginProcess.Start();
|
||||
_pluginJob.AddProcess(_pluginProcess.Handle);
|
||||
_started = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int GetNextFreeTcpPort()
|
||||
{
|
||||
var l = new TcpListener(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int port = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return port;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!_pluginProcess.HasExited)
|
||||
{
|
||||
_pluginProcess.Kill();
|
||||
_pluginProcess.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
_pluginProcess.Dispose();
|
||||
_pluginJob.Dispose();
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -570,7 +570,15 @@ namespace Shadowsocks.Controller
|
||||
// Setting up proxy
|
||||
IProxy remote;
|
||||
EndPoint proxyEP = null;
|
||||
if (_config.proxy.useProxy)
|
||||
EndPoint serverEP = SocketUtil.GetEndPoint(_server.server, _server.server_port);
|
||||
EndPoint pluginEP = _controller.GetPluginLocalEndPointIfConfigured(_server);
|
||||
|
||||
if (pluginEP != null)
|
||||
{
|
||||
serverEP = pluginEP;
|
||||
remote = new DirectConnect();
|
||||
}
|
||||
else if (_config.proxy.useProxy)
|
||||
{
|
||||
switch (_config.proxy.proxyType)
|
||||
{
|
||||
@@ -607,7 +615,7 @@ namespace Shadowsocks.Controller
|
||||
proxyTimer.Enabled = true;
|
||||
|
||||
proxyTimer.Session = session;
|
||||
proxyTimer.DestEndPoint = SocketUtil.GetEndPoint(_server.server, _server.server_port);
|
||||
proxyTimer.DestEndPoint = serverEP;
|
||||
proxyTimer.Server = _server;
|
||||
|
||||
_proxyConnected = false;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
|
||||
public string LatestVersionLocalName;
|
||||
public event EventHandler CheckUpdateCompleted;
|
||||
|
||||
public const string Version = "4.0.5";
|
||||
public const string Version = "4.0.7";
|
||||
|
||||
private class CheckUpdateTimer : System.Timers.Timer
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
@@ -14,6 +15,8 @@ using Shadowsocks.Model;
|
||||
using Shadowsocks.Properties;
|
||||
using Shadowsocks.Util;
|
||||
using System.Linq;
|
||||
using Shadowsocks.Controller.Service;
|
||||
using Shadowsocks.Proxy;
|
||||
|
||||
namespace Shadowsocks.Controller
|
||||
{
|
||||
@@ -33,6 +36,8 @@ namespace Shadowsocks.Controller
|
||||
private StrategyManager _strategyManager;
|
||||
private PrivoxyRunner privoxyRunner;
|
||||
private GFWListUpdater gfwListUpdater;
|
||||
private readonly ConcurrentDictionary<Server, Sip003Plugin> _pluginsByServer;
|
||||
|
||||
public AvailabilityStatistics availabilityStatistics = AvailabilityStatistics.Instance;
|
||||
public StatisticsStrategyConfiguration StatisticsConfiguration { get; private set; }
|
||||
|
||||
@@ -79,6 +84,7 @@ namespace Shadowsocks.Controller
|
||||
_config = Configuration.Load();
|
||||
StatisticsConfiguration = StatisticsStrategyConfiguration.Load();
|
||||
_strategyManager = new StrategyManager(this);
|
||||
_pluginsByServer = new ConcurrentDictionary<Server, Sip003Plugin>();
|
||||
StartReleasingMemory();
|
||||
StartTrafficStatistics(61);
|
||||
}
|
||||
@@ -144,6 +150,31 @@ namespace Shadowsocks.Controller
|
||||
return GetCurrentServer();
|
||||
}
|
||||
|
||||
public EndPoint GetPluginLocalEndPointIfConfigured(Server server)
|
||||
{
|
||||
var plugin = _pluginsByServer.GetOrAdd(server, Sip003Plugin.CreateIfConfigured);
|
||||
if (plugin == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (plugin.StartIfNeeded())
|
||||
{
|
||||
Logging.Info(
|
||||
$"Started SIP003 plugin for {server.Identifier()} on {plugin.LocalEndPoint} - PID: {plugin.ProcessId}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Error("Failed to start SIP003 plugin: " + ex.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
return plugin.LocalEndPoint;
|
||||
}
|
||||
|
||||
public void SaveServers(List<Server> servers, int localPort)
|
||||
{
|
||||
_config.configs = servers;
|
||||
@@ -259,6 +290,7 @@ namespace Shadowsocks.Controller
|
||||
{
|
||||
_listener.Stop();
|
||||
}
|
||||
StopPlugins();
|
||||
if (privoxyRunner != null)
|
||||
{
|
||||
privoxyRunner.Stop();
|
||||
@@ -270,6 +302,15 @@ namespace Shadowsocks.Controller
|
||||
Encryption.RNG.Close();
|
||||
}
|
||||
|
||||
private void StopPlugins()
|
||||
{
|
||||
foreach (var serverAndPlugin in _pluginsByServer)
|
||||
{
|
||||
serverAndPlugin.Value?.Dispose();
|
||||
}
|
||||
_pluginsByServer.Clear();
|
||||
}
|
||||
|
||||
public void TouchPACFile()
|
||||
{
|
||||
string pacFilename = _pacServer.TouchPACFile();
|
||||
@@ -288,22 +329,50 @@ 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 parts = $"{server.method}:{server.password}@{server.server}:{server.server_port}";
|
||||
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
|
||||
if(!server.remarks.IsNullOrEmpty())
|
||||
string url = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(server.plugin))
|
||||
{
|
||||
// For backwards compatiblity, if no plugin, use old url format
|
||||
string parts = $"{server.method}:{server.password}@{server.server}:{server.server_port}";
|
||||
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
|
||||
url = base64;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SIP002
|
||||
string parts = $"{server.method}:{server.password}";
|
||||
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
|
||||
string websafeBase64 = base64.Replace('+', '-').Replace('/', '_').TrimEnd('=');
|
||||
|
||||
string pluginPart = server.plugin;
|
||||
if (!string.IsNullOrWhiteSpace(server.plugin_opts))
|
||||
{
|
||||
pluginPart += ";" + server.plugin_opts;
|
||||
}
|
||||
|
||||
url = string.Format(
|
||||
"{0}@{1}:{2}/?plugin={3}",
|
||||
websafeBase64,
|
||||
HttpUtility.UrlEncode(server.server, Encoding.UTF8),
|
||||
server.server_port,
|
||||
HttpUtility.UrlEncode(pluginPart, Encoding.UTF8));
|
||||
}
|
||||
|
||||
if (!server.remarks.IsNullOrEmpty())
|
||||
{
|
||||
tag = $"#{HttpUtility.UrlEncode(server.remarks, Encoding.UTF8)}";
|
||||
}
|
||||
return $"ss://{base64}{tag}";
|
||||
return $"ss://{url}{tag}";
|
||||
}
|
||||
|
||||
public void UpdatePACFromGFWList()
|
||||
@@ -421,6 +490,8 @@ namespace Shadowsocks.Controller
|
||||
|
||||
protected void Reload()
|
||||
{
|
||||
StopPlugins();
|
||||
|
||||
Encryption.RNG.Reload();
|
||||
// some logic in configuration updated the config when saving, we need to read it again
|
||||
_config = Configuration.Load();
|
||||
@@ -463,6 +534,7 @@ namespace Shadowsocks.Controller
|
||||
strategy.ReloadServers();
|
||||
}
|
||||
|
||||
StartPlugins();
|
||||
privoxyRunner.Start(_config);
|
||||
|
||||
TCPRelay tcpRelay = new TCPRelay(this, _config);
|
||||
@@ -500,6 +572,15 @@ namespace Shadowsocks.Controller
|
||||
Utils.ReleaseMemory(true);
|
||||
}
|
||||
|
||||
private void StartPlugins()
|
||||
{
|
||||
foreach (var server in _config.configs)
|
||||
{
|
||||
// Early start plugin processes
|
||||
GetPluginLocalEndPointIfConfigured(server);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveConfig(Configuration newConfig)
|
||||
{
|
||||
Configuration.Save(newConfig);
|
||||
@@ -537,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);
|
||||
@@ -551,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,7 +49,10 @@ Server=サーバー
|
||||
Server Addr=サーバーアドレス
|
||||
Server Port=サーバーポート
|
||||
Password=パスワード
|
||||
Show Password=パスワードを表示する
|
||||
Encryption=暗号化
|
||||
Plugin=プラグイン
|
||||
Plugin Options=プラグインのオプション
|
||||
Proxy Port=プロキシポート
|
||||
Remarks=付記
|
||||
Timeout(Sec)=タイムアウト (秒)
|
||||
@@ -66,6 +69,7 @@ Use Proxy=プロキシを利用する
|
||||
Proxy Type=プロキシの種類
|
||||
Proxy Addr=プロキシアドレス
|
||||
Proxy Port=プロキシポート
|
||||
If server has a plugin, proxy will not be used=サーバーにプラグインがある場合、プロキシは利用されません
|
||||
|
||||
# Log Form
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ Server=服务器
|
||||
Server Addr=服务器地址
|
||||
Server Port=服务器端口
|
||||
Password=密码
|
||||
Show Password=显示密码
|
||||
Encryption=加密
|
||||
Plugin=插件
|
||||
Plugin Options=插件选项
|
||||
Proxy Port=代理端口
|
||||
Remarks=备注
|
||||
Timeout(Sec)=超时(秒)
|
||||
@@ -66,6 +69,7 @@ Use Proxy=使用代理
|
||||
Proxy Type=代理类型
|
||||
Proxy Addr=代理地址
|
||||
Proxy Port=代理端口
|
||||
If server has a plugin, proxy will not be used=若服务器含有插件,代理将不被使用
|
||||
|
||||
# Log Form
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ Server=伺服器
|
||||
Server Addr=伺服器位址
|
||||
Server Port=伺服器連接埠
|
||||
Password=密碼
|
||||
Show Password=顯示密碼
|
||||
Encryption=加密
|
||||
Plugin=插件
|
||||
Plugin Options=插件選項
|
||||
Proxy Port=Proxy 連接埠
|
||||
Remarks=註解
|
||||
Timeout(Sec)=逾時 (秒)
|
||||
@@ -66,6 +69,7 @@ Use Proxy=使用 Proxy
|
||||
Proxy Type=Proxy 類型
|
||||
Proxy Addr=Proxy 位址
|
||||
Proxy Port=Proxy 連接埠
|
||||
If server has a plugin, proxy will not be used=若伺服器含有插件,Proxy 將不被使用
|
||||
|
||||
# Log Form
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
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;
|
||||
@@ -21,6 +24,8 @@ namespace Shadowsocks.Model
|
||||
public int server_port;
|
||||
public string password;
|
||||
public string method;
|
||||
public string plugin;
|
||||
public string plugin_opts;
|
||||
public string remarks;
|
||||
public int timeout;
|
||||
|
||||
@@ -65,35 +70,116 @@ namespace Shadowsocks.Model
|
||||
server = "";
|
||||
server_port = 8388;
|
||||
method = "aes-256-cfb";
|
||||
plugin = "";
|
||||
plugin_opts = "";
|
||||
password = "";
|
||||
remarks = "";
|
||||
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 matches = UrlFinder.Matches(ssURL);
|
||||
if (matches.Count <= 0) return null;
|
||||
List<Server> servers = new List<Server>();
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
Server tmp = new Server();
|
||||
var base64 = match.Groups["base64"].Value;
|
||||
var tag = match.Groups["tag"].Value;
|
||||
if (!tag.IsNullOrEmpty())
|
||||
{
|
||||
tmp.remarks = HttpUtility.UrlDecode(tag, Encoding.UTF8);
|
||||
}
|
||||
Match details = DetailsParser.Match(Encoding.UTF8.GetString(Convert.FromBase64String(
|
||||
base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '='))));
|
||||
if (!details.Success)
|
||||
continue;
|
||||
tmp.method = details.Groups["method"].Value;
|
||||
tmp.password = details.Groups["password"].Value;
|
||||
tmp.server = details.Groups["hostname"].Value;
|
||||
tmp.server_port = int.Parse(details.Groups["port"].Value);
|
||||
var serverUrls = ssURL.Split('\r', '\n');
|
||||
|
||||
servers.Add(tmp);
|
||||
List<Server> servers = new List<Server>();
|
||||
foreach (string serverUrl in serverUrls)
|
||||
{
|
||||
string _serverUrl = serverUrl.Trim();
|
||||
if (!_serverUrl.BeginWith("ss://", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Server legacyServer = ParseLegacyURL(serverUrl);
|
||||
if (legacyServer != null) //legacy
|
||||
{
|
||||
servers.Add(legacyServer);
|
||||
}
|
||||
else //SIP002
|
||||
{
|
||||
Uri parsedUrl;
|
||||
try
|
||||
{
|
||||
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] ?? "";
|
||||
}
|
||||
|
||||
if (pluginParts.Length > 1)
|
||||
{
|
||||
server.plugin_opts = pluginParts[1] ?? "";
|
||||
}
|
||||
|
||||
servers.Add(server);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
+112
-39
@@ -29,6 +29,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.PluginOptionsLabel = new System.Windows.Forms.Label();
|
||||
this.PluginTextBox = new System.Windows.Forms.TextBox();
|
||||
this.RemarksTextBox = new System.Windows.Forms.TextBox();
|
||||
this.RemarksLabel = new System.Windows.Forms.Label();
|
||||
this.IPLabel = new System.Windows.Forms.Label();
|
||||
@@ -41,6 +43,9 @@
|
||||
this.EncryptionSelect = new System.Windows.Forms.ComboBox();
|
||||
this.TimeoutLabel = new System.Windows.Forms.Label();
|
||||
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();
|
||||
@@ -74,23 +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.RemarksTextBox, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 5);
|
||||
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, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 6);
|
||||
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 = 7;
|
||||
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());
|
||||
@@ -98,24 +108,47 @@
|
||||
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(255, 167);
|
||||
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(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, 166);
|
||||
this.PluginOptionsLabel.Name = "PluginOptionsLabel";
|
||||
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(101, 135);
|
||||
this.PluginTextBox.MaxLength = 256;
|
||||
this.PluginTextBox.Name = "PluginTextBox";
|
||||
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(89, 113);
|
||||
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, 21);
|
||||
this.RemarksTextBox.TabIndex = 4;
|
||||
this.RemarksTextBox.TabIndex = 6;
|
||||
this.RemarksTextBox.WordWrap = false;
|
||||
//
|
||||
// RemarksLabel
|
||||
//
|
||||
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.RemarksLabel.AutoSize = true;
|
||||
this.RemarksLabel.Location = new System.Drawing.Point(36, 117);
|
||||
this.RemarksLabel.Location = new System.Drawing.Point(48, 193);
|
||||
this.RemarksLabel.Name = "RemarksLabel";
|
||||
this.RemarksLabel.Size = new System.Drawing.Size(47, 12);
|
||||
this.RemarksLabel.TabIndex = 9;
|
||||
@@ -125,7 +158,7 @@
|
||||
//
|
||||
this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.IPLabel.AutoSize = true;
|
||||
this.IPLabel.Location = new System.Drawing.Point(24, 10);
|
||||
this.IPLabel.Location = new System.Drawing.Point(36, 10);
|
||||
this.IPLabel.Name = "IPLabel";
|
||||
this.IPLabel.Size = new System.Drawing.Size(59, 12);
|
||||
this.IPLabel.TabIndex = 0;
|
||||
@@ -135,7 +168,7 @@
|
||||
//
|
||||
this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.ServerPortLabel.AutoSize = true;
|
||||
this.ServerPortLabel.Location = new System.Drawing.Point(12, 37);
|
||||
this.ServerPortLabel.Location = new System.Drawing.Point(24, 37);
|
||||
this.ServerPortLabel.Name = "ServerPortLabel";
|
||||
this.ServerPortLabel.Size = new System.Drawing.Size(71, 12);
|
||||
this.ServerPortLabel.TabIndex = 1;
|
||||
@@ -145,16 +178,17 @@
|
||||
//
|
||||
this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.PasswordLabel.AutoSize = true;
|
||||
this.PasswordLabel.Location = new System.Drawing.Point(30, 64);
|
||||
this.PasswordLabel.Location = new System.Drawing.Point(42, 64);
|
||||
this.PasswordLabel.Name = "PasswordLabel";
|
||||
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(89, 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, 21);
|
||||
@@ -164,7 +198,7 @@
|
||||
// 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(89, 33);
|
||||
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, 21);
|
||||
@@ -174,7 +208,7 @@
|
||||
// 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(89, 60);
|
||||
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, 21);
|
||||
@@ -186,7 +220,7 @@
|
||||
//
|
||||
this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.EncryptionLabel.AutoSize = true;
|
||||
this.EncryptionLabel.Location = new System.Drawing.Point(18, 91);
|
||||
this.EncryptionLabel.Location = new System.Drawing.Point(30, 113);
|
||||
this.EncryptionLabel.Name = "EncryptionLabel";
|
||||
this.EncryptionLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.EncryptionLabel.TabIndex = 8;
|
||||
@@ -219,7 +253,7 @@
|
||||
"aes-192-gcm",
|
||||
"aes-256-gcm",
|
||||
"chacha20-ietf-poly1305"});
|
||||
this.EncryptionSelect.Location = new System.Drawing.Point(89, 87);
|
||||
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109);
|
||||
this.EncryptionSelect.Name = "EncryptionSelect";
|
||||
this.EncryptionSelect.Size = new System.Drawing.Size(160, 20);
|
||||
this.EncryptionSelect.TabIndex = 3;
|
||||
@@ -228,7 +262,7 @@
|
||||
//
|
||||
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.TimeoutLabel.AutoSize = true;
|
||||
this.TimeoutLabel.Location = new System.Drawing.Point(6, 144);
|
||||
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(77, 12);
|
||||
@@ -238,11 +272,45 @@
|
||||
// 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(89, 140);
|
||||
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, 21);
|
||||
this.TimeoutTextBox.TabIndex = 11;
|
||||
this.TimeoutTextBox.TabIndex = 7;
|
||||
//
|
||||
// PluginLabel
|
||||
//
|
||||
this.PluginLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.PluginLabel.AutoSize = true;
|
||||
this.PluginLabel.Location = new System.Drawing.Point(54, 139);
|
||||
this.PluginLabel.Name = "PluginLabel";
|
||||
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(101, 162);
|
||||
this.PluginOptionsTextBox.MaxLength = 256;
|
||||
this.PluginOptionsTextBox.Name = "PluginOptionsTextBox";
|
||||
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
|
||||
//
|
||||
@@ -262,7 +330,7 @@
|
||||
this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.OKButton.TabIndex = 12;
|
||||
this.OKButton.TabIndex = 15;
|
||||
this.OKButton.Text = "OK";
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
|
||||
@@ -275,7 +343,7 @@
|
||||
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
||||
this.MyCancelButton.Name = "MyCancelButton";
|
||||
this.MyCancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.MyCancelButton.TabIndex = 13;
|
||||
this.MyCancelButton.TabIndex = 16;
|
||||
this.MyCancelButton.Text = "Cancel";
|
||||
this.MyCancelButton.UseVisualStyleBackColor = true;
|
||||
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click);
|
||||
@@ -287,7 +355,7 @@
|
||||
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3);
|
||||
this.DeleteButton.Name = "DeleteButton";
|
||||
this.DeleteButton.Size = new System.Drawing.Size(80, 23);
|
||||
this.DeleteButton.TabIndex = 9;
|
||||
this.DeleteButton.TabIndex = 11;
|
||||
this.DeleteButton.Text = "&Delete";
|
||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||
@@ -299,7 +367,7 @@
|
||||
this.AddButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(80, 23);
|
||||
this.AddButton.TabIndex = 8;
|
||||
this.AddButton.TabIndex = 10;
|
||||
this.AddButton.Text = "&Add";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
@@ -312,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(266, 205);
|
||||
this.ServerGroupBox.Size = new System.Drawing.Size(278, 281);
|
||||
this.ServerGroupBox.TabIndex = 0;
|
||||
this.ServerGroupBox.TabStop = false;
|
||||
this.ServerGroupBox.Text = "Server";
|
||||
@@ -326,7 +394,7 @@
|
||||
this.ServersListBox.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ServersListBox.Name = "ServersListBox";
|
||||
this.ServersListBox.Size = new System.Drawing.Size(166, 148);
|
||||
this.ServersListBox.TabIndex = 7;
|
||||
this.ServersListBox.TabIndex = 9;
|
||||
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged);
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
@@ -349,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(444, 301);
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(456, 377);
|
||||
this.tableLayoutPanel2.TabIndex = 7;
|
||||
//
|
||||
// tableLayoutPanel6
|
||||
@@ -362,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, 269);
|
||||
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;
|
||||
@@ -377,7 +445,7 @@
|
||||
this.MoveDownButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3);
|
||||
this.MoveDownButton.Name = "MoveDownButton";
|
||||
this.MoveDownButton.Size = new System.Drawing.Size(80, 23);
|
||||
this.MoveDownButton.TabIndex = 11;
|
||||
this.MoveDownButton.TabIndex = 14;
|
||||
this.MoveDownButton.Text = "Move D&own";
|
||||
this.MoveDownButton.UseVisualStyleBackColor = true;
|
||||
this.MoveDownButton.Click += new System.EventHandler(this.MoveDownButton_Click);
|
||||
@@ -389,7 +457,7 @@
|
||||
this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
|
||||
this.MoveUpButton.Name = "MoveUpButton";
|
||||
this.MoveUpButton.Size = new System.Drawing.Size(80, 23);
|
||||
this.MoveUpButton.TabIndex = 10;
|
||||
this.MoveUpButton.TabIndex = 13;
|
||||
this.MoveUpButton.Text = "Move &Up";
|
||||
this.MoveUpButton.UseVisualStyleBackColor = true;
|
||||
this.MoveUpButton.Click += new System.EventHandler(this.MoveUpButton_Click);
|
||||
@@ -405,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(248, 205);
|
||||
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);
|
||||
@@ -425,7 +493,7 @@
|
||||
this.ProxyPortTextBox.MaxLength = 10;
|
||||
this.ProxyPortTextBox.Name = "ProxyPortTextBox";
|
||||
this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 21);
|
||||
this.ProxyPortTextBox.TabIndex = 6;
|
||||
this.ProxyPortTextBox.TabIndex = 8;
|
||||
this.ProxyPortTextBox.WordWrap = false;
|
||||
//
|
||||
// ProxyPortLabel
|
||||
@@ -449,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(285, 272);
|
||||
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;
|
||||
@@ -468,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, 205);
|
||||
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;
|
||||
@@ -484,7 +552,7 @@
|
||||
this.DuplicateButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3);
|
||||
this.DuplicateButton.Name = "DuplicateButton";
|
||||
this.DuplicateButton.Size = new System.Drawing.Size(80, 23);
|
||||
this.DuplicateButton.TabIndex = 10;
|
||||
this.DuplicateButton.TabIndex = 12;
|
||||
this.DuplicateButton.Text = "Dupli&cate";
|
||||
this.DuplicateButton.UseVisualStyleBackColor = true;
|
||||
this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click);
|
||||
@@ -497,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;
|
||||
@@ -535,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;
|
||||
@@ -559,6 +626,12 @@
|
||||
private System.Windows.Forms.Button DuplicateButton;
|
||||
private System.Windows.Forms.Label TimeoutLabel;
|
||||
private System.Windows.Forms.TextBox TimeoutTextBox;
|
||||
private System.Windows.Forms.Label PluginOptionsLabel;
|
||||
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,7 +46,10 @@ 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");
|
||||
ProxyPortLabel.Text = I18N.GetString("Proxy Port");
|
||||
RemarksLabel.Text = I18N.GetString("Remarks");
|
||||
TimeoutLabel.Text = I18N.GetString("Timeout(Sec)");
|
||||
@@ -94,6 +97,8 @@ namespace Shadowsocks.View
|
||||
}
|
||||
server.password = PasswordTextBox.Text;
|
||||
server.method = EncryptionSelect.Text;
|
||||
server.plugin = PluginTextBox.Text;
|
||||
server.plugin_opts = PluginOptionsTextBox.Text;
|
||||
server.remarks = RemarksTextBox.Text;
|
||||
if (!int.TryParse(TimeoutTextBox.Text, out server.timeout))
|
||||
{
|
||||
@@ -127,6 +132,8 @@ namespace Shadowsocks.View
|
||||
PasswordTextBox.Text = server.password;
|
||||
ProxyPortTextBox.Text = _modifiedConfiguration.localPort.ToString();
|
||||
EncryptionSelect.Text = server.method ?? "aes-256-cfb";
|
||||
PluginTextBox.Text = server.plugin;
|
||||
PluginOptionsTextBox.Text = server.plugin_opts;
|
||||
RemarksTextBox.Text = server.remarks;
|
||||
TimeoutTextBox.Text = server.timeout.ToString();
|
||||
}
|
||||
@@ -352,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();
|
||||
|
||||
+79
-112
@@ -28,70 +28,27 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.MyCancelButton = new System.Windows.Forms.Button();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.UseProxyCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ProxyAddrLabel = new System.Windows.Forms.Label();
|
||||
this.ProxyServerTextBox = new System.Windows.Forms.TextBox();
|
||||
this.ProxyPortLabel = new System.Windows.Forms.Label();
|
||||
this.ProxyPortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ProxyTypeLabel = new System.Windows.Forms.Label();
|
||||
this.ProxyTypeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.ProxyTimeoutTextBox = new System.Windows.Forms.TextBox();
|
||||
this.ProxyTimeoutLabel = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ProxyNotificationLabel = new System.Windows.Forms.Label();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.tableLayoutPanel4.SuspendLayout();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.UseProxyCheckBox, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 1);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(15, 15);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
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.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(395, 123);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.AutoSize = true;
|
||||
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel3.ColumnCount = 2;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
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(236, 94);
|
||||
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 1;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(159, 26);
|
||||
this.tableLayoutPanel3.TabIndex = 9;
|
||||
//
|
||||
// MyCancelButton
|
||||
//
|
||||
this.MyCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.MyCancelButton.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.MyCancelButton.Location = new System.Drawing.Point(84, 3);
|
||||
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
||||
this.MyCancelButton.Name = "MyCancelButton";
|
||||
@@ -104,7 +61,6 @@
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.OKButton.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.OKButton.Location = new System.Drawing.Point(3, 3);
|
||||
this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
|
||||
this.OKButton.Name = "OKButton";
|
||||
@@ -117,6 +73,7 @@
|
||||
// UseProxyCheckBox
|
||||
//
|
||||
this.UseProxyCheckBox.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.UseProxyCheckBox, 2);
|
||||
this.UseProxyCheckBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.UseProxyCheckBox.Name = "UseProxyCheckBox";
|
||||
this.UseProxyCheckBox.Size = new System.Drawing.Size(78, 16);
|
||||
@@ -125,31 +82,11 @@
|
||||
this.UseProxyCheckBox.UseVisualStyleBackColor = true;
|
||||
this.UseProxyCheckBox.CheckedChanged += new System.EventHandler(this.UseProxyCheckBox_CheckedChanged);
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.AutoSize = true;
|
||||
this.tableLayoutPanel2.ColumnCount = 4;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.Controls.Add(this.ProxyAddrLabel, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.ProxyServerTextBox, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.ProxyPortLabel, 2, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.ProxyPortTextBox, 3, 0);
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 61);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 1;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(389, 27);
|
||||
this.tableLayoutPanel2.TabIndex = 1;
|
||||
//
|
||||
// ProxyAddrLabel
|
||||
//
|
||||
this.ProxyAddrLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyAddrLabel.AutoSize = true;
|
||||
this.ProxyAddrLabel.Location = new System.Drawing.Point(3, 7);
|
||||
this.ProxyAddrLabel.Location = new System.Drawing.Point(3, 71);
|
||||
this.ProxyAddrLabel.Name = "ProxyAddrLabel";
|
||||
this.ProxyAddrLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.ProxyAddrLabel.TabIndex = 0;
|
||||
@@ -158,10 +95,10 @@
|
||||
// ProxyServerTextBox
|
||||
//
|
||||
this.ProxyServerTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyServerTextBox.Location = new System.Drawing.Point(74, 3);
|
||||
this.ProxyServerTextBox.Location = new System.Drawing.Point(74, 67);
|
||||
this.ProxyServerTextBox.MaxLength = 512;
|
||||
this.ProxyServerTextBox.Name = "ProxyServerTextBox";
|
||||
this.ProxyServerTextBox.Size = new System.Drawing.Size(135, 21);
|
||||
this.ProxyServerTextBox.Size = new System.Drawing.Size(142, 21);
|
||||
this.ProxyServerTextBox.TabIndex = 1;
|
||||
this.ProxyServerTextBox.WordWrap = false;
|
||||
//
|
||||
@@ -169,46 +106,27 @@
|
||||
//
|
||||
this.ProxyPortLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyPortLabel.AutoSize = true;
|
||||
this.ProxyPortLabel.Location = new System.Drawing.Point(215, 7);
|
||||
this.ProxyPortLabel.Location = new System.Drawing.Point(222, 71);
|
||||
this.ProxyPortLabel.Name = "ProxyPortLabel";
|
||||
this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.ProxyPortLabel.Size = new System.Drawing.Size(77, 12);
|
||||
this.ProxyPortLabel.TabIndex = 2;
|
||||
this.ProxyPortLabel.Text = "Proxy Port";
|
||||
//
|
||||
// ProxyPortTextBox
|
||||
//
|
||||
this.ProxyPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyPortTextBox.Location = new System.Drawing.Point(286, 3);
|
||||
this.ProxyPortTextBox.Location = new System.Drawing.Point(305, 67);
|
||||
this.ProxyPortTextBox.MaxLength = 10;
|
||||
this.ProxyPortTextBox.Name = "ProxyPortTextBox";
|
||||
this.ProxyPortTextBox.Size = new System.Drawing.Size(100, 21);
|
||||
this.ProxyPortTextBox.Size = new System.Drawing.Size(58, 21);
|
||||
this.ProxyPortTextBox.TabIndex = 3;
|
||||
this.ProxyPortTextBox.WordWrap = false;
|
||||
//
|
||||
// tableLayoutPanel4
|
||||
//
|
||||
this.tableLayoutPanel4.AutoSize = true;
|
||||
this.tableLayoutPanel4.ColumnCount = 4;
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel4.Controls.Add(this.ProxyTypeLabel, 0, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.ProxyTypeComboBox, 1, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.ProxyTimeoutTextBox, 3, 0);
|
||||
this.tableLayoutPanel4.Controls.Add(this.ProxyTimeoutLabel, 2, 0);
|
||||
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 25);
|
||||
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
|
||||
this.tableLayoutPanel4.RowCount = 1;
|
||||
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel4.Size = new System.Drawing.Size(387, 30);
|
||||
this.tableLayoutPanel4.TabIndex = 10;
|
||||
//
|
||||
// ProxyTypeLabel
|
||||
//
|
||||
this.ProxyTypeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyTypeLabel.AutoSize = true;
|
||||
this.ProxyTypeLabel.Location = new System.Drawing.Point(3, 9);
|
||||
this.ProxyTypeLabel.Location = new System.Drawing.Point(3, 40);
|
||||
this.ProxyTypeLabel.Name = "ProxyTypeLabel";
|
||||
this.ProxyTypeLabel.Size = new System.Drawing.Size(65, 12);
|
||||
this.ProxyTypeLabel.TabIndex = 1;
|
||||
@@ -222,30 +140,86 @@
|
||||
this.ProxyTypeComboBox.Items.AddRange(new object[] {
|
||||
"SOCKS5",
|
||||
"HTTP"});
|
||||
this.ProxyTypeComboBox.Location = new System.Drawing.Point(74, 5);
|
||||
this.ProxyTypeComboBox.Location = new System.Drawing.Point(74, 36);
|
||||
this.ProxyTypeComboBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||
this.ProxyTypeComboBox.Name = "ProxyTypeComboBox";
|
||||
this.ProxyTypeComboBox.Size = new System.Drawing.Size(121, 20);
|
||||
this.ProxyTypeComboBox.Size = new System.Drawing.Size(142, 20);
|
||||
this.ProxyTypeComboBox.TabIndex = 2;
|
||||
//
|
||||
// ProxyTimeoutTextBox
|
||||
//
|
||||
this.ProxyTimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyTimeoutTextBox.Location = new System.Drawing.Point(284, 4);
|
||||
this.ProxyTimeoutTextBox.Location = new System.Drawing.Point(305, 36);
|
||||
this.ProxyTimeoutTextBox.Name = "ProxyTimeoutTextBox";
|
||||
this.ProxyTimeoutTextBox.Size = new System.Drawing.Size(100, 21);
|
||||
this.ProxyTimeoutTextBox.Size = new System.Drawing.Size(58, 21);
|
||||
this.ProxyTimeoutTextBox.TabIndex = 3;
|
||||
//
|
||||
// ProxyTimeoutLabel
|
||||
//
|
||||
this.ProxyTimeoutLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyTimeoutLabel.AutoSize = true;
|
||||
this.ProxyTimeoutLabel.Location = new System.Drawing.Point(201, 9);
|
||||
this.ProxyTimeoutLabel.Location = new System.Drawing.Point(222, 40);
|
||||
this.ProxyTimeoutLabel.Name = "ProxyTimeoutLabel";
|
||||
this.ProxyTimeoutLabel.Size = new System.Drawing.Size(77, 12);
|
||||
this.ProxyTimeoutLabel.TabIndex = 4;
|
||||
this.ProxyTimeoutLabel.Text = "Timeout(Sec)";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel1.ColumnCount = 4;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.UseProxyCheckBox, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyTypeLabel, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyPortTextBox, 3, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyTypeComboBox, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyTimeoutLabel, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyPortLabel, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyTimeoutTextBox, 3, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyServerTextBox, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyAddrLabel, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.ProxyNotificationLabel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 4);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(15, 15);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 5;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.95122F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.95122F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.95122F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34.14634F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(366, 177);
|
||||
this.tableLayoutPanel1.TabIndex = 14;
|
||||
//
|
||||
// ProxyNotificationLabel
|
||||
//
|
||||
this.ProxyNotificationLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ProxyNotificationLabel.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.ProxyNotificationLabel, 4);
|
||||
this.ProxyNotificationLabel.ForeColor = System.Drawing.Color.Red;
|
||||
this.ProxyNotificationLabel.Location = new System.Drawing.Point(3, 111);
|
||||
this.ProxyNotificationLabel.Name = "ProxyNotificationLabel";
|
||||
this.ProxyNotificationLabel.Size = new System.Drawing.Size(360, 12);
|
||||
this.ProxyNotificationLabel.TabIndex = 5;
|
||||
this.ProxyNotificationLabel.Text = "If server has a plugin, proxy will not be used";
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 4);
|
||||
this.flowLayoutPanel1.Controls.Add(this.MyCancelButton);
|
||||
this.flowLayoutPanel1.Controls.Add(this.OKButton);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(204, 145);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(159, 29);
|
||||
this.flowLayoutPanel1.TabIndex = 6;
|
||||
//
|
||||
// ProxyForm
|
||||
//
|
||||
this.AcceptButton = this.OKButton;
|
||||
@@ -254,7 +228,7 @@
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.CancelButton = this.MyCancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(441, 165);
|
||||
this.ClientSize = new System.Drawing.Size(448, 231);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
@@ -266,32 +240,25 @@
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProxyForm_FormClosed);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.PerformLayout();
|
||||
this.tableLayoutPanel4.ResumeLayout(false);
|
||||
this.tableLayoutPanel4.PerformLayout();
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.CheckBox UseProxyCheckBox;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.Label ProxyAddrLabel;
|
||||
private System.Windows.Forms.TextBox ProxyServerTextBox;
|
||||
private System.Windows.Forms.Label ProxyPortLabel;
|
||||
private System.Windows.Forms.TextBox ProxyPortTextBox;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||
private System.Windows.Forms.Button MyCancelButton;
|
||||
private System.Windows.Forms.Button OKButton;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
|
||||
private System.Windows.Forms.Label ProxyTypeLabel;
|
||||
private System.Windows.Forms.ComboBox ProxyTypeComboBox;
|
||||
private System.Windows.Forms.TextBox ProxyTimeoutTextBox;
|
||||
private System.Windows.Forms.Label ProxyTimeoutLabel;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label ProxyNotificationLabel;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ namespace Shadowsocks.View
|
||||
ProxyAddrLabel.Text = I18N.GetString("Proxy Addr");
|
||||
ProxyPortLabel.Text = I18N.GetString("Proxy Port");
|
||||
ProxyTimeoutLabel.Text = I18N.GetString("Timeout(Sec)");
|
||||
ProxyNotificationLabel.Text = I18N.GetString("If server has a plugin, proxy will not be used");
|
||||
OKButton.Text = I18N.GetString("OK");
|
||||
MyCancelButton.Text = I18N.GetString("Cancel");
|
||||
this.Text = I18N.GetString("Edit Proxy");
|
||||
|
||||
@@ -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>
|
||||
@@ -145,6 +145,7 @@
|
||||
<Compile Include="Controller\Strategy\BalancingStrategy.cs" />
|
||||
<Compile Include="Controller\Strategy\StrategyManager.cs" />
|
||||
<Compile Include="Controller\Strategy\IStrategy.cs" />
|
||||
<Compile Include="Controller\Service\Sip003Plugin.cs" />
|
||||
<Compile Include="Proxy\Socks5Proxy.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="StringEx.cs" />
|
||||
|
||||
+223
-7
@@ -8,6 +8,7 @@ using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using Shadowsocks.Controller.Hotkeys;
|
||||
using Shadowsocks.Encryption.Stream;
|
||||
using Shadowsocks.Model;
|
||||
|
||||
namespace test
|
||||
{
|
||||
@@ -26,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)));
|
||||
}
|
||||
|
||||
@@ -41,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");
|
||||
@@ -224,5 +226,219 @@ namespace test
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseAndGenerateShadowsocksUrl()
|
||||
{
|
||||
var server = new Server
|
||||
{
|
||||
server = "192.168.100.1",
|
||||
server_port = 8888,
|
||||
password = "test",
|
||||
method = "bf-cfb"
|
||||
};
|
||||
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,
|
||||
server_port = server.server_port,
|
||||
password = server.password,
|
||||
method = server.method,
|
||||
remarks = "example-server"
|
||||
};
|
||||
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,
|
||||
server_port = server.server_port,
|
||||
password = server.password,
|
||||
method = server.method,
|
||||
plugin = "obfs-local",
|
||||
plugin_opts = "obfs=http;obfs-host=google.com"
|
||||
};
|
||||
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,
|
||||
server_port = server.server_port,
|
||||
password = server.password,
|
||||
method = server.method,
|
||||
plugin = serverWithPlugin.plugin,
|
||||
plugin_opts = serverWithPlugin.plugin_opts,
|
||||
remarks = serverWithRemark.remarks
|
||||
};
|
||||
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",
|
||||
serverCanonUrl,
|
||||
"\r\n",
|
||||
"ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4/",
|
||||
serverWithRemarkCanonUrl,
|
||||
"ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4/#example-server"),
|
||||
new[]
|
||||
{
|
||||
server,
|
||||
server,
|
||||
serverWithRemark,
|
||||
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",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888",
|
||||
"\r\n",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888/",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888#example-server",
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888/#example-server",
|
||||
serverWithPluginCanonUrl,
|
||||
serverWithPluginAndRemarkCanonUrl,
|
||||
"ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888/?plugin=obfs-local%3bobfs%3dhttp%3bobfs-host%3dgoogle.com&unsupported=1#example-server"),
|
||||
new[]
|
||||
{
|
||||
server,
|
||||
server,
|
||||
serverWithRemark,
|
||||
serverWithRemark,
|
||||
serverWithPlugin,
|
||||
serverWithPluginAndRemark,
|
||||
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,
|
||||
[serverWithRemarkCanonUrl] = serverWithRemark,
|
||||
[serverWithPluginCanonUrl] = serverWithPlugin,
|
||||
[serverWithPluginAndRemarkCanonUrl] = serverWithPluginAndRemark
|
||||
};
|
||||
RunGenerateShadowsocksUrlTest(generateUrlCases);
|
||||
}
|
||||
|
||||
private static void RunParseShadowsocksUrlTest(string testCase, IReadOnlyList<Server> expected)
|
||||
{
|
||||
var actual = Server.GetServers(testCase);
|
||||
if (actual.Count != expected.Count)
|
||||
{
|
||||
Assert.Fail("Wrong number of configs. Expected: {0}. Actual: {1}", expected.Count, actual.Count);
|
||||
}
|
||||
|
||||
for (int i = 0; i < expected.Count; i++)
|
||||
{
|
||||
var expectedServer = expected[i];
|
||||
var actualServer = actual[i];
|
||||
|
||||
Assert.AreEqual(expectedServer.server, actualServer.server);
|
||||
Assert.AreEqual(expectedServer.server_port, actualServer.server_port);
|
||||
Assert.AreEqual(expectedServer.password, actualServer.password);
|
||||
Assert.AreEqual(expectedServer.method, actualServer.method);
|
||||
Assert.AreEqual(expectedServer.plugin, actualServer.plugin);
|
||||
Assert.AreEqual(expectedServer.plugin_opts, actualServer.plugin_opts);
|
||||
Assert.AreEqual(expectedServer.remarks, actualServer.remarks);
|
||||
Assert.AreEqual(expectedServer.timeout, actualServer.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RunGenerateShadowsocksUrlTest(IReadOnlyDictionary<string, Server> testCases)
|
||||
{
|
||||
foreach (var testCase in testCases)
|
||||
{
|
||||
string expected = testCase.Key;
|
||||
Server config = testCase.Value;
|
||||
|
||||
var actual = ShadowsocksController.GetServerURL(config);
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user