Beispiel #1
0
        public static bool MergeAndWritePACFile(string gfwListResult)
        {
            //var stackTrace = new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(3));
            //var memberName = stackTrace.GetFrame(0).GetMethod().Name;
            //System.Diagnostics.Debug.WriteLine("-----------" + memberName);
            PACServer.TouchPACFile();
            var    original = PACServer.PacContent;
            string rules = null, userrules = null;

            if (!string.IsNullOrEmpty(gfwListResult))
            {
                var parse = ParseResult(gfwListResult);
                rules = SimpleJson.SimpleJson.SerializeObject(parse);
            }
            if (File.Exists(PACServer.USER_RULE_FILE))
            {
                string ur  = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
                var    spl = ur.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(c => !c.StartsWith("!") && !c.StartsWith("["));
                userrules = SimpleJson.SimpleJson.SerializeObject(spl);
            }
            var result = PACServer.ReplaceContent(original, rules, userrules);

            if (original.Equals(result))
            {
                return(false);
            }
            PACServer.PacContent = result;
            return(true);
        }
 public void TouchPACFile()
 {
     string pacFilename = _pacServer.TouchPACFile();
     if (PACFileReadyToOpen != null)
     {
         PACFileReadyToOpen(this, new PathEventArgs() { Path = pacFilename });
     }
 }
Beispiel #3
0
        public void TouchPACFile()
        {
            string pacFilename = _pacServer.TouchPACFile();

            PACFileReadyToOpen?.Invoke(this, new PathEventArgs()
            {
                Path = pacFilename
            });
        }
 public void TouchPACFile()
 {
     PACFileReadyToOpen?.Invoke(this, new PathEventArgs {
         Path = PACServer.TouchPACFile()
     });
 }