encourage users to report to gfwlist
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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=无法修改注册表
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user