add new menu to update pac file via gfwlist
This commit is contained in:
@@ -38,6 +38,10 @@ 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 ErrorEventHandler UpdatePACFromGFWListError;
|
||||
|
||||
public event ErrorEventHandler Errored;
|
||||
|
||||
public ShadowsocksController()
|
||||
@@ -156,6 +160,14 @@ namespace Shadowsocks.Controller
|
||||
return "ss://" + base64;
|
||||
}
|
||||
|
||||
public void UpdatePACFromGFWList()
|
||||
{
|
||||
if (pacServer != null)
|
||||
{
|
||||
pacServer.UpdatePACFromGFWList();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Reload()
|
||||
{
|
||||
// some logic in configuration updated the config when saving, we need to read it again
|
||||
@@ -169,6 +181,8 @@ namespace Shadowsocks.Controller
|
||||
{
|
||||
pacServer = new PACServer();
|
||||
pacServer.PACFileChanged += pacServer_PACFileChanged;
|
||||
pacServer.UpdatePACFromGFWListCompleted += pacServer_UpdatePACFromGFWListCompleted;
|
||||
pacServer.UpdatePACFromGFWListError += pacServer_UpdatePACFromGFWListError;
|
||||
}
|
||||
|
||||
pacServer.Stop();
|
||||
@@ -247,6 +261,18 @@ namespace Shadowsocks.Controller
|
||||
UpdateSystemProxy();
|
||||
}
|
||||
|
||||
private void pacServer_UpdatePACFromGFWListCompleted(object sender, EventArgs e)
|
||||
{
|
||||
if (UpdatePACFromGFWListCompleted != null)
|
||||
UpdatePACFromGFWListCompleted(this, e);
|
||||
}
|
||||
|
||||
private void pacServer_UpdatePACFromGFWListError(object sender, ErrorEventArgs e)
|
||||
{
|
||||
if (UpdatePACFromGFWListError != null)
|
||||
UpdatePACFromGFWListError(this, e);
|
||||
}
|
||||
|
||||
private void StartReleasingMemory()
|
||||
{
|
||||
_ramThread = new Thread(new ThreadStart(ReleaseMemory));
|
||||
|
||||
Reference in New Issue
Block a user