/// <summary>
        /// Handles the ProgressChanged event of the backgroundWorker1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProgressChangedEventArgs" /> instance containing the event data.</param>
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            string userState = (string)e.UserState;

            this.progress = e.ProgressPercentage;
            if (this.progress == 0)
            {
                MencoderAsync mencoderAsync = this;
                mencoderAsync.standardError = string.Concat(mencoderAsync.standardError, userState, "\n");
            }
            else if (!string.IsNullOrEmpty(this.rememberLastLine))
            {
                this.standardError    = this.standardError.Replace(this.rememberLastLine, userState);
                this.rememberLastLine = userState;
            }
            else
            {
                this.rememberLastLine = userState;
                MencoderAsync mencoderAsync1 = this;
                mencoderAsync1.standardError = string.Concat(mencoderAsync1.standardError, userState, "\n");
            }
            this.OnProgress(EventArgs.Empty);
        }
        /// <summary>
        /// Handles the ErrorDataReceived event of the p control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataReceivedEventArgs" /> instance containing the event data.</param>
        private void p_ErrorDataReceived(object sender, DataReceivedEventArgs e)
        {
            MencoderAsync mencoderAsync = this;

            mencoderAsync.standardError = string.Concat(mencoderAsync.standardError, e.Data);
        }
        /// <summary>
        /// Handles the DoWork event of the backgroundWorker1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DoWorkEventArgs" /> instance containing the event data.</param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string str;
            // Get the BackgroundWorker that raised this event.
            BackgroundWorker backgroundWorker = sender as BackgroundWorker;
            // Assign the result of the computation
            // to the Result property of the DoWorkEventArgs
            // object. This is will be available to the
            // RunWorkerCompleted eventhandler.
            MencoderParameters argument = (MencoderParameters)e.Argument;

            try
            {
                Process process = new Process();
                process.ErrorDataReceived += new DataReceivedEventHandler(this.p_ErrorDataReceived);
                process.StartInfo.FileName = this.pathToMencoderExe;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.CreateNoWindow         = true;
                ProcessStartInfo startInfo = process.StartInfo;
                string[]         strArrays = new string[] { "\"", argument.source, "\" ", argument.videoParameter, " ", argument.audioParameter, " -o \"", argument.destination, "\"" };
                startInfo.Arguments = string.Concat(strArrays);
                process.Start();
                process.BeginErrorReadLine();
                int num = 0;
                while (true)
                {
                    string str1 = process.StandardOutput.ReadLine();
                    str = str1;
                    if (str1 == null || backgroundWorker.CancellationPending)
                    {
                        break;
                    }
                    num = MencoderAsync.parseAndReportProgress(backgroundWorker, str, num);
                }
                if (backgroundWorker.CancellationPending)
                {
                    mencoderResults mencoderResult = new mencoderResults()
                    {
                        Exitcode                = 99,
                        StandardError           = this.standardError,
                        ExecutionWasSuccessfull = false,
                        StandardOutput          = str
                    };
                    e.Result = mencoderResult;
                    process.Close();
                    process.CancelErrorRead();
                    process.Dispose();
                }
                else
                {
                    process.WaitForExit();
                    mencoderResults mencoderResult1 = new mencoderResults()
                    {
                        Exitcode                = process.ExitCode,
                        StandardError           = this.standardError,
                        ExecutionWasSuccessfull = process.ExitCode == 0,
                        StandardOutput          = str
                    };
                    e.Result = mencoderResult1;
                }
            }
            catch (Exception exception1)
            {
                Exception       exception       = exception1;
                mencoderResults mencoderResult2 = new mencoderResults()
                {
                    Exitcode                = 99,
                    StandardError           = this.standardError,
                    ExecutionWasSuccessfull = false,
                    StandardOutput          = exception.Message
                };
                e.Result = mencoderResult2;
            }
        }