Browse Source

Merge pull request #1564 from jinliming2/user-rule

Put user rules at the begin of the PAC file.
tags/4.0.8
Allen Zhu GitHub 6 years ago
parent
commit
7021edd61f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 9 deletions
  1. +4
    -9
      shadowsocks-csharp/Controller/Service/GfwListUpdater.cs

+ 4
- 9
shadowsocks-csharp/Controller/Service/GfwListUpdater.cs View File

@@ -36,7 +36,7 @@ namespace Shadowsocks.Controller
try
{
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8);
List<string> lines = ParseResult(e.Result);
List<string> lines = new List<string>();
if (File.Exists(PACServer.USER_RULE_FILE))
{
string local = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
@@ -50,6 +50,7 @@ namespace Shadowsocks.Controller
}
}
}
lines.AddRange(ParseResult(e.Result));
string abpContent;
if (File.Exists(PACServer.USER_ABP_FILE))
{
@@ -70,17 +71,11 @@ namespace Shadowsocks.Controller
}
}
File.WriteAllText(PACServer.PAC_FILE, abpContent, Encoding.UTF8);
if (UpdateCompleted != null)
{
UpdateCompleted(this, new ResultEventArgs(true));
}
UpdateCompleted?.Invoke(this, new ResultEventArgs(true));
}
catch (Exception ex)
{
if (Error != null)
{
Error(this, new ErrorEventArgs(ex));
}
Error?.Invoke(this, new ErrorEventArgs(ex));
}
}


Loading…
Cancel
Save