From d2bb2c4a7db40f183f84ffd99c534fc62c7a005d Mon Sep 17 00:00:00 2001 From: kimw Date: Tue, 5 Jan 2016 03:48:55 +0800 Subject: [PATCH] fixed don't update abp rules while event user-rule file changed. in fact, the PAC will overwrite with gfwlist & use-rule but abp. --- .../Controller/ShadowsocksController.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/shadowsocks-csharp/Controller/ShadowsocksController.cs b/shadowsocks-csharp/Controller/ShadowsocksController.cs index d4282fdd..b67081d5 100755 --- a/shadowsocks-csharp/Controller/ShadowsocksController.cs +++ b/shadowsocks-csharp/Controller/ShadowsocksController.cs @@ -462,8 +462,16 @@ namespace Shadowsocks.Controller lines.Add(rule); } } - string abpContent = Utils.UnGzip(Resources.abp_js); - abpContent = abpContent.Replace("__RULES__", SimpleJson.SimpleJson.SerializeObject(lines)); + string abpContent; + if (File.Exists(PACServer.USER_ABP_FILE)) + { + abpContent = File.ReadAllText(PACServer.USER_ABP_FILE, Encoding.UTF8); + } + else + { + abpContent = Utils.UnGzip(Resources.abp_js); + } + abpContent = abpContent.Replace("__RULES__", JsonConvert.SerializeObject(lines, Formatting.Indented)); if (File.Exists(PACServer.PAC_FILE)) { string original = File.ReadAllText(PACServer.PAC_FILE, Encoding.UTF8);