private void button1_Click(object sender, EventArgs e) { if (ProcessFinder.FindProcess("Mooege") == true) { var answer = MessageBox.Show("Mooege is already Running. Do you want to restart Mooege?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { ProcessFinder.KillProcess("Mooege"); Process proc0 = new Process(); proc0.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath); proc0.Start(); this.Close(); } else { //Do Nothing } } else { ProcessFinder.KillProcess("Mooege"); Process proc0 = new Process(); proc0.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath); proc0.Start(); Thread.Sleep(3000); if (ErrorFinder.SearchLogs("Fatal") == true) { Console.WriteLine("Closing Mooege due Fatal Exception"); ProcessFinder.KillProcess("Mooege"); } this.Close(); } }
public static void Play() { if (File.Exists(Program.madcowINI)) { try { IConfigSource source = new IniConfigSource(Program.madcowINI); String Src = source.Configs["DiabloPath"].Get("D3Path"); if (ProcessFinder.FindProcess("Mooege") == false) { if (File.Exists(Compile.currentMooegeExePath)) { Console.WriteLine("Starting Mooege.."); Process Mooege = new Process(); Mooege.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath); Mooege.Start(); Thread.Sleep(3000); //We sleep so our ErrorFinder has time to parse Mooege logs. if (ErrorFinder.SearchLogs("Fatal") == true) { Console.WriteLine("Closing Mooege due Fatal Exception"); ProcessFinder.KillProcess("Mooege"); } else { Console.WriteLine("Starting Diablo.."); Process Diablo3 = new Process(); Diablo3.StartInfo = new ProcessStartInfo(Src); Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345"; Diablo3.Start(); //We save this repository for LastPlayed function. source.Configs["LastPlay"].Set("Repository", Compile.currentMooegeExePath); source.Save(); Process D3Patcher = new Process(); D3Patcher.StartInfo = new ProcessStartInfo(Program.programPath + @"\BnetPatcher\Bnet.Patcher.exe"); D3Patcher.Start(); } } else { Console.WriteLine("[Error] Couldn't find selected repository binaries." + "\nTry updating the repository again."); } } else //If Mooege is running we kill it and start it again. { Console.WriteLine("Killing Mooege Process.."); ProcessFinder.KillProcess("Mooege"); Console.WriteLine("Starting Mooege.."); Process Mooege = new Process(); Mooege.StartInfo = new ProcessStartInfo(Compile.currentMooegeExePath); Mooege.Start(); Thread.Sleep(3000); if (ErrorFinder.SearchLogs("Fatal") == true) { Console.WriteLine("Closing Mooege due Fatal Exception"); ProcessFinder.KillProcess("Mooege"); } else { Console.WriteLine("Starting Diablo.."); Process Diablo3 = new Process(); Diablo3.StartInfo = new ProcessStartInfo(Src); Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345"; Diablo3.Start(); //We save this repository for LastPlayed function. source.Configs["LastPlay"].Set("Repository", Compile.currentMooegeExePath); source.Save(); Process D3Patcher = new Process(); D3Patcher.StartInfo = new ProcessStartInfo(Program.programPath + @"\BnetPatcher\Bnet.Patcher.exe"); D3Patcher.Start(); } } } catch { Console.WriteLine("[ERROR] Could not launch Diablo. (Diablo.cs)" + "\nPlease report this error in the forum."); } } //If madcow.ini aint found. else { Console.WriteLine("[ERROR] Could not find MadCow config file. (Diablo.cs)" + "\nPlease report this error in the forum."); } }
public static void Play(Repository repository) { try { var src = Configuration.MadCow.DiabloPath; Configuration.UpdateMooegeIni(repository); if (ProcessFinder.FindProcess("Mooege") == false) { if (File.Exists(Paths.GetMooegeExePath(repository))) { Console.WriteLine("Starting Mooege.."); var mooege = new Process(); mooege.StartInfo = new ProcessStartInfo(Paths.GetMooegeExePath(repository)); mooege.Start(); Thread.Sleep(3000); //We sleep so our ErrorFinder has time to parse Mooege logs. if (ErrorFinder.SearchLogs("Fatal")) { Console.WriteLine("Closing Mooege due Fatal Exception"); ProcessFinder.KillProcess("Mooege"); } else { Console.WriteLine("Starting Diablo.."); var Diablo3 = new Process(); Diablo3.StartInfo = new ProcessStartInfo(src); Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345"; Diablo3.Start(); //We save this repository for LastPlayed function. Configuration.MadCow.LastRepository = Paths.GetMooegeExePath(repository); } } else { Console.WriteLine("[Error] Couldn't find selected repository binaries." + "\nTry updating the repository again."); } } else //If Mooege is running we kill it and start it again. { Console.WriteLine("Killing Mooege Process.."); ProcessFinder.KillProcess("Mooege"); Console.WriteLine("Starting Mooege.."); var mooege = new Process(); mooege.StartInfo = new ProcessStartInfo(Paths.GetMooegeExePath(repository)); mooege.Start(); Thread.Sleep(3000); if (ErrorFinder.SearchLogs("Fatal")) { Console.WriteLine("Closing Mooege due Fatal Exception"); ProcessFinder.KillProcess("Mooege"); } else { Console.WriteLine("Starting Diablo.."); var Diablo3 = new Process(); Diablo3.StartInfo = new ProcessStartInfo(src); Diablo3.StartInfo.Arguments = " -launch -auroraaddress localhost:1345"; Diablo3.Start(); } } } catch { Console.WriteLine("[ERROR] Could not launch Diablo. (Diablo.cs)" + "\nPlease report this error in the forum."); } }