Compare commits

...
15 Commits
Author SHA1 Message Date
noisyfox 09abe5642e Add x64 target support 2016-11-19 06:22:42 +11:00
Noisyfox 011fc253bb Merge pull request #888 from wongsyrone/hotkey
hotkey: Refine system proxy mode switching logic
2016-11-15 22:51:48 +11:00
Syrone Wong c25e70e888 hotkey: Refine system proxy mode switching logic
Merge 'Switch to PAC' and 'Switch to Global'

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-11-15 18:14:56 +08:00
noisyfox 964f681d3b Fix default font error. 2016-11-15 04:37:51 +11:00
noisyfox b63bab0d1a Refine LogViewerConfig. Don't store window size in main settings file 2016-11-15 04:23:59 +11:00
noisyfox 4b49431800 Parse dest address before connect to SS server.
This gives us the possibility to chose SS server based on dest address.
2016-11-14 09:58:48 +11:00
noisyfox cfc6e674da Catch and log known exceptions in SystemProxy 2016-11-12 19:38:47 +11:00
noisyfox 0101aa3741 Merge branch 'master' of https://github.com/shadowsocks/shadowsocks-windows 2016-11-12 19:23:33 +11:00
Noisyfox 1e9739116f Merge pull request #878 from wongsyrone/minor
Detach static event handler before exiting
2016-11-12 17:55:24 +11:00
Syrone Wong abcf3004ac Detach static event handler before exiting
I hope this is the last one.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-11-12 10:42:19 +08:00
Noisyfox 8b7b8d8219 Merge pull request #874 from wongsyrone/misc
Misc
2016-11-10 21:17:22 +11:00
Syrone Wong 199c204b5d Misc
- detach event handler before exiting
- eliminate UI and non-UI exception handling race
- rework exception message

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-11-10 08:45:13 +08:00
Noisyfox bce876f42e Merge pull request #869 from wongsyrone/master
Refine RNG usage
2016-11-09 22:35:17 +11:00
Syrone Wong 8fcb66b6ff Refine RNG usage
- Create instance once, bind it to ShadowsocksController

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-11-09 10:28:50 +08:00
noisyfox da6466e247 Improve exception handling 2016-11-08 18:49:09 +11:00
38 changed files with 711 additions and 375 deletions
+11
View File
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Net.Sockets;
using System.Net;
@@ -123,6 +124,16 @@ namespace Shadowsocks.Controller
else if (e is ObjectDisposedException)
{
}
else if (e is Win32Exception)
{
var ex = (Win32Exception) e;
// Win32Exception (0x80004005): A 32 bit processes cannot access modules of a 64 bit process.
if ((uint) ex.ErrorCode != 0x80004005)
{
Info(e);
}
}
else
{
Info(e);
@@ -125,43 +125,32 @@ namespace Shadowsocks.Controller
private static bool IsChildProcess(Process process)
{
if (Utils.IsPortableMode())
try
{
/*
* Under PortableMode, we could identify it by the path of ss_privoxy.exe.
*/
try
if (Utils.IsPortableMode())
{
/*
* Sometimes Process.GetProcessesByName will return some processes that
* are already dead, and that will cause exceptions here.
* We could simply ignore those exceptions.
* Under PortableMode, we could identify it by the path of ss_privoxy.exe.
*/
string path = process.MainModule.FileName;
var path = process.MainModule.FileName;
return Utils.GetTempPath("ss_privoxy.exe").Equals(path);
}
catch (Exception ex)
{
Logging.LogUsefulException(ex);
return false;
}
}
else
{
try
else
{
var cmd = process.GetCommandLine();
return cmd.Contains(UniqueConfigFile);
}
catch (Win32Exception ex)
{
if ((uint) ex.ErrorCode != 0x80004005)
{
throw;
}
}
}
catch (Exception ex)
{
/*
* Sometimes Process.GetProcessesByName will return some processes that
* are already dead, and that will cause exceptions here.
* We could simply ignore those exceptions.
*/
Logging.LogUsefulException(ex);
return false;
}
}
+124 -59
View File
@@ -168,6 +168,8 @@ namespace Shadowsocks.Controller
private DateTime _startReceivingTime;
private DateTime _startSendingTime;
private EndPoint _destEndPoint = null;
public TCPHandler(ShadowsocksController controller, Configuration config, TCPRelay tcprelay, Socket socket)
{
_controller = controller;
@@ -182,7 +184,7 @@ namespace Shadowsocks.Controller
public void CreateRemote()
{
Server server = _controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)_connection.RemoteEndPoint);
Server server = _controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)_connection.RemoteEndPoint, _destEndPoint);
if (server == null || server.server == "")
throw new ArgumentException("No server configured");
lock (_encryptionLock)
@@ -286,9 +288,11 @@ namespace Shadowsocks.Controller
// +-----+-----+-------+------+----------+----------+
// | 1 | 1 | X'00' | 1 | Variable | 2 |
// +-----+-----+-------+------+----------+----------+
// Skip first 3 bytes
// Skip first 3 bytes, and read 2 more bytes to analysis the address.
// 2 more bytes is designed if address is domain then we don't need to read once more to get the addr length.
// TODO validate
_connection.BeginReceive(_connetionRecvBuffer, 0, 3, SocketFlags.None, new AsyncCallback(handshakeReceive2Callback), null);
_connection.BeginReceive(_connetionRecvBuffer, 0, 3 + 2, SocketFlags.None,
new AsyncCallback(handshakeReceive2Callback), null);
}
catch (Exception e)
{
@@ -303,16 +307,36 @@ namespace Shadowsocks.Controller
try
{
int bytesRead = _connection.EndReceive(ar);
if (bytesRead >= 3)
if (bytesRead >= 5)
{
_command = _connetionRecvBuffer[1];
if (_command == 1)
if (_command != 1 && _command != 3)
{
byte[] response = { 5, 0, 0, 1, 0, 0, 0, 0, 0, 0 };
_connection.BeginSend(response, 0, response.Length, SocketFlags.None, new AsyncCallback(ResponseCallback), null);
Logging.Debug("Unsupported CMD=" + _command);
Close();
}
else
{
int atyp = _connetionRecvBuffer[3];
switch (atyp)
{
case 1: // IPv4 address, 4 bytes
ReadAddress(4 + 2 - 1);
break;
case 3: // domain name, length + str
int len = _connetionRecvBuffer[4];
ReadAddress(len + 2);
break;
case 4: // IPv6 address, 16 bytes
ReadAddress(16 + 2 - 1);
break;
default:
Logging.Debug("Unsupported ATYP=" + atyp);
Close();
break;
}
}
else if (_command == 3)
HandleUDPAssociate();
}
else
{
@@ -327,6 +351,79 @@ namespace Shadowsocks.Controller
}
}
private void ReadAddress(int bytesRemain)
{
Array.Copy(_connetionRecvBuffer, 3, _connetionRecvBuffer, 0, 2);
// Read the remain address bytes
_connection.BeginReceive(_connetionRecvBuffer, 2, RecvSize - 2, SocketFlags.None, OnAddressFullyRead, bytesRemain);
}
private void OnAddressFullyRead(IAsyncResult ar)
{
if (_closed) return;
try
{
int bytesRead = _connection.EndReceive(ar);
int bytesRemain = (int) ar.AsyncState;
if (bytesRead >= bytesRemain)
{
_firstPacketLength = bytesRead + 2;
int atyp = _connetionRecvBuffer[0];
string dst_addr = "Unknown";
int dst_port = -1;
switch (atyp)
{
case 1: // IPv4 address, 4 bytes
dst_addr = new IPAddress(_connetionRecvBuffer.Skip(1).Take(4).ToArray()).ToString();
dst_port = (_connetionRecvBuffer[5] << 8) + _connetionRecvBuffer[6];
break;
case 3: // domain name, length + str
int len = _connetionRecvBuffer[1];
dst_addr = System.Text.Encoding.UTF8.GetString(_connetionRecvBuffer, 2, len);
dst_port = (_connetionRecvBuffer[len + 2] << 8) + _connetionRecvBuffer[len + 3];
break;
case 4: // IPv6 address, 16 bytes
dst_addr = $"[{new IPAddress(_connetionRecvBuffer.Skip(1).Take(16).ToArray())}]";
dst_port = (_connetionRecvBuffer[17] << 8) + _connetionRecvBuffer[18];
break;
}
if (_config.isVerboseLogging)
{
Logging.Info($"connect to {dst_addr}:{dst_port}");
}
_destEndPoint = SocketUtil.GetEndPoint(dst_addr, dst_port);
if (_command == 1)
{
byte[] response = {5, 0, 0, 1, 0, 0, 0, 0, 0, 0};
_connection.BeginSend(response, 0, response.Length, SocketFlags.None,
new AsyncCallback(ResponseCallback), null);
}
else if (_command == 3)
{
HandleUDPAssociate();
}
}
else
{
Logging.Debug("failed to recv data in Shadowsocks.Controller.TCPHandler.OnAddressFullyRead()");
Close();
}
}
catch (Exception e)
{
Logging.LogUsefulException(e);
Close();
}
}
private void HandleUDPAssociate()
{
IPEndPoint endPoint = (IPEndPoint)_connection.LocalEndPoint;
@@ -612,8 +709,7 @@ namespace Shadowsocks.Controller
{
_startReceivingTime = DateTime.Now;
session.Remote.BeginReceive(_remoteRecvBuffer, 0, RecvSize, SocketFlags.None, new AsyncCallback(PipeRemoteReceiveCallback), session);
_connection.BeginReceive(_connetionRecvBuffer, 0, RecvSize, SocketFlags.None, new AsyncCallback(PipeConnectionReceiveCallback),
new AsyncSession<bool>(session, true) /* to tell the callback this is the first time reading packet, and we haven't found the header yet. */);
SendToServer(_firstPacketLength, session);
}
catch (Exception e)
{
@@ -663,59 +759,13 @@ namespace Shadowsocks.Controller
try
{
int bytesRead = _connection.EndReceive(ar);
_totalWrite += bytesRead;
var session = (AsyncSession<bool>) ar.AsyncState;
var session = (AsyncSession) ar.AsyncState;
var remote = session.Remote;
if (bytesRead > 0)
{
/*
* Only the first packet contains the socks5 header, it doesn't make sense to parse every packets.
* Also it's unnecessary to parse these data if we turn off the VerboseLogging.
*/
if (session.State && _config.isVerboseLogging)
{
int atyp = _connetionRecvBuffer[0];
string dst_addr;
int dst_port;
switch (atyp)
{
case 1: // IPv4 address, 4 bytes
dst_addr = new IPAddress(_connetionRecvBuffer.Skip(1).Take(4).ToArray()).ToString();
dst_port = (_connetionRecvBuffer[5] << 8) + _connetionRecvBuffer[6];
Logging.Info($"connect to {dst_addr}:{dst_port}");
session.State = false;
break;
case 3: // domain name, length + str
int len = _connetionRecvBuffer[1];
dst_addr = System.Text.Encoding.UTF8.GetString(_connetionRecvBuffer, 2, len);
dst_port = (_connetionRecvBuffer[len + 2] << 8) + _connetionRecvBuffer[len + 3];
Logging.Info($"connect to {dst_addr}:{dst_port}");
session.State = false;
break;
case 4: // IPv6 address, 16 bytes
dst_addr = new IPAddress(_connetionRecvBuffer.Skip(1).Take(16).ToArray()).ToString();
dst_port = (_connetionRecvBuffer[17] << 8) + _connetionRecvBuffer[18];
Logging.Info($"connect to [{dst_addr}]:{dst_port}");
session.State = false;
break;
}
}
int bytesToSend;
lock (_encryptionLock)
{
_encryptor.Encrypt(_connetionRecvBuffer, bytesRead, _connetionSendBuffer, out bytesToSend);
}
_tcprelay.UpdateOutboundCounter(_server, bytesToSend);
_startSendingTime = DateTime.Now;
remote.BeginSend(_connetionSendBuffer, 0, bytesToSend, SocketFlags.None, new AsyncCallback(PipeRemoteSendCallback), session);
IStrategy strategy = _controller.GetCurrentStrategy();
strategy?.UpdateLastWrite(_server);
SendToServer(bytesRead, session);
}
else
{
@@ -731,6 +781,21 @@ namespace Shadowsocks.Controller
}
}
private void SendToServer(int length, AsyncSession session)
{
_totalWrite += length;
int bytesToSend;
lock (_encryptionLock)
{
_encryptor.Encrypt(_connetionRecvBuffer, length, _connetionSendBuffer, out bytesToSend);
}
_tcprelay.UpdateOutboundCounter(_server, bytesToSend);
_startSendingTime = DateTime.Now;
session.Remote.BeginSend(_connetionSendBuffer, 0, bytesToSend, SocketFlags.None, new AsyncCallback(PipeRemoteSendCallback), session);
IStrategy strategy = _controller.GetCurrentStrategy();
strategy?.UpdateLastWrite(_server);
}
private void PipeRemoteSendCallback(IAsyncResult ar)
{
if (_closed) return;
@@ -39,7 +39,7 @@ namespace Shadowsocks.Controller
UDPHandler handler = _cache.get(remoteEndPoint);
if (handler == null)
{
handler = new UDPHandler(socket, _controller.GetAServer(IStrategyCallerType.UDP, remoteEndPoint), remoteEndPoint);
handler = new UDPHandler(socket, _controller.GetAServer(IStrategyCallerType.UDP, remoteEndPoint, null/*TODO: fix this*/), remoteEndPoint);
_cache.add(remoteEndPoint, handler);
}
handler.Send(firstPacket, length);
@@ -139,12 +139,12 @@ namespace Shadowsocks.Controller
return null;
}
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint)
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint, EndPoint destEndPoint)
{
IStrategy strategy = GetCurrentStrategy();
if (strategy != null)
{
return strategy.GetAServer(type, localIPEndPoint);
return strategy.GetAServer(type, localIPEndPoint, destEndPoint);
}
if (_config.index < 0)
{
@@ -272,6 +272,7 @@ namespace Shadowsocks.Controller
{
SystemProxy.Update(_config, true);
}
Encryption.RNG.Close();
}
public void TouchPACFile()
@@ -358,6 +359,7 @@ namespace Shadowsocks.Controller
public void SaveLogViewerConfig(LogViewerConfig newConfig)
{
_config.logViewer = newConfig;
newConfig.SaveSize();
Configuration.Save(_config);
if (ConfigChanged != null)
{
@@ -413,6 +415,7 @@ namespace Shadowsocks.Controller
protected void Reload()
{
Encryption.RNG.Reload();
// some logic in configuration updated the config when saving, we need to read it again
_config = Configuration.Load();
StatisticsConfiguration = StatisticsStrategyConfiguration.Load();
@@ -33,7 +33,7 @@ namespace Shadowsocks.Controller.Strategy
// do nothing
}
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint)
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint, EndPoint destEndPoint)
{
var configs = _controller.GetCurrentConfiguration().configs;
int index;
@@ -1,6 +1,7 @@
using Shadowsocks.Model;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
namespace Shadowsocks.Controller.Strategy
@@ -78,7 +79,7 @@ namespace Shadowsocks.Controller.Strategy
ChooseNewServer();
}
public Server GetAServer(IStrategyCallerType type, System.Net.IPEndPoint localIPEndPoint)
public Server GetAServer(IStrategyCallerType type, System.Net.IPEndPoint localIPEndPoint, EndPoint destEndPoint)
{
if (type == IStrategyCallerType.TCP)
{
@@ -31,7 +31,7 @@ namespace Shadowsocks.Controller.Strategy
/*
* Get a new server to use in TCPRelay or UDPRelay
*/
Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint);
Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint, EndPoint destEndPoint);
/*
* TCPRelay will call this when latency of a server detected
@@ -127,7 +127,7 @@ namespace Shadowsocks.Controller.Strategy
public string Name => I18N.GetString("Choose by statistics");
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint)
public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint, EndPoint destEndPoint)
{
if (_currentServer == null)
{
@@ -21,25 +21,32 @@ namespace Shadowsocks.Controller
enabled = false;
}
if (enabled)
try
{
if (global)
if (enabled)
{
WinINet.SetIEProxy(true, true, "127.0.0.1:" + config.localPort.ToString(), "");
if (global)
{
WinINet.SetIEProxy(true, true, "127.0.0.1:" + config.localPort.ToString(), "");
}
else
{
string pacUrl;
if (config.useOnlinePac && !config.pacUrl.IsNullOrEmpty())
pacUrl = config.pacUrl;
else
pacUrl = $"http://127.0.0.1:{config.localPort}/pac?t={GetTimestamp(DateTime.Now)}";
WinINet.SetIEProxy(true, false, "", pacUrl);
}
}
else
{
string pacUrl;
if (config.useOnlinePac && !config.pacUrl.IsNullOrEmpty())
pacUrl = config.pacUrl;
else
pacUrl = $"http://127.0.0.1:{config.localPort}/pac?t={GetTimestamp(DateTime.Now)}";
WinINet.SetIEProxy(true, false, "", pacUrl);
WinINet.SetIEProxy(false, false, "", "");
}
}
else
catch (ProxyException ex)
{
WinINet.SetIEProxy(false, false, "", "");
Logging.LogUsefulException(ex);
}
}
}
+1 -2
View File
@@ -91,8 +91,7 @@ Please input PAC Url=请输入 PAC 网址
# HotkeySettings Form
Switch system proxy=切换系统代理状态
Switch to PAC mode=切换到PAC模式
Switch to Global mode=切换到全局模式
Switch system proxy mode=切换系统代理模式
Switch share over LAN=切换局域网共享
Show Logs=显示日志
Switch to prev server=切换上个服务器
Binary file not shown.
+5 -6
View File
@@ -90,13 +90,12 @@ Please input PAC Url=請輸入 PAC 網址
# HotkeySettings Form
Switch system proxy=切换系統代理狀態
Switch to PAC mode=切换為PAC模式
Switch to Global mode=切换為全局模式
Switch share over LAN=切换區域網路共享
Switch system proxy=切換系統代理狀態
Switch system proxy mode=切換系統代理模式
Switch share over LAN=切換區域網路共享
Show Logs=顯示日誌
Switch to prev server=切换上個伺服器
Switch to next server=切换下個伺服器
Switch to prev server=切換上個伺服器
Switch to next server=切換下個伺服器
Reg All=註冊全部捷徑鍵
# Messages
+1 -6
View File
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Net;
@@ -237,10 +235,7 @@ namespace Shadowsocks.Encryption
protected static void randBytes(byte[] buf, int length)
{
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
{
rng.GetBytes(buf, 0, length);
}
RNG.GetBytes(buf, length);
}
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
+4
View File
@@ -20,7 +20,11 @@ namespace Shadowsocks.Encryption
string dllPath = Utils.GetTempPath("libsscrypto.dll");
try
{
#if _X64
FileManager.UncompressFile(dllPath, Resources.libsscrypto64_dll);
#else
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll);
#endif
}
catch (IOException)
{
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Security.Cryptography;
namespace Shadowsocks.Encryption
{
public static class RNG
{
private static RNGCryptoServiceProvider _rng = null;
public static void Init()
{
if (_rng == null)
_rng = new RNGCryptoServiceProvider();
}
public static void Close()
{
if (_rng == null) return;
_rng.Dispose();
_rng = null;
}
public static void Reload()
{
Close();
Init();
}
public static void GetBytes(byte[] buf, int len)
{
try
{
_rng.GetBytes(buf, 0, len);
}
catch (Exception)
{
// the backup way
byte[] tmp = new byte[len];
_rng.GetBytes(tmp);
Buffer.BlockCopy(tmp, 0, buf, 0, len);
}
}
}
}
+4
View File
@@ -17,7 +17,11 @@ namespace Shadowsocks.Encryption
string dllPath = Utils.GetTempPath("libsscrypto.dll");
try
{
#if _X64
FileManager.UncompressFile(dllPath, Resources.libsscrypto64_dll);
#else
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll);
#endif
}
catch (IOException)
{
+2 -4
View File
@@ -65,10 +65,8 @@ namespace Shadowsocks.Model
if (config.hotkey == null)
config.hotkey = new HotkeyConfig();
if (config.proxy.proxyType < ProxyConfig.PROXY_SOCKS5 || config.proxy.proxyType > ProxyConfig.PROXY_HTTP)
{
config.proxy.proxyType = ProxyConfig.PROXY_SOCKS5;
}
config.proxy.CheckConfig();
return config;
}
catch (Exception e)
+2 -4
View File
@@ -12,8 +12,7 @@ namespace Shadowsocks.Model
public class HotkeyConfig
{
public string SwitchSystemProxy;
public string ChangeToPac;
public string ChangeToGlobal;
public string SwitchSystemProxyMode;
public string SwitchAllowLan;
public string ShowLogs;
public string ServerMoveUp;
@@ -22,8 +21,7 @@ namespace Shadowsocks.Model
public HotkeyConfig()
{
SwitchSystemProxy = "";
ChangeToPac = "";
ChangeToGlobal = "";
SwitchSystemProxyMode = "";
SwitchAllowLan = "";
ShowLogs = "";
ServerMoveUp = "";
+61 -72
View File
@@ -1,105 +1,94 @@
using Shadowsocks.View;
using System;
using System;
using System.Drawing;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace Shadowsocks.Model
{
[Serializable]
public class LogViewerConfig
{
public string fontName;
public float fontSize;
public string bgColor;
public string textColor;
public bool topMost;
public bool wrapText;
public bool toolbarShown;
public int width;
public int height;
public int top;
public int left;
public bool maximized;
public Font Font { get; set; } = new Font("Consolas", 8F);
public Color BackgroundColor { get; set; } = Color.Black;
public Color TextColor { get; set; } = Color.White;
public LogViewerConfig()
{
fontName = "Consolas";
fontSize = 8;
bgColor = "black";
textColor = "white";
topMost = false;
wrapText = false;
toolbarShown = false;
width = 600;
height = 400;
left = GetBestLeft();
top = GetBestTop();
maximized = true;
}
#region Size
public void SaveSize()
{
Properties.Settings.Default.Save();
}
[JsonIgnore]
public int Width
{
get { return Properties.Settings.Default.LogViewerWidth; }
set { Properties.Settings.Default.LogViewerWidth = value; }
}
[JsonIgnore]
public int Height
{
get { return Properties.Settings.Default.LogViewerHeight; }
set { Properties.Settings.Default.LogViewerHeight = value; }
}
[JsonIgnore]
public int Top
{
get { return Properties.Settings.Default.LogViewerTop; }
set { Properties.Settings.Default.LogViewerTop = value; }
}
[JsonIgnore]
public int Left
{
get { return Properties.Settings.Default.LogViewerLeft; }
set { Properties.Settings.Default.LogViewerLeft = value; }
}
[JsonIgnore]
public bool Maximized
{
get { return Properties.Settings.Default.LogViewerMaximized; }
set { Properties.Settings.Default.LogViewerMaximized = value; }
}
[JsonIgnore]
// Use GetBestTop() and GetBestLeft() to ensure the log viwer form can be always display IN screen.
public int GetBestLeft()
public int BestLeft
{
width = (width >= 400) ? width : 400; // set up the minimum size
return Screen.PrimaryScreen.WorkingArea.Width - width;
}
public int GetBestTop()
{
height = (height >= 200) ? height : 200; // set up the minimum size
return Screen.PrimaryScreen.WorkingArea.Height - height;
}
public Font GetFont()
{
try
get
{
return new Font(fontName, fontSize, FontStyle.Regular);
}
catch (Exception)
{
return new Font("Console", 8F);
int width = Width;
width = (width >= 400) ? width : 400; // set up the minimum size
return Screen.PrimaryScreen.WorkingArea.Width - width;
}
}
public void SetFont(Font font)
[JsonIgnore]
public int BestTop
{
fontName = font.Name;
fontSize = font.Size;
}
public Color GetBackgroundColor()
{
try
get
{
return ColorTranslator.FromHtml(bgColor);
}
catch (Exception)
{
return ColorTranslator.FromHtml("black");
int height = Height;
height = (height >= 200) ? height : 200; // set up the minimum size
return Screen.PrimaryScreen.WorkingArea.Height - height;
}
}
public void SetBackgroundColor(Color color)
{
bgColor = ColorTranslator.ToHtml(color);
}
#endregion
public Color GetTextColor()
{
try
{
return ColorTranslator.FromHtml(textColor);
}
catch (Exception)
{
return ColorTranslator.FromHtml("white");
}
}
public void SetTextColor(Color color)
{
textColor = ColorTranslator.ToHtml(color);
}
}
}
+8
View File
@@ -25,5 +25,13 @@ namespace Shadowsocks.Model
proxyPort = 0;
proxyTimeout = DefaultProxyTimeoutSec;
}
public void CheckConfig()
{
if (proxyType < PROXY_SOCKS5 || proxyType > PROXY_HTTP)
{
proxyType = PROXY_SOCKS5;
}
}
}
}
+15 -8
View File
@@ -92,9 +92,10 @@ namespace Shadowsocks
{
if (Interlocked.Increment(ref exited) == 1)
{
Logging.Error(e.ExceptionObject?.ToString());
string errMsg = e.ExceptionObject.ToString();
Logging.Error(errMsg);
MessageBox.Show(
$"{I18N.GetString("Unexpected error, shadowsocks will exit. Please report to")} https://github.com/shadowsocks/shadowsocks-windows/issues {Environment.NewLine}{e.ExceptionObject?.ToString()}",
$"{I18N.GetString("Unexpected error, shadowsocks will exit. Please report to")} https://github.com/shadowsocks/shadowsocks-windows/issues {Environment.NewLine}{errMsg}",
"Shadowsocks non-UI Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
@@ -102,12 +103,15 @@ namespace Shadowsocks
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
string errorMsg = $"Exception Type: {e.Exception.GetType().Name}{Environment.NewLine}Stack Trace:{Environment.NewLine}{e.Exception.StackTrace}";
Logging.Error(errorMsg);
MessageBox.Show(
$"{I18N.GetString("Unexpected error, shadowsocks will exit. Please report to")} https://github.com/shadowsocks/shadowsocks-windows/issues {Environment.NewLine}{errorMsg}",
"Shadowsocks UI Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
if (Interlocked.Increment(ref exited) == 1)
{
string errorMsg = $"Exception Detail: {Environment.NewLine}{e.Exception}";
Logging.Error(errorMsg);
MessageBox.Show(
$"{I18N.GetString("Unexpected error, shadowsocks will exit. Please report to")} https://github.com/shadowsocks/shadowsocks-windows/issues {Environment.NewLine}{errorMsg}",
"Shadowsocks UI Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
@@ -168,7 +172,10 @@ namespace Shadowsocks
private static void Application_ApplicationExit(object sender, EventArgs e)
{
// detach static event handlers
Application.ApplicationExit -= Application_ApplicationExit;
SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
Application.ThreadException -= Application_ThreadException;
HotKeys.Destroy();
if (_controller != null)
{
+33 -23
View File
@@ -111,6 +111,16 @@ namespace Shadowsocks.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] libsscrypto64_dll {
get {
object obj = ResourceManager.GetObject("libsscrypto64_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
@@ -227,29 +237,29 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// 查找类似 # translation for Traditional Chinese
///
///Shadowsocks=Shadowsocks
///
///# Menu items
///
///Enable System Proxy=啟用系統代理
///Mode=系統代理模式
///PAC=PAC 模式
///Global=全局模式
///Servers=伺服器
///Edit Servers...=編輯伺服器...
///Statistics Config...=統計配置...
///Start on Boot=開機啟動
///Forward Proxy...=正向代理設置...
///Allow Clients from LAN=允許來自區域網路的連接
///Local PAC=使用本地 PAC
///Online PAC=使用在線 PAC
///Edit Local PAC File...=編輯本地 PAC 文件...
///Update Local PAC from GFWList=從 GFWList 更新本地 PAC
///Edit User Rule for GFWList...=編輯 GFWList 的用戶規則...
///Show QRCode...=顯示 QR 碼...
///Scan QRCode from Screen [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 # translation for Traditional Chinese
///
///Shadowsocks=Shadowsocks
///
///# Menu items
///
///Enable System Proxy=啟用系統代理
///Mode=系統代理模式
///PAC=PAC 模式
///Global=全局模式
///Servers=伺服器
///Edit Servers...=編輯伺服器...
///Statistics Config...=統計配置...
///Start on Boot=開機啟動
///Forward Proxy...=正向代理設置...
///Allow Clients from LAN=允許來自區域網路的連接
///Local PAC=使用本地 PAC
///Online PAC=使用在線 PAC
///Edit Local PAC File...=編輯本地 PAC 文件...
///Update Local PAC from GFWList=從 GFWList 更新本地 PAC
///Edit User Rule for GFWList...=編輯 GFWList 的用戶規則...
///Show QRCode...=顯示 QR 碼...
///S [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string zh_tw {
get {
+4 -1
View File
@@ -124,8 +124,11 @@
<data name="cn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\cn.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="libsscrypto64_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\libsscrypto64.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>..\Data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="mgwz_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\mgwz.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+86
View File
@@ -0,0 +1,86 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Shadowsocks.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("600")]
public int LogViewerWidth {
get {
return ((int)(this["LogViewerWidth"]));
}
set {
this["LogViewerWidth"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("400")]
public int LogViewerHeight {
get {
return ((int)(this["LogViewerHeight"]));
}
set {
this["LogViewerHeight"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool LogViewerMaximized {
get {
return ((bool)(this["LogViewerMaximized"]));
}
set {
this["LogViewerMaximized"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int LogViewerTop {
get {
return ((int)(this["LogViewerTop"]));
}
set {
this["LogViewerTop"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int LogViewerLeft {
get {
return ((int)(this["LogViewerLeft"]));
}
set {
this["LogViewerLeft"] = value;
}
}
}
}
@@ -0,0 +1,21 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Shadowsocks.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LogViewerWidth" Type="System.Int32" Scope="User">
<Value Profile="(Default)">600</Value>
</Setting>
<Setting Name="LogViewerHeight" Type="System.Int32" Scope="User">
<Value Profile="(Default)">400</Value>
</Setting>
<Setting Name="LogViewerMaximized" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LogViewerTop" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LogViewerLeft" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
+28
View File
@@ -0,0 +1,28 @@
namespace Shadowsocks.Properties {
// 通过此类可以处理设置类的特定事件:
// 在更改某个设置的值之前将引发 SettingChanging 事件。
// 在更改某个设置的值之后将引发 PropertyChanged 事件。
// 在加载设置值之后将引发 SettingsLoaded 事件。
// 在保存设置值之前将引发 SettingsSaving 事件。
internal sealed partial class Settings {
public Settings() {
// // 若要为保存和更改设置添加事件处理程序,请取消注释下列行:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// 在此处添加用于处理 SettingChangingEvent 事件的代码。
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// 在此处添加用于处理 SettingsSaving 事件的代码。
}
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Shadowsocks.Util.SystemProxy
{
class ProxyException : Exception
{
public ProxyException()
{
}
public ProxyException(string message) : base(message)
{
}
public ProxyException(string message, Exception innerException) : base(message, innerException)
{
}
protected ProxyException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using Shadowsocks.Controller;
@@ -92,7 +93,7 @@ namespace Shadowsocks.Util.SystemProxy
foreach (INTERNET_PER_CONN_OPTION eachOption in _optionlist)
{
Marshal.StructureToPtr(eachOption, current, false);
current = (IntPtr)((int)current + Marshal.SizeOf(eachOption));
current = (IntPtr)(current.ToInt64() + Marshal.SizeOf(eachOption));
}
// Initialize a INTERNET_PER_CONN_OPTION_LIST instance.
@@ -131,7 +132,7 @@ namespace Shadowsocks.Util.SystemProxy
// Throw an exception if this operation failed.
if (!bReturn)
{
throw new Exception("InternetSetOption: " + Marshal.GetLastWin32Error());
throw new ProxyException("InternetSetOption failed.", new Win32Exception());
}
// Notify the system that the registry settings have been changed and cause
@@ -161,7 +162,7 @@ namespace Shadowsocks.Util.SystemProxy
var ret = RemoteAccessService.GetAllConns(ref allConnections);
if (ret == 2)
throw new Exception("Cannot get all connections");
throw new ProxyException("Cannot get all connections");
if (ret == 1)
{
+10 -19
View File
@@ -24,8 +24,8 @@ namespace Shadowsocks.View
private IEnumerable<TextBox> _allTextBoxes;
private static Label _lb = null;
private static HotKeys.HotKeyCallBackHandler _callBack = null;
private Label _lb = null;
private HotKeys.HotKeyCallBackHandler _callBack = null;
public HotkeySettingsForm(ShadowsocksController controller)
{
@@ -57,8 +57,7 @@ namespace Shadowsocks.View
private void LoadConfiguration(HotkeyConfig config)
{
SwitchSystemProxyTextBox.Text = config.SwitchSystemProxy;
ChangeToPacTextBox.Text = config.ChangeToPac;
ChangeToGlobalTextBox.Text = config.ChangeToGlobal;
SwitchProxyModeTextBox.Text = config.SwitchSystemProxyMode;
SwitchAllowLanTextBox.Text = config.SwitchAllowLan;
ShowLogsTextBox.Text = config.ShowLogs;
ServerMoveUpTextBox.Text = config.ServerMoveUp;
@@ -69,8 +68,7 @@ namespace Shadowsocks.View
{
// I18N stuff
SwitchSystemProxyLabel.Text = I18N.GetString("Switch system proxy");
ChangeToPacLabel.Text = I18N.GetString("Switch to PAC mode");
ChangeToGlobalLabel.Text = I18N.GetString("Switch to Global mode");
SwitchProxyModeLabel.Text = I18N.GetString("Switch system proxy mode");
SwitchAllowLanLabel.Text = I18N.GetString("Switch share over LAN");
ShowLogsLabel.Text = I18N.GetString("Show Logs");
ServerMoveUpLabel.Text = I18N.GetString("Switch to prev server");
@@ -237,8 +235,7 @@ namespace Shadowsocks.View
private void SaveConfig()
{
_modifiedConfig.SwitchSystemProxy = SwitchSystemProxyTextBox.Text;
_modifiedConfig.ChangeToPac = ChangeToPacTextBox.Text;
_modifiedConfig.ChangeToGlobal = ChangeToGlobalTextBox.Text;
_modifiedConfig.SwitchSystemProxyMode = SwitchProxyModeTextBox.Text;
_modifiedConfig.SwitchAllowLan = SwitchAllowLanTextBox.Text;
_modifiedConfig.ShowLogs = ShowLogsTextBox.Text;
_modifiedConfig.ServerMoveUp = ServerMoveUpTextBox.Text;
@@ -254,18 +251,12 @@ namespace Shadowsocks.View
_controller.ToggleEnable(!enabled);
}
private void ChangeToPacCallback()
private void SwitchProxyModeCallback()
{
bool enabled = _controller.GetConfigurationCopy().enabled;
if (enabled == false) return;
_controller.ToggleGlobal(false);
}
private void ChangeToGlobalCallback()
{
bool enabled = _controller.GetConfigurationCopy().enabled;
if (enabled == false) return;
_controller.ToggleGlobal(true);
var config = _controller.GetConfigurationCopy();
if (config.enabled == false) return;
var currStatus = config.global;
_controller.ToggleGlobal(!currStatus);
}
private void SwitchAllowLanCallback()
+66 -97
View File
@@ -34,15 +34,13 @@
this.btnRegisterAll = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.SwitchSystemProxyLabel = new System.Windows.Forms.Label();
this.ChangeToPacLabel = new System.Windows.Forms.Label();
this.ChangeToGlobalLabel = new System.Windows.Forms.Label();
this.SwitchProxyModeLabel = new System.Windows.Forms.Label();
this.SwitchAllowLanLabel = new System.Windows.Forms.Label();
this.ShowLogsLabel = new System.Windows.Forms.Label();
this.ServerMoveUpLabel = new System.Windows.Forms.Label();
this.ServerMoveDownLabel = new System.Windows.Forms.Label();
this.SwitchSystemProxyTextBox = new System.Windows.Forms.TextBox();
this.ChangeToPacTextBox = new System.Windows.Forms.TextBox();
this.ChangeToGlobalTextBox = new System.Windows.Forms.TextBox();
this.SwitchProxyModeTextBox = new System.Windows.Forms.TextBox();
this.SwitchAllowLanTextBox = new System.Windows.Forms.TextBox();
this.ShowLogsTextBox = new System.Windows.Forms.TextBox();
this.ServerMoveUpTextBox = new System.Windows.Forms.TextBox();
@@ -59,18 +57,18 @@
flowLayoutPanel1.Controls.Add(this.btnCancel);
flowLayoutPanel1.Controls.Add(this.btnRegisterAll);
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.BottomUp;
flowLayoutPanel1.Location = new System.Drawing.Point(0, 227);
flowLayoutPanel1.Location = new System.Drawing.Point(0, 205);
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
flowLayoutPanel1.Name = "flowLayoutPanel1";
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 0, 16, 0);
flowLayoutPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
flowLayoutPanel1.Size = new System.Drawing.Size(475, 44);
flowLayoutPanel1.Size = new System.Drawing.Size(475, 43);
flowLayoutPanel1.TabIndex = 6;
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(333, 10);
this.btnOK.Location = new System.Drawing.Point(333, 9);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(123, 31);
this.btnOK.TabIndex = 0;
@@ -81,7 +79,7 @@
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(204, 10);
this.btnCancel.Location = new System.Drawing.Point(204, 9);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(123, 31);
this.btnCancel.TabIndex = 1;
@@ -92,7 +90,7 @@
// btnRegisterAll
//
this.btnRegisterAll.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnRegisterAll.Location = new System.Drawing.Point(75, 10);
this.btnRegisterAll.Location = new System.Drawing.Point(75, 9);
this.btnRegisterAll.Name = "btnRegisterAll";
this.btnRegisterAll.Size = new System.Drawing.Size(123, 31);
this.btnRegisterAll.TabIndex = 2;
@@ -106,79 +104,65 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.SwitchSystemProxyLabel, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.ChangeToPacLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.ChangeToGlobalLabel, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.SwitchAllowLanLabel, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.ShowLogsLabel, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveUpLabel, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveDownLabel, 0, 6);
this.tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.SwitchProxyModeLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.SwitchAllowLanLabel, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.ShowLogsLabel, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveUpLabel, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveDownLabel, 0, 5);
this.tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.SwitchSystemProxyTextBox, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.ChangeToPacTextBox, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.ChangeToGlobalTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.SwitchAllowLanTextBox, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.ShowLogsTextBox, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveUpTextBox, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveDownTextBox, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.SwitchProxyModeTextBox, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.SwitchAllowLanTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.ShowLogsTextBox, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveUpTextBox, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.ServerMoveDownTextBox, 1, 5);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16667F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16667F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16667F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16667F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.16667F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.77778F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.38889F));
this.tableLayoutPanel1.RowCount = 7;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.50485F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.50485F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.50485F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.50485F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.21683F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.76375F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(475, 271);
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(491, 248);
this.tableLayoutPanel1.TabIndex = 0;
//
// SwitchSystemProxyLabel
//
this.SwitchSystemProxyLabel.AutoSize = true;
this.SwitchSystemProxyLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.SwitchSystemProxyLabel.Location = new System.Drawing.Point(25, 0);
this.SwitchSystemProxyLabel.Location = new System.Drawing.Point(50, 0);
this.SwitchSystemProxyLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.SwitchSystemProxyLabel.Name = "SwitchSystemProxyLabel";
this.SwitchSystemProxyLabel.Size = new System.Drawing.Size(147, 32);
this.SwitchSystemProxyLabel.Size = new System.Drawing.Size(147, 34);
this.SwitchSystemProxyLabel.TabIndex = 0;
this.SwitchSystemProxyLabel.Text = "Enable System Proxy";
this.SwitchSystemProxyLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ChangeToPacLabel
// SwitchProxyModeLabel
//
this.ChangeToPacLabel.AutoSize = true;
this.ChangeToPacLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ChangeToPacLabel.Location = new System.Drawing.Point(135, 32);
this.ChangeToPacLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.ChangeToPacLabel.Name = "ChangeToPacLabel";
this.ChangeToPacLabel.Size = new System.Drawing.Size(37, 32);
this.ChangeToPacLabel.TabIndex = 1;
this.ChangeToPacLabel.Text = "PAC";
this.ChangeToPacLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ChangeToGlobalLabel
//
this.ChangeToGlobalLabel.AutoSize = true;
this.ChangeToGlobalLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ChangeToGlobalLabel.Location = new System.Drawing.Point(119, 64);
this.ChangeToGlobalLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.ChangeToGlobalLabel.Name = "ChangeToGlobalLabel";
this.ChangeToGlobalLabel.Size = new System.Drawing.Size(53, 32);
this.ChangeToGlobalLabel.TabIndex = 2;
this.ChangeToGlobalLabel.Text = "Global";
this.ChangeToGlobalLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.SwitchProxyModeLabel.AutoSize = true;
this.SwitchProxyModeLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.SwitchProxyModeLabel.Location = new System.Drawing.Point(8, 34);
this.SwitchProxyModeLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.SwitchProxyModeLabel.Name = "SwitchProxyModeLabel";
this.SwitchProxyModeLabel.Size = new System.Drawing.Size(189, 34);
this.SwitchProxyModeLabel.TabIndex = 1;
this.SwitchProxyModeLabel.Text = "Switch System Proxy Mode";
this.SwitchProxyModeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SwitchAllowLanLabel
//
this.SwitchAllowLanLabel.AutoSize = true;
this.SwitchAllowLanLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.SwitchAllowLanLabel.Location = new System.Drawing.Point(8, 96);
this.SwitchAllowLanLabel.Location = new System.Drawing.Point(33, 68);
this.SwitchAllowLanLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.SwitchAllowLanLabel.Name = "SwitchAllowLanLabel";
this.SwitchAllowLanLabel.Size = new System.Drawing.Size(164, 32);
this.SwitchAllowLanLabel.Size = new System.Drawing.Size(164, 34);
this.SwitchAllowLanLabel.TabIndex = 3;
this.SwitchAllowLanLabel.Text = "Allow Clients from LAN";
this.SwitchAllowLanLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -187,10 +171,10 @@
//
this.ShowLogsLabel.AutoSize = true;
this.ShowLogsLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ShowLogsLabel.Location = new System.Drawing.Point(82, 128);
this.ShowLogsLabel.Location = new System.Drawing.Point(107, 102);
this.ShowLogsLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.ShowLogsLabel.Name = "ShowLogsLabel";
this.ShowLogsLabel.Size = new System.Drawing.Size(90, 32);
this.ShowLogsLabel.Size = new System.Drawing.Size(90, 34);
this.ShowLogsLabel.TabIndex = 4;
this.ShowLogsLabel.Text = "Show Logs...";
this.ShowLogsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -199,10 +183,10 @@
//
this.ServerMoveUpLabel.AutoSize = true;
this.ServerMoveUpLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ServerMoveUpLabel.Location = new System.Drawing.Point(103, 160);
this.ServerMoveUpLabel.Location = new System.Drawing.Point(128, 136);
this.ServerMoveUpLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.ServerMoveUpLabel.Name = "ServerMoveUpLabel";
this.ServerMoveUpLabel.Size = new System.Drawing.Size(69, 34);
this.ServerMoveUpLabel.Size = new System.Drawing.Size(69, 35);
this.ServerMoveUpLabel.TabIndex = 4;
this.ServerMoveUpLabel.Text = "Move up";
this.ServerMoveUpLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -211,10 +195,10 @@
//
this.ServerMoveDownLabel.AutoSize = true;
this.ServerMoveDownLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ServerMoveDownLabel.Location = new System.Drawing.Point(81, 194);
this.ServerMoveDownLabel.Location = new System.Drawing.Point(106, 171);
this.ServerMoveDownLabel.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.ServerMoveDownLabel.Name = "ServerMoveDownLabel";
this.ServerMoveDownLabel.Size = new System.Drawing.Size(91, 33);
this.ServerMoveDownLabel.Size = new System.Drawing.Size(91, 34);
this.ServerMoveDownLabel.TabIndex = 4;
this.ServerMoveDownLabel.Text = "Move Down";
this.ServerMoveDownLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -222,7 +206,7 @@
// SwitchSystemProxyTextBox
//
this.SwitchSystemProxyTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.SwitchSystemProxyTextBox.Location = new System.Drawing.Point(183, 3);
this.SwitchSystemProxyTextBox.Location = new System.Drawing.Point(208, 3);
this.SwitchSystemProxyTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.SwitchSystemProxyTextBox.Name = "SwitchSystemProxyTextBox";
this.SwitchSystemProxyTextBox.ReadOnly = true;
@@ -232,36 +216,23 @@
this.SwitchSystemProxyTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HotkeyDown);
this.SwitchSystemProxyTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.HotkeyUp);
//
// ChangeToPacTextBox
// SwitchProxyModeTextBox
//
this.ChangeToPacTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChangeToPacTextBox.Location = new System.Drawing.Point(183, 35);
this.ChangeToPacTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.ChangeToPacTextBox.Name = "ChangeToPacTextBox";
this.ChangeToPacTextBox.ReadOnly = true;
this.ChangeToPacTextBox.Size = new System.Drawing.Size(276, 25);
this.ChangeToPacTextBox.TabIndex = 8;
this.ChangeToPacTextBox.TextChanged += new System.EventHandler(this.TextBox_TextChanged);
this.ChangeToPacTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HotkeyDown);
this.ChangeToPacTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.HotkeyUp);
//
// ChangeToGlobalTextBox
//
this.ChangeToGlobalTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChangeToGlobalTextBox.Location = new System.Drawing.Point(183, 67);
this.ChangeToGlobalTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.ChangeToGlobalTextBox.Name = "ChangeToGlobalTextBox";
this.ChangeToGlobalTextBox.ReadOnly = true;
this.ChangeToGlobalTextBox.Size = new System.Drawing.Size(276, 25);
this.ChangeToGlobalTextBox.TabIndex = 9;
this.ChangeToGlobalTextBox.TextChanged += new System.EventHandler(this.TextBox_TextChanged);
this.ChangeToGlobalTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HotkeyDown);
this.ChangeToGlobalTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.HotkeyUp);
this.SwitchProxyModeTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.SwitchProxyModeTextBox.Location = new System.Drawing.Point(208, 37);
this.SwitchProxyModeTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.SwitchProxyModeTextBox.Name = "SwitchProxyModeTextBox";
this.SwitchProxyModeTextBox.ReadOnly = true;
this.SwitchProxyModeTextBox.Size = new System.Drawing.Size(276, 25);
this.SwitchProxyModeTextBox.TabIndex = 8;
this.SwitchProxyModeTextBox.TextChanged += new System.EventHandler(this.TextBox_TextChanged);
this.SwitchProxyModeTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HotkeyDown);
this.SwitchProxyModeTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.HotkeyUp);
//
// SwitchAllowLanTextBox
//
this.SwitchAllowLanTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.SwitchAllowLanTextBox.Location = new System.Drawing.Point(183, 99);
this.SwitchAllowLanTextBox.Location = new System.Drawing.Point(208, 71);
this.SwitchAllowLanTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.SwitchAllowLanTextBox.Name = "SwitchAllowLanTextBox";
this.SwitchAllowLanTextBox.ReadOnly = true;
@@ -274,7 +245,7 @@
// ShowLogsTextBox
//
this.ShowLogsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ShowLogsTextBox.Location = new System.Drawing.Point(183, 131);
this.ShowLogsTextBox.Location = new System.Drawing.Point(208, 105);
this.ShowLogsTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.ShowLogsTextBox.Name = "ShowLogsTextBox";
this.ShowLogsTextBox.ReadOnly = true;
@@ -287,7 +258,7 @@
// ServerMoveUpTextBox
//
this.ServerMoveUpTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerMoveUpTextBox.Location = new System.Drawing.Point(183, 163);
this.ServerMoveUpTextBox.Location = new System.Drawing.Point(208, 139);
this.ServerMoveUpTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.ServerMoveUpTextBox.Name = "ServerMoveUpTextBox";
this.ServerMoveUpTextBox.ReadOnly = true;
@@ -300,7 +271,7 @@
// ServerMoveDownTextBox
//
this.ServerMoveDownTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerMoveDownTextBox.Location = new System.Drawing.Point(183, 197);
this.ServerMoveDownTextBox.Location = new System.Drawing.Point(208, 174);
this.ServerMoveDownTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 16, 3);
this.ServerMoveDownTextBox.Name = "ServerMoveDownTextBox";
this.ServerMoveDownTextBox.ReadOnly = true;
@@ -314,7 +285,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(475, 271);
this.ClientSize = new System.Drawing.Size(491, 248);
this.Controls.Add(this.tableLayoutPanel1);
this.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
@@ -333,8 +304,7 @@
#endregion
private System.Windows.Forms.Label SwitchSystemProxyLabel;
private System.Windows.Forms.Label ChangeToPacLabel;
private System.Windows.Forms.Label ChangeToGlobalLabel;
private System.Windows.Forms.Label SwitchProxyModeLabel;
private System.Windows.Forms.Label SwitchAllowLanLabel;
private System.Windows.Forms.Label ShowLogsLabel;
private System.Windows.Forms.Label ServerMoveUpLabel;
@@ -343,8 +313,7 @@
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TextBox ShowLogsTextBox;
private System.Windows.Forms.TextBox SwitchAllowLanTextBox;
private System.Windows.Forms.TextBox ChangeToGlobalTextBox;
private System.Windows.Forms.TextBox ChangeToPacTextBox;
private System.Windows.Forms.TextBox SwitchProxyModeTextBox;
private System.Windows.Forms.TextBox SwitchSystemProxyTextBox;
private System.Windows.Forms.TextBox ServerMoveUpTextBox;
private System.Windows.Forms.TextBox ServerMoveDownTextBox;
@@ -129,10 +129,7 @@
<metadata name="SwitchSystemProxyLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChangeToPacLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChangeToGlobalLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="SwitchProxyModeLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SwitchAllowLanLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -150,10 +147,7 @@
<metadata name="SwitchSystemProxyTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChangeToPacTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ChangeToGlobalTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="SwitchProxyModeTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SwitchAllowLanTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+16 -16
View File
@@ -54,9 +54,9 @@ namespace Shadowsocks.View
topMostTrigger = config.topMost;
wrapTextTrigger = config.wrapText;
toolbarTrigger = config.toolbarShown;
LogMessageTextBox.BackColor = config.GetBackgroundColor();
LogMessageTextBox.ForeColor = config.GetTextColor();
LogMessageTextBox.Font = config.GetFont();
LogMessageTextBox.BackColor = config.BackgroundColor;
LogMessageTextBox.ForeColor = config.TextColor;
LogMessageTextBox.Font = config.Font;
controller.TrafficChanged += controller_TrafficChanged;
@@ -229,11 +229,11 @@ namespace Shadowsocks.View
LogViewerConfig config = controller.GetConfigurationCopy().logViewer;
Height = config.height;
Width = config.width;
Top = config.GetBestTop();
Left = config.GetBestLeft();
if (config.maximized)
Height = config.Height;
Width = config.Width;
Top = config.BestTop;
Left = config.BestLeft;
if (config.Maximized)
{
WindowState = FormWindowState.Maximized;
}
@@ -258,15 +258,15 @@ namespace Shadowsocks.View
config.topMost = topMostTrigger;
config.wrapText = wrapTextTrigger;
config.toolbarShown = toolbarTrigger;
config.SetFont(LogMessageTextBox.Font);
config.SetBackgroundColor(LogMessageTextBox.BackColor);
config.SetTextColor(LogMessageTextBox.ForeColor);
if (WindowState != FormWindowState.Minimized && !(config.maximized = WindowState == FormWindowState.Maximized))
config.Font=LogMessageTextBox.Font;
config.BackgroundColor=LogMessageTextBox.BackColor;
config.TextColor=LogMessageTextBox.ForeColor;
if (WindowState != FormWindowState.Minimized && !(config.Maximized = WindowState == FormWindowState.Maximized))
{
config.top = Top;
config.left = Left;
config.height = Height;
config.width = Width;
config.Top = Top;
config.Left = Left;
config.Height = Height;
config.Width = Width;
}
controller.SaveLogViewerConfig(config);
}
+24
View File
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Shadowsocks.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
@@ -15,4 +20,23 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<userSettings>
<Shadowsocks.Properties.Settings>
<setting name="LogViewerWidth" serializeAs="String">
<value>600</value>
</setting>
<setting name="LogViewerHeight" serializeAs="String">
<value>400</value>
</setting>
<setting name="LogViewerMaximized" serializeAs="String">
<value>True</value>
</setting>
<setting name="LogViewerTop" serializeAs="String">
<value>0</value>
</setting>
<setting name="LogViewerLeft" serializeAs="String">
<value>0</value>
</setting>
</Shadowsocks.Properties.Settings>
</userSettings>
</configuration>
+34 -2
View File
@@ -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>
@@ -65,6 +65,25 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;_X64</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;_X64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
@@ -141,6 +160,11 @@
<Compile Include="3rd\zxing\WriterException.cs" />
<Compile Include="Model\HotKeyConfig.cs" />
<Compile Include="Model\ProxyConfig.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Proxy\DirectConnect.cs" />
<Compile Include="Proxy\HttpProxy.cs" />
<Compile Include="Proxy\IProxy.cs" />
@@ -179,10 +203,12 @@
<Compile Include="Controller\Strategy\StrategyManager.cs" />
<Compile Include="Controller\Strategy\IStrategy.cs" />
<Compile Include="Proxy\Socks5Proxy.cs" />
<Compile Include="Settings.cs" />
<Compile Include="StringEx.cs" />
<Compile Include="Util\Hotkeys.cs" />
<Compile Include="Util\ProcessManagement\Job.cs" />
<Compile Include="Util\ProcessManagement\ThreadUtil.cs" />
<Compile Include="Encryption\RNG.cs" />
<Compile Include="Util\Sockets\LineReader.cs" />
<Compile Include="Util\Sockets\SocketUtil.cs" />
<Compile Include="Util\Sockets\WrappedSocket.cs" />
@@ -190,6 +216,7 @@
<Compile Include="Util\SystemProxy\INTERNET_PER_CONN_OPTION.cs" />
<Compile Include="Util\SystemProxy\INTERNET_PER_CONN_OPTION_LIST.cs" />
<Compile Include="Util\SystemProxy\NativeMethods.cs" />
<Compile Include="Util\SystemProxy\ProxyException.cs" />
<Compile Include="Util\SystemProxy\RAS.cs" />
<Compile Include="Util\SystemProxy\WinINet.cs" />
<Compile Include="Util\Util.cs" />
@@ -278,6 +305,7 @@
</None>
<None Include="Data\abp.js.gz" />
<None Include="Data\libsscrypto.dll.gz" />
<None Include="Data\libsscrypto64.dll.gz" />
<None Include="Data\mgwz.dll.gz" />
<None Include="Data\privoxy.exe.gz" />
<None Include="Data\proxy.pac.txt.gz" />
@@ -285,6 +313,10 @@
<ItemGroup>
<None Include="packages.config" />
<None Include="Properties\DataSources\Shadowsocks.Model.StatisticsStrategyConfiguration.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Resources\ss20.png" />
<None Include="Resources\ss16.png" />
<None Include="Resources\ss24.png" />
+11 -1
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "shadowsocks-csharp", "shadowsocks-csharp\shadowsocks-csharp.csproj", "{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}"
EndProject
@@ -12,17 +12,27 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj",
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x64.ActiveCfg = Debug|x64
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x64.Build.0 = Debug|x64
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.ActiveCfg = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.Build.0 = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.Deploy.0 = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x64.ActiveCfg = Release|x64
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x64.Build.0 = Release|x64
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x86.ActiveCfg = Release|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x86.Build.0 = Release|x86
{45913187-0685-4903-B250-DCEF0479CD86}.Debug|x64.ActiveCfg = Debug|x64
{45913187-0685-4903-B250-DCEF0479CD86}.Debug|x64.Build.0 = Debug|x64
{45913187-0685-4903-B250-DCEF0479CD86}.Debug|x86.ActiveCfg = Debug|x86
{45913187-0685-4903-B250-DCEF0479CD86}.Debug|x86.Build.0 = Debug|x86
{45913187-0685-4903-B250-DCEF0479CD86}.Release|x64.ActiveCfg = Release|x64
{45913187-0685-4903-B250-DCEF0479CD86}.Release|x64.Build.0 = Release|x64
{45913187-0685-4903-B250-DCEF0479CD86}.Release|x86.ActiveCfg = Release|x86
{45913187-0685-4903-B250-DCEF0479CD86}.Release|x86.Build.0 = Release|x86
EndGlobalSection
+4
View File
@@ -68,6 +68,7 @@ namespace test
private void RunEncryptionRound(IEncryptor encryptor, IEncryptor decryptor)
{
RNG.Reload();
byte[] plain = new byte[16384];
byte[] cipher = new byte[plain.Length + 16 + IVEncryptor.ONETIMEAUTH_BYTES + IVEncryptor.AUTH_BYTES];
byte[] plain2 = new byte[plain.Length + 16];
@@ -117,6 +118,7 @@ namespace test
{
t.Join();
}
RNG.Close();
Assert.IsFalse(encryptionFailed);
}
@@ -156,6 +158,7 @@ namespace test
{
t.Join();
}
RNG.Close();
Assert.IsFalse(encryptionFailed);
}
@@ -196,6 +199,7 @@ namespace test
{
t.Join();
}
RNG.Close();
Assert.IsFalse(encryptionFailed);
}
+14
View File
@@ -34,6 +34,20 @@
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\shadowsocks-csharp\3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>