private void InTime(BotSetting botSetting) { if (botSetting.Id.HasValue) { return; } if (ProcessName.EndsWith(".exe")) { ProcessStartInfo start = new ProcessStartInfo(ProcessName) { Arguments = botSetting.ProfileName + " " + botSetting.Emulator + " " + botSetting.Instance + " " + "-a" + " " + "-nwd" + " " + "-nbs", RedirectStandardError = false, RedirectStandardOutput = false, WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true }; Process M = Process.Start(start); botSetting.Id = M.Id; } else { ProcessStartInfo start = new ProcessStartInfo("AutoIt3.exe") { Arguments = ProcessName + " " + botSetting.ProfileName + " " + botSetting.Emulator + " " + botSetting.Instance + " " + "-a" + " " + "-nwd" + " " + "-nbs", RedirectStandardError = false, RedirectStandardOutput = false, WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true }; Process M = Process.Start(start); botSetting.Id = M.Id; } }
private void NotInTime(BotSetting botSetting) { if (!botSetting.Id.HasValue) { return; } try { if (!AndroidKiller.Close(botSetting.Emulator, botSetting.Instance)) { KillProcessAndChildren(botSetting.Id.Value); } else { var mbr = Process.GetProcessById(botSetting.Id.Value); mbr.CloseMainWindow(); mbr.Close(); } } catch { } botSetting.Id = null; }