protected override void WorkerDoWork(DoWorkEventArgs e)
        {
            try
            {
                using (var logger = OperationLogger.Create(OperationLogger.FFmpegDLogFile))
                {
                    if (_end == TimeSpan.MinValue)
                    {
                        FFmpeg.Crop(this.Input, this.Output, _start, this.ReportProgress, _cts.Token, logger);
                    }
                    else
                    {
                        FFmpeg.Crop(this.Input, this.Output, _start, _end, this.ReportProgress, _cts.Token, logger);
                    }
                }

                _start = _end = TimeSpan.MinValue;

                e.Result = this.CancellationPending ? OperationStatus.Canceled : OperationStatus.Success;
            }
            catch (Exception ex)
            {
                Common.SaveException(ex);
                Helper.DeleteFiles(this.Output);
                e.Result = OperationStatus.Failed;
            }
        }
        protected override void WorkerDoWork(DoWorkEventArgs e)
        {
            if (_mode == ConvertingMode.File)
            {
                try
                {
                    using (var logger = OperationLogger.Create(OperationLogger.FFmpegDLogFile))
                    {
                        FFmpeg.Convert(this.Input, this.Output, this.ReportProgress, _cts.Token, logger);

                        // Crop if not operation wasn't canceled and _start has a valid value
                        if (!this.CancellationPending && _start != TimeSpan.MinValue)
                        {
                            // Crop to end of file, unless _end has a valid value
                            if (_end == TimeSpan.MinValue)
                            {
                                FFmpeg.Crop(this.Output, this.Output, _start, this.ReportProgress, _cts.Token, logger);
                            }
                            else
                            {
                                FFmpeg.Crop(this.Output, this.Output, _start, _end, this.ReportProgress, _cts.Token, logger);
                            }
                        }
                    }

                    // Reset variables
                    _start = _end = TimeSpan.MinValue;
                }
                catch (Exception ex)
                {
                    Common.SaveException(ex);
                    Helper.DeleteFiles(this.Output);
                    e.Result = OperationStatus.Failed;
                }
            }
            else
            {
                using (var logger = OperationLogger.Create(OperationLogger.FFmpegDLogFile))
                {
                    foreach (string input in Directory.GetFiles(this.Input, _searchPattern))
                    {
                        if (this.CancellationPending)
                        {
                            break;
                        }

                        _count++;
                        try
                        {
                            string output = string.Format("{0}\\{1}.mp3",
                                                          this.Output,
                                                          Path.GetFileNameWithoutExtension(input));

                            this.ReportProgress(UpdateProperties, new Dictionary <string, object>()
                            {
                                { nameof(Operation.Title), Path.GetFileName(input) },
                                { nameof(Operation.Duration), (int)FFmpeg.GetDuration(input).Value.TotalSeconds },
                                { nameof(Operation.FileSize), Helper.GetFileSize(input) }
                            });

                            _currentOutput = output;
                            FFmpeg.Convert(input, output, this.ReportProgress, _cts.Token, logger);
                            _currentOutput = null;

                            this.ProcessedFiles.Add(output);
                        }
                        catch (Exception ex)
                        {
                            _failures++;
                            Common.SaveException(ex);
                            Helper.DeleteFiles(_currentOutput);
                            continue;
                        }
                    }
                }
            }

            // Set operation result
            e.Result = this.CancellationPending ? OperationStatus.Canceled : OperationStatus.Success;
        }