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); } } }
//internal static HangWatchdog AntiZombieProcessChecker; internal static async Task <bool> ProcessCheck() { if (GameModule.InitWarcraft3Info() != WarcraftState.OK || !GameModule.WarcraftCheck()) { InitializedWarcraft = false; if (AutoRG.IsRunning) { AutoRG.CancelAsync(); } AutoMouse.CheckOff(); // 프로그램을 찾지 못할 경우 검색 간격 증가 await Task.Delay(800); return(true); } else if (!InitializedWarcraft) { InitializedWarcraft = true; await Task.Delay(2000); Warcraft3Info.Refresh(); GameModule.GetOffset(); GameDelay = 50; RefreshCooldown = 0.01f; //ColorfulChat = true; name = string.Empty; StartDelay = Settings.StartSpeed > 0 ? Settings.StartSpeed : 0.01f; CameraDistance = Settings.CameraDistance; CameraAngleX = Settings.CameraAngleX; CameraAngleY = Settings.CameraAngleY; } if (Settings.IsAutoHp && !HPView) { HPView = true; } //AntiZombieProcessChecker.Check(); MemoryOptimizeChecker.Check(); StatusCheck(); return(false); }