/// <summary> /// Launch the legacy application with some options set. /// </summary> public static void LaunchCommandLineApp(string app, string parameters) { // Use ProcessStartInfo class ProcessStartInfo startInfo = new ProcessStartInfo { CreateNoWindow = false, UseShellExecute = true, FileName = app, WindowStyle = ProcessWindowStyle.Minimized, Arguments = @parameters }; UpdateStatusText("Launch: " + startInfo); Process exeProcess = Process.Start(startInfo); if (app == Properties.Settings.Default.MakeMKVPath) { while (!exeProcess.HasExited) { // Discard cached information about the process. exeProcess.Refresh(); Thread.Sleep(2000); } if (exeProcess.ExitCode == 0) { RenameFiles(); if (Properties.Settings.Default.ConvWithHandbrake == true) { Convert.AddTitleToConvvertList(); Convert.ConvertWithHandbrake(); } if (Properties.Settings.Default.FinalPath != "") { MoveFilesToFinalDestination(); } Properties.Settings.Default.LastRipTitle = Properties.Settings.Default.CurrentTitle; SMTPSender.Main(true); SaveSettings(); OpenOrCloseCDDrive.Open(); Application.Exit(); return; } else { SMTPSender.Main(false); CleanupFailedRip(); OpenOrCloseCDDrive.Open(); Application.Exit(); return; } } return; }
private void toolStripExit_Click(object sender, EventArgs e) { //This is where the cancel function should go. all others are a lie. Process[] processes = Process.GetProcessesByName("makemkvcon64"); foreach (Process p in processes) { IntPtr windowHandle = p.MainWindowHandle; backgroundWorker1.CancelAsync(); p.Kill(); } OpenOrCloseCDDrive.Open(); Thread.Sleep(5000); Application.Exit(); }
private void button2_Click_1(object sender, EventArgs e) { OpenOrCloseCDDrive.Close(); Thread.Sleep(5000); var DVDDriveToUse = Ripping.GetDriveInfo("drive"); var CurrentTitle = Ripping.GetDriveInfo("label"); Settings.Default.CurrentTitle = CurrentTitle; Settings.Default.DVDDrive = DVDDriveToUse; textBoxCurrentTitle.Text = CurrentTitle; dvdDriveID.Text = DVDDriveToUse; Ripping.SaveSettings(); this.Refresh(); StartTheTimer(); }