private void SinglePass(string argument) { ffmpegProcess = new FFmpegProcess(argument); ffmpegProcess.ErrorDataReceived += ProcessOnErrorDataReceived; ffmpegProcess.OutputDataReceived += ProcessOnOutputDataReceived; ffmpegProcess.Exited += (o, args) => richTextBoxOutput.Invoke((Action)(() => { if (processPanic) { return; //This should stop that one exception when closing the converter } buttonCancel.Enabled = false; timer = new Timer(); timer.Interval = 500; timer.Tick += Exited; timer.Start(); })); progressBarEncoding.Value = 0; taskbarManager.SetProgressState(TaskbarProgressBarState.Normal); labelStatus.Text = "Выполняется конвертирование"; ffmpegProcess.Start(); }
private void MultiPass(string[] arguments) { int passes = arguments.Length; ffmpegProcess = new FFmpegProcess(arguments[currentPass]); ffmpegProcess.ErrorDataReceived += ProcessOnErrorDataReceived; ffmpegProcess.OutputDataReceived += ProcessOnOutputDataReceived; ffmpegProcess.Exited += (o, args) => richTextBoxOutput.Invoke((Action)(() => { if (processPanic) { return; //This should stop that one exception when closing the converter } currentPass++; if (currentPass < passes && !cancelTwoPass) { richTextBoxOutput.AppendText(Environment.NewLine); MultiPass(arguments); return; } buttonCancel.Enabled = false; timer = new Timer(); timer.Interval = 500; timer.Tick += Exited; timer.Start(); })); progressBarEncoding.Value = 0; taskbarManager.SetProgressState(TaskbarProgressBarState.Normal); labelStatus.Text = $"Выполняется конвертирование (проход {currentPass + 1})"; ffmpegProcess.Start(); }