diff --git a/shadowsocks-csharp/Controller/UpdateChecker.cs b/shadowsocks-csharp/Controller/UpdateChecker.cs index a8fa8d9a..eb47ccc6 100755 --- a/shadowsocks-csharp/Controller/UpdateChecker.cs +++ b/shadowsocks-csharp/Controller/UpdateChecker.cs @@ -21,7 +21,7 @@ public class UpdateChecker public const string Name = "ShadowsocksR"; public const string Copyright = "Copyright © BreakWa11 2017. Fork from Shadowsocks by clowwindy"; - public const string Version = "5.0.2"; + public const string Version = "5.0.3"; #if !_DOTNET_4_0 public const string NetVer = "2.0"; #elif !_CONSOLE diff --git a/shadowsocks-csharp/Controller/UpdateFreeNode.cs b/shadowsocks-csharp/Controller/UpdateFreeNode.cs index 206d1de0..62726ebf 100644 --- a/shadowsocks-csharp/Controller/UpdateFreeNode.cs +++ b/shadowsocks-csharp/Controller/UpdateFreeNode.cs @@ -1,148 +1,148 @@ -using Shadowsocks.Model; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Windows.Forms; - -namespace Shadowsocks.Controller -{ - public class UpdateFreeNode - { - private const string UpdateURL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/free/freenodeplain.txt"; - - public event EventHandler NewFreeNodeFound; - public string FreeNodeResult; - public ServerSubscribe subscribeTask; +using Shadowsocks.Model; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Windows.Forms; + +namespace Shadowsocks.Controller +{ + public class UpdateFreeNode + { + private const string UpdateURL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/free/freenodeplain.txt"; + + public event EventHandler NewFreeNodeFound; + public string FreeNodeResult; + public ServerSubscribe subscribeTask; public bool noitify; - - public const string Name = "ShadowsocksR"; - - public void CheckUpdate(Configuration config, ServerSubscribe subscribeTask, bool use_proxy, bool noitify) - { - FreeNodeResult = null; - this.noitify = noitify; - try - { - WebClient http = new WebClient(); + + public const string Name = "ShadowsocksR"; + + public void CheckUpdate(Configuration config, ServerSubscribe subscribeTask, bool use_proxy, bool noitify) + { + FreeNodeResult = null; + this.noitify = noitify; + try + { + WebClient http = new WebClient(); http.Headers.Add("User-Agent", String.IsNullOrEmpty(config.proxyUserAgent) ? "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36" - : config.proxyUserAgent); - http.QueryString["rnd"] = Util.Utils.RandUInt32().ToString(); - if (use_proxy) - { - WebProxy proxy = new WebProxy(IPAddress.Loopback.ToString(), config.localPort); - if (!string.IsNullOrEmpty(config.authPass)) - { - proxy.Credentials = new NetworkCredential(config.authUser, config.authPass); - } - http.Proxy = proxy; - } - else - { - http.Proxy = null; - } - //UseProxy = !UseProxy; - this.subscribeTask = subscribeTask; - string URL = subscribeTask.URL; - http.DownloadStringCompleted += http_DownloadStringCompleted; - http.DownloadStringAsync(new Uri(URL != null ? URL : UpdateURL)); - } - catch (Exception e) - { - Logging.LogUsefulException(e); - } - } - - private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) - { - try - { - string response = e.Result; - FreeNodeResult = response; - - if (NewFreeNodeFound != null) - { - NewFreeNodeFound(this, new EventArgs()); - } - } - catch (Exception ex) - { - if (e.Error != null) - { - Logging.Debug(e.Error.ToString()); - } - Logging.Debug(ex.ToString()); - if (NewFreeNodeFound != null) - { - NewFreeNodeFound(this, new EventArgs()); - } - return; - } - } - } - - public class UpdateSubscribeManager - { - private Configuration _config; - private List _serverSubscribes; - private UpdateFreeNode _updater; - private string _URL; - private bool _use_proxy; + : config.proxyUserAgent); + http.QueryString["rnd"] = Util.Utils.RandUInt32().ToString(); + if (use_proxy) + { + WebProxy proxy = new WebProxy(IPAddress.Loopback.ToString(), config.localPort); + if (!string.IsNullOrEmpty(config.authPass)) + { + proxy.Credentials = new NetworkCredential(config.authUser, config.authPass); + } + http.Proxy = proxy; + } + else + { + http.Proxy = null; + } + //UseProxy = !UseProxy; + this.subscribeTask = subscribeTask; + string URL = subscribeTask.URL; + http.DownloadStringCompleted += http_DownloadStringCompleted; + http.DownloadStringAsync(new Uri(URL != null ? URL : UpdateURL)); + } + catch (Exception e) + { + Logging.LogUsefulException(e); + } + } + + private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) + { + try + { + string response = e.Result; + FreeNodeResult = response; + + if (NewFreeNodeFound != null) + { + NewFreeNodeFound(this, new EventArgs()); + } + } + catch (Exception ex) + { + if (e.Error != null) + { + Logging.Debug(e.Error.ToString()); + } + Logging.Debug(ex.ToString()); + if (NewFreeNodeFound != null) + { + NewFreeNodeFound(this, new EventArgs()); + } + return; + } + } + } + + public class UpdateSubscribeManager + { + private Configuration _config; + private List _serverSubscribes; + private UpdateFreeNode _updater; + private string _URL; + private bool _use_proxy; public bool _noitify; - - public void CreateTask(Configuration config, UpdateFreeNode updater, int index, bool use_proxy, bool noitify) - { - if (_config == null) - { - _config = config; - _updater = updater; - _use_proxy = use_proxy; - _noitify = noitify; - if (index < 0) - { - _serverSubscribes = new List(); - for (int i = 0; i < config.serverSubscribes.Count; ++i) - { - _serverSubscribes.Add(config.serverSubscribes[i]); - } - } - else if (index < _config.serverSubscribes.Count) - { - _serverSubscribes = new List(); - _serverSubscribes.Add(config.serverSubscribes[index]); - } - Next(); - } - } - - public bool Next() - { - if (_serverSubscribes.Count == 0) - { - _config = null; - return false; - } - else - { - _URL = _serverSubscribes[0].URL; - _updater.CheckUpdate(_config, _serverSubscribes[0], _use_proxy, _noitify); - _serverSubscribes.RemoveAt(0); - return true; - } - } - - public string URL - { - get - { - return _URL; - } - } - } -} + + public void CreateTask(Configuration config, UpdateFreeNode updater, int index, bool use_proxy, bool noitify) + { + if (_config == null) + { + _config = config; + _updater = updater; + _use_proxy = use_proxy; + _noitify = noitify; + if (index < 0) + { + _serverSubscribes = new List(); + for (int i = 0; i < config.serverSubscribes.Count; ++i) + { + _serverSubscribes.Add(config.serverSubscribes[i]); + } + } + else if (index < _config.serverSubscribes.Count) + { + _serverSubscribes = new List(); + _serverSubscribes.Add(config.serverSubscribes[index]); + } + Next(); + } + } + + public bool Next() + { + if (_serverSubscribes.Count == 0) + { + _config = null; + return false; + } + else + { + _URL = _serverSubscribes[0].URL; + _updater.CheckUpdate(_config, _serverSubscribes[0], _use_proxy, _noitify); + _serverSubscribes.RemoveAt(0); + return true; + } + } + + public string URL + { + get + { + return _URL; + } + } + } +} diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index a7af8e6e..6484a4de 100755 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -295,7 +295,7 @@ private void LoadMenu() CreateMenuGroup("Servers Subscribe", new MenuItem[] { CreateMenuItem("Subscribe setting...", new EventHandler(this.SubscribeSetting_Click)), CreateMenuItem("Update subscribe SSR node", new EventHandler(this.CheckNodeUpdate_Click)), - CreateMenuItem("Update subscribe SSR node(bypass proxy)", new EventHandler(this.CheckNodeUpdateBypassProxy_Click)), + CreateMenuItem("Update subscribe SSR node(use proxy)", new EventHandler(this.CheckNodeUpdateUseProxy_Click)), }), SelectRandomItem = CreateMenuItem("Load balance", new EventHandler(this.SelectRandomItem_Click)), CreateMenuItem("Global settings...", new EventHandler(this.Setting_Click)), @@ -1199,12 +1199,12 @@ private void CheckUpdate_Click(object sender, EventArgs e) updateChecker.CheckUpdate(controller.GetCurrentConfiguration()); } - private void CheckNodeUpdate_Click(object sender, EventArgs e) + private void CheckNodeUpdateUseProxy_Click(object sender, EventArgs e) { updateSubscribeManager.CreateTask(controller.GetCurrentConfiguration(), updateFreeNodeChecker, -1, true, true); } - private void CheckNodeUpdateBypassProxy_Click(object sender, EventArgs e) + private void CheckNodeUpdate_Click(object sender, EventArgs e) { updateSubscribeManager.CreateTask(controller.GetCurrentConfiguration(), updateFreeNodeChecker, -1, false, true); } diff --git a/shadowsocks-csharp/shadowsocks-csharp-console.csproj b/shadowsocks-csharp/shadowsocks-csharp-console.csproj index dc967bce..83fca3e0 100644 --- a/shadowsocks-csharp/shadowsocks-csharp-console.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp-console.csproj @@ -10,7 +10,7 @@ Properties Shadowsocks ShadowsocksR - v4.0 + v4.7.1 512 diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 34eb3e6e..40e328f6 100755 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -10,7 +10,7 @@ Properties Shadowsocks ShadowsocksR - v4.0 + v4.7.1 512 Shadowsocks.Program shadowsocks.ico diff --git a/shadowsocks-csharp/shadowsocks-csharp4.0.csproj b/shadowsocks-csharp/shadowsocks-csharp4.0.csproj index 00d20043..5cc372ba 100644 --- a/shadowsocks-csharp/shadowsocks-csharp4.0.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp4.0.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties Shadowsocks ShadowsocksR - v4.0 + v4.7.1 512 Shadowsocks.Program shadowsocks.ico @@ -48,6 +48,7 @@ AnyCPU prompt ManagedMinimumRules.ruleset + false true @@ -58,6 +59,7 @@ AnyCPU prompt ManagedMinimumRules.ruleset + false diff --git a/shadowsocks-csharp/ssr-win-4.0.xml b/shadowsocks-csharp/ssr-win-4.0.xml index 4e604d10..0923f3d4 100644 --- a/shadowsocks-csharp/ssr-win-4.0.xml +++ b/shadowsocks-csharp/ssr-win-4.0.xml @@ -2,7 +2,7 @@ - + diff --git a/test/test.csproj b/test/test.csproj index 531b5ac8..44cf0154 100755 --- a/test/test.csproj +++ b/test/test.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -8,7 +8,7 @@ Properties test test - v4.0 + v4.7.1 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -26,11 +26,13 @@ bin\Debug\ AnyCPU MinimumRecommendedRules.ruleset + false bin\Release\ AnyCPU MinimumRecommendedRules.ruleset + false