public static void StartWatch(Config config)
 {
     if (fileSystemWatcher == null)
     {
         fileSystemWatcher              = new FileSystemWatcher(Application.StartupPath);
         fileSystemWatcher.Filter       = "pac.txt";
         fileSystemWatcher.NotifyFilter = NotifyFilters.Size;
         fileSystemWatcher.Changed     += (sender, args) =>
         {
             var fileInfo = new FileInfo(args.FullPath);
             if (fileSize != fileInfo.Length)
             {
                 fileSize = fileInfo.Length;
                 SystemProxyHandle.ReSetPACProxy(config);
             }
         };
     }
     fileSystemWatcher.EnableRaisingEvents = true;
 }
Exemple #2
0
 /// <summary>
 /// V2ray重启
 /// </summary>
 private void V2rayRestart()
 {
     V2rayStop();
     V2rayStart();
     SystemProxyHandle.ReSetPACProxy(_config);
 }