public void KillRip()
 {
     this.ripProcess.Kill();
     this.ripProcess.WaitForExit();
     this.ripProcess.Close();
     MP4AudioRipEventArgs args = new MP4AudioRipEventArgs("Rip terminated.");
     this.OutputReceived(this, args);
     this.RipInProgress = false;
 }
        public void Rip(string sourcePath, string destinationPath)
        {
            try
            {
                this.processStartInfo.Arguments = ARGS.Replace("{source}", "\"" + sourcePath + "\"").Replace("{destination}", "\"" + destinationPath + "\"");
                this.logger.LogEvent(string.Format("Arguments: {0}", this.processStartInfo.Arguments), EventType.Info);

                this.ripProcess = new Process();
                this.ripProcess.StartInfo = this.processStartInfo;
                this.ripProcess.EnableRaisingEvents = true;

                this.ripProcess.Exited += P_Exited;
                this.ripProcess.ErrorDataReceived += P_ErrorDataReceived;
                this.ripProcess.OutputDataReceived += P_OutputDataReceived;

                this.ripProcess.Start();

                this.ripProcess.BeginOutputReadLine();
                this.ripProcess.BeginErrorReadLine();

                this.RipInProgress = true;
            }
            catch (Exception ex)
            {
                this.RipInProgress = false;
                this.logger.LogEvent(ex.ToString(), EventType.Error);
                MP4AudioRipEventArgs args = new MP4AudioRipEventArgs(string.Format("Oops, there was an issue.  Have a look:\r\r{0}", ex.ToString()));
                this.ErrorReceived(this, args);
            }
        }
 private void P_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     MP4AudioRipEventArgs args = new MP4AudioRipEventArgs(e.Data);
     this.OutputReceived(sender, args);
 }
        private void P_Exited(object sender, EventArgs e)
        {
            MP4AudioRipEventArgs args = new MP4AudioRipEventArgs(e.ToString());

            this.ExitReceived(sender, args);
        }
 private void P_ErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     MP4AudioRipEventArgs args = new MP4AudioRipEventArgs(e.Data);
     this.ErrorReceived(sender, args);
 }
        private void OutputReceived(object sender, MP4AudioRipEventArgs args)
        {
            EventHandler<MP4AudioRipEventArgs> handler = OnOutput;

            if (handler != null)
            {
                handler(this, args);
            }
        }
 private void Ripper_OnOutput(object sender, MP4AudioRipEventArgs e)
 {
     this.Dispatcher.InvokeAsync(() =>
     {
         this.LogOutput(e.Data);
     });
 }