Browse Source

encourage users to report to gfwlist

tags/2.3
clowwindy 10 years ago
parent
commit
5eaa1b9e2b
4 changed files with 27 additions and 6 deletions
  1. +21
    -2
      shadowsocks-csharp/Controller/GfwListUpdater.cs
  2. +2
    -2
      shadowsocks-csharp/Controller/ShadowsocksController.cs
  3. +1
    -0
      shadowsocks-csharp/Data/cn.txt
  4. +3
    -2
      shadowsocks-csharp/View/MenuViewController.cs

+ 21
- 2
shadowsocks-csharp/Controller/GfwListUpdater.cs View File

@@ -16,10 +16,20 @@ namespace Shadowsocks.Controller
private static string PAC_FILE = PACServer.PAC_FILE;
public event EventHandler UpdateCompleted;
public event EventHandler<ResultEventArgs> UpdateCompleted;
public event ErrorEventHandler Error;
public class ResultEventArgs : EventArgs
{
public bool Success;
public ResultEventArgs(bool success)
{
this.Success = success;
}
}
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
@@ -28,10 +38,19 @@ namespace Shadowsocks.Controller
string abpContent = Utils.UnGzip(Resources.abp_js);
abpContent = abpContent.Replace("__RULES__", SimpleJson.SimpleJson.SerializeObject(lines));
if (File.Exists(PAC_FILE))
{
string original = File.ReadAllText(PAC_FILE, Encoding.UTF8);
if (original == abpContent)
{
UpdateCompleted(this, new ResultEventArgs(false));
return;
}
}
File.WriteAllText(PAC_FILE, abpContent, Encoding.UTF8);
if (UpdateCompleted != null)
{
UpdateCompleted(this, new EventArgs());
UpdateCompleted(this, new ResultEventArgs(true));
}
}
catch (Exception ex)


+ 2
- 2
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -39,7 +39,7 @@ namespace Shadowsocks.Controller
// when user clicked Edit PAC, and PAC file has already created
public event EventHandler<PathEventArgs> PACFileReadyToOpen;
public event EventHandler UpdatePACFromGFWListCompleted;
public event EventHandler<GFWListUpdater.ResultEventArgs> UpdatePACFromGFWListCompleted;
public event ErrorEventHandler UpdatePACFromGFWListError;
@@ -282,7 +282,7 @@ namespace Shadowsocks.Controller
UpdateSystemProxy();
}
private void pacServer_PACUpdateCompleted(object sender, EventArgs e)
private void pacServer_PACUpdateCompleted(object sender, GFWListUpdater.ResultEventArgs e)
{
if (UpdatePACFromGFWListCompleted != null)
UpdatePACFromGFWListCompleted(this, e);


+ 1
- 0
shadowsocks-csharp/Data/cn.txt View File

@@ -43,6 +43,7 @@ System Proxy Disabled=系统代理未启用
Update PAC from GFWList=从 GFWList 更新 PAC
Failed to update PAC file =更新 PAC 文件失败
PAC updated=更新 PAC 成功
No updates found. Please report to GFWList if you have problems with it.=未发现更新。如有问题请提交给 GFWList。
No QRCode found. Try to zoom in or move it to the center of the screen.=找不到二维码,尝试把它放大或者移动到靠近屏幕中间的位置
Failed to decode QRCode=无法解析二维码
Failed to update registry=无法修改注册表


+ 3
- 2
shadowsocks-csharp/View/MenuViewController.cs View File

@@ -207,9 +207,10 @@ namespace Shadowsocks.View
Logging.LogUsefulException(e.GetException());
}
void controller_UpdatePACFromGFWListCompleted(object sender, EventArgs e)
void controller_UpdatePACFromGFWListCompleted(object sender, GFWListUpdater.ResultEventArgs e)
{
ShowBalloonTip(I18N.GetString("Shadowsocks"), I18N.GetString("PAC updated"), ToolTipIcon.Info, 1000);
string result = e.Success ? I18N.GetString("PAC updated") : I18N.GetString("No updates found. Please report to GFWList if you have problems with it.");
ShowBalloonTip(I18N.GetString("Shadowsocks"), result, ToolTipIcon.Info, 1000);
}
void updateChecker_NewVersionFound(object sender, EventArgs e)


Loading…
Cancel
Save