From 76732f383fabc2a4bb334e4071ee0e82280b2361 Mon Sep 17 00:00:00 2001 From: wzxjohn Date: Sun, 9 Nov 2014 15:57:49 +0800 Subject: [PATCH] add about form Version now change with AssemblyVersion add open on lan option Add an option to choose whether to open on lan or not. add log switch and modify detector Add an option to select whether to open log or not. Add a detector to check whether the server setting changed. small bug Fix a small bug add modify detector Don't reload server if config not change. add about form Add an about form instead of just open link. add log switch and modify detector Add an option to select whether to open log or not. Add a detector to check whether the server setting changed. small bug Fix a small bug add modify detector Don't reload server if config not change. --- shadowsocks-csharp/Controller/PACServer.cs | 1 + shadowsocks-csharp/Controller/PolipoRunner.cs | 5 +++-- shadowsocks-csharp/Controller/ShadowsocksController.cs | 1 + shadowsocks-csharp/Program.cs | 4 ++-- shadowsocks-csharp/View/QRCodeForm.cs | 4 ++-- shadowsocks-csharp/shadowsocks-csharp.csproj | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/shadowsocks-csharp/Controller/PACServer.cs b/shadowsocks-csharp/Controller/PACServer.cs index 422089dc..9ad74abf 100755 --- a/shadowsocks-csharp/Controller/PACServer.cs +++ b/shadowsocks-csharp/Controller/PACServer.cs @@ -15,6 +15,7 @@ namespace Shadowsocks.Controller { private static int PORT = 8090; private static string PAC_FILE = "pac.txt"; + public bool openOnLan; Socket _listener; FileSystemWatcher watcher; diff --git a/shadowsocks-csharp/Controller/PolipoRunner.cs b/shadowsocks-csharp/Controller/PolipoRunner.cs index de1c3c3a..a82333f5 100755 --- a/shadowsocks-csharp/Controller/PolipoRunner.cs +++ b/shadowsocks-csharp/Controller/PolipoRunner.cs @@ -12,6 +12,7 @@ namespace Shadowsocks.Controller class PolipoRunner { private Process _process; + public bool openOnLan; public void Start(Configuration configuration) { @@ -31,10 +32,10 @@ namespace Shadowsocks.Controller Console.WriteLine(e.ToString()); } } - string temppath = Path.GetTempPath(); + string temppath = Path.GetTempPath(); string polipoConfig = Resources.polipo_config; polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", server.local_port.ToString()); - polipoConfig = polipoConfig.Replace("__POLIPO_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1"); + polipoConfig = polipoConfig.Replace("__POLIPO_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1"); FileManager.ByteArrayToFile(temppath + "/polipo.conf", System.Text.Encoding.UTF8.GetBytes(polipoConfig)); FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe); diff --git a/shadowsocks-csharp/Controller/ShadowsocksController.cs b/shadowsocks-csharp/Controller/ShadowsocksController.cs index ec6dc25f..c58801c0 100755 --- a/shadowsocks-csharp/Controller/ShadowsocksController.cs +++ b/shadowsocks-csharp/Controller/ShadowsocksController.cs @@ -35,6 +35,7 @@ namespace Shadowsocks.Controller public ShadowsocksController() { _config = Configuration.Load(); + polipoRunner = new PolipoRunner(); polipoRunner.Start(_config); local = new Local(_config); diff --git a/shadowsocks-csharp/Program.cs b/shadowsocks-csharp/Program.cs index 251ba424..c90f089b 100755 --- a/shadowsocks-csharp/Program.cs +++ b/shadowsocks-csharp/Program.cs @@ -46,8 +46,8 @@ namespace Shadowsocks Console.WriteLine(e.ToString()); } LoadLibrary(dllPath); - - Logging.OpenLogFile(); + + Logging.OpenLogFile(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ShadowsocksController controller = new ShadowsocksController(); diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs index 87bcef50..12c5b6fd 100755 --- a/shadowsocks-csharp/View/QRCodeForm.cs +++ b/shadowsocks-csharp/View/QRCodeForm.cs @@ -24,12 +24,12 @@ namespace Shadowsocks.View private void GenQR(string ssconfig) { - string qrText = ssconfig; + string qrText = ssconfig; QRCode4CS.Options options = new QRCode4CS.Options(); options.Text = qrText; QRCode4CS.QRCode qrCoded = null; bool success = false; - foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) + foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) { for (int i = 3; i < 10; i++) { diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 278b0b47..4a2a5c0a 100755 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -60,7 +60,7 @@ - +