Skip to content

Commit

Permalink
update to 5.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Soul Dark committed Jul 21, 2018
1 parent 9d3fad0 commit d587866
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 154 deletions.
2 changes: 1 addition & 1 deletion shadowsocks-csharp/Controller/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
286 changes: 143 additions & 143 deletions shadowsocks-csharp/Controller/UpdateFreeNode.cs
Original file line number Diff line number Diff line change
@@ -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<ServerSubscribe> _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<ServerSubscribe> _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<ServerSubscribe>();
for (int i = 0; i < config.serverSubscribes.Count; ++i)
{
_serverSubscribes.Add(config.serverSubscribes[i]);
}
}
else if (index < _config.serverSubscribes.Count)
{
_serverSubscribes = new List<ServerSubscribe>();
_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<ServerSubscribe>();
for (int i = 0; i < config.serverSubscribes.Count; ++i)
{
_serverSubscribes.Add(config.serverSubscribes[i]);
}
}
else if (index < _config.serverSubscribes.Count)
{
_serverSubscribes = new List<ServerSubscribe>();
_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;
}
}
}
}
6 changes: 3 additions & 3 deletions shadowsocks-csharp/View/MenuViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks-csharp/shadowsocks-csharp-console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Shadowsocks</RootNamespace>
<AssemblyName>ShadowsocksR</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks-csharp/shadowsocks-csharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Shadowsocks</RootNamespace>
<AssemblyName>ShadowsocksR</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>Shadowsocks.Program</StartupObject>
<ApplicationIcon>shadowsocks.ico</ApplicationIcon>
Expand Down
6 changes: 4 additions & 2 deletions shadowsocks-csharp/shadowsocks-csharp4.0.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Shadowsocks</RootNamespace>
<AssemblyName>ShadowsocksR</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>Shadowsocks.Program</StartupObject>
<ApplicationIcon>shadowsocks.ico</ApplicationIcon>
Expand Down Expand Up @@ -48,6 +48,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -58,6 +59,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks-csharp/ssr-win-4.0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:files="https://sourceforge.net/api/files.rdf#" xmlns:media="http://video.search.yahoo.com/mrss/" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:sf="https://sourceforge.net/api/sfelements.rdf#" version="2.0">
<channel xmlns:files="https://sourceforge.net/api/files.rdf#" xmlns:media="http://video.search.yahoo.com/mrss/" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:sf="https://sourceforge.net/api/sfelements.rdf#">
<item>
<media:content xmlns:media="http://video.search.yahoo.com/mrss/" type="application/zip; charset=binary" url="https://github.com/SoDa-GitHub/shadowsocksrr-csharp/releases/download/5.0.2/ShadowsocksR-win-5.0.2.7z" filesize="828351"></media:content>
<media:content xmlns:media="http://video.search.yahoo.com/mrss/" type="application/zip; charset=binary" url="https://github.com/SoDa-GitHub/shadowsocksrr-csharp/releases/download/5.0.3/ShadowsocksR-win-5.0.3.7z" filesize="828669"></media:content>
</item>
</channel>
</rss>
Expand Down
Loading

2 comments on commit d587866

@ufo1024k
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

万分感谢你对这个项目继续更新。服务器订阅里有一项还是英文,希望汉化为中文,辛苦了

@TheCGDF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ufo1024k 下个版本修复。

Please sign in to comment.