public static void RunWorkers() { if (isInitialaized) { return; } isInitialaized = true; WorkerReset = new ManualResetEvent(false); commands = new Commands(); autoRG = new AutoRG(); autoMouse = new AutoMouse(); if (!Directory.Exists(Globals.DocumentPath + @"\CustomMapData")) { Directory.CreateDirectory(Globals.DocumentPath + @"\CustomMapData"); } SaveFileWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\CustomMapData", "*.txt"); SaveFileWatcher.Created += Actions.SaveFileWatcher_Created; SaveFileWatcher.IncludeSubdirectories = true; SaveFileWatcher.EnableRaisingEvents = false; SaveFileWatcher.NotifyFilter = NotifyFilters.FileName; SaveWatcherTimer = new System.Windows.Forms.Timer(); SaveWatcherTimer.Interval = 10000; SaveWatcherTimer.Tick += Actions.WatcherTimer_Tick; if (!Directory.Exists(Globals.DocumentPath + @"\Replay")) { Directory.CreateDirectory(Globals.DocumentPath + @"\Replay"); } ReplayWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\Replay", "*.w3g"); ReplayWatcher.Created += Actions.ReplayWatcher_Function; ReplayWatcher.Changed += Actions.ReplayWatcher_Function; ReplayWatcher.IncludeSubdirectories = false; ReplayWatcher.EnableRaisingEvents = Settings.IsAutoReplay; if (!Directory.Exists(Globals.DocumentPath + @"\ScreenShots")) { Directory.CreateDirectory(Globals.DocumentPath + @"\ScreenShots"); } ScreenShotWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\ScreenShots", "*.tga"); ScreenShotWatcher.Created += Actions.ScreenShotWatcher_Created; ScreenShotWatcher.IncludeSubdirectories = false; ScreenShotWatcher.EnableRaisingEvents = Settings.IsConvertScreenShot; if (!Directory.Exists(Globals.DocumentPath + @"\Maps")) { Directory.CreateDirectory(Globals.DocumentPath + @"\Maps"); } MapFileWatcher = new FileSystemWatcher(Globals.DocumentPath + @"\Maps", "*.w3x"); MapFileWatcher.Created += Actions.MapFileWatcher_Created; MapFileWatcher.IncludeSubdirectories = true; MapFileWatcher.EnableRaisingEvents = Settings.IsCheatMapCheck; chatHotkeyList = new ChatHotkeyList(); for (int i = 0; i < 10; i++) { if (chatHotkeyList[i].IsRegisted) { chatHotkeyList.Register(i); } } }
public static void RunWorkers() { if (isInitialaized) { return; } isInitialaized = true; WorkerReset = new ManualResetEvent(false); Commands.StartDetect(); AutoMouse.CheckOff(); string path = $"{Globals.DocumentPath}\\CustomMapData"; CheckPath(path); SaveFileWatcher = new FileSystemWatcher(path, "*.txt"); SaveFileWatcher.Created += Actions.SaveFileWatcher_Created; SaveFileWatcher.IncludeSubdirectories = true; SaveFileWatcher.EnableRaisingEvents = false; SaveFileWatcher.NotifyFilter = NotifyFilters.FileName; SaveWatcherTimer = new System.Windows.Forms.Timer(); SaveWatcherTimer.Interval = 10000; SaveWatcherTimer.Tick += Actions.WatcherTimer_Tick; CheckPath(path = $"{Globals.DocumentPath}\\Replay"); ReplayWatcher = new FileSystemWatcher(path, "*.w3g"); ReplayWatcher.Created += Actions.ReplayWatcher_Function; ReplayWatcher.Changed += Actions.ReplayWatcher_Function; ReplayWatcher.IncludeSubdirectories = false; ReplayWatcher.EnableRaisingEvents = Settings.IsAutoReplay; CheckPath(path = $"{Globals.DocumentPath}\\ScreenShots"); ScreenShotWatcher = new FileSystemWatcher(path, "*.tga"); ScreenShotWatcher.Created += Actions.ScreenShotWatcher_Created; ScreenShotWatcher.IncludeSubdirectories = false; ScreenShotWatcher.EnableRaisingEvents = Settings.IsConvertScreenShot; CheckPath(path = $"{Globals.DocumentPath}\\Maps"); MapFileWatcher = new FileSystemWatcher(path, "*.w3x"); MapFileWatcher.Created += Actions.MapFileWatcher_Created; MapFileWatcher.IncludeSubdirectories = true; MapFileWatcher.EnableRaisingEvents = Settings.IsCheatMapCheck; chatHotkeyList = new ChatHotkeyList(); for (int i = 0; i < 10; i++) { if (chatHotkeyList[i].IsRegisted) { chatHotkeyList.Register(i); } } }