public FileQueue(MainWindow mainwindow) { InitializeComponent(); this.mainwindow = mainwindow; }
/// <summary> /// Video Filter Combine (Method) /// <summary> public static String VideoFilter(MainWindow mainwindow) { // Video Bitrate None Check // Video Codec None Check // Codec Copy Check // Media Type Check if ((string)mainwindow.cboVideoQuality.SelectedItem != "None" && (string)mainwindow.cboVideoCodec.SelectedItem != "None" && (string)mainwindow.cboVideoCodec.SelectedItem != "Copy" && (string)mainwindow.cboMediaType.SelectedItem != "Audio") { // -------------------------------------------------- // Add Each Filter to Master Filters List // -------------------------------------------------- // ------------------------- // Resize // ------------------------- Video.Size(mainwindow); // ------------------------- // Crop // ------------------------- Video.Crop(mainwindow, Video.cropwindow); // ------------------------- // PNG to JPEG // ------------------------- VideoFilters.PNGtoJPG_Filter(mainwindow); // ------------------------- // Subtitles Burn // ------------------------- VideoFilters.SubtitlesBurn_Filter(mainwindow); // ------------------------- // Deband // ------------------------- VideoFilters.Deband_Filter(/*mainwindow*/); // ------------------------- // Deshake // ------------------------- VideoFilters.Deshake_Filter(mainwindow); // ------------------------- // Deflicker // ------------------------- VideoFilters.Deflicker_Filter(mainwindow); // ------------------------- // Dejudder // ------------------------- VideoFilters.Dejudder_Filter(mainwindow); // ------------------------- // Denoise // ------------------------- VideoFilters.Denoise_Filter(mainwindow); // ------------------------- // EQ - Brightness, Contrast, Saturation, Gamma // ------------------------- VideoFilters.Video_EQ_Filter(mainwindow); // ------------------------- // Selective SelectiveColorPreview // ------------------------- VideoFilters.SelectiveColor_Filter(mainwindow); // ------------------------- // Filter Combine // ------------------------- if ((string)mainwindow.cboVideoCodec.SelectedItem != "None") // None Check { //System.Windows.MessageBox.Show(string.Join(",\r\n\r\n", vFiltersList.Where(s => !string.IsNullOrEmpty(s)))); //debug //System.Windows.MessageBox.Show(Convert.ToString(vFiltersList.Count())); //debug // ------------------------- // 1 Filter // ------------------------- if (vFiltersList.Count == 1) { // Always wrap in quotes vFilter = "-vf \"" + string.Join(", \r\n\r\n", vFiltersList .Where(s => !string.IsNullOrEmpty(s))) + "\""; } // ------------------------- // Multiple Filters // ------------------------- else if (vFiltersList.Count > 1) { // Always wrap in quotes // Linebreak beginning and end vFilter = "-vf \"\r\n" + string.Join(", \r\n\r\n", vFiltersList .Where(s => !string.IsNullOrEmpty(s))) + "\r\n\""; } // ------------------------- // Empty // ------------------------- else { vFilter = string.Empty; } } // ------------------------- // Video Codec None // ------------------------- else { vFilter = string.Empty; } } // Return Value return(vFilter); }
/// <summary> /// Audio Filter Combine (Method) /// <summary> public static String AudioFilter(MainWindow mainwindow) { // Audio Bitrate None Check // Audio Codec None // Codec Copy Check // Mute Check // Stream None Check // Media Type Check if ((string)mainwindow.cboAudioQuality.SelectedItem != "None" && (string)mainwindow.cboAudioCodec.SelectedItem != "None" && (string)mainwindow.cboAudioCodec.SelectedItem != "Copy" && (string)mainwindow.cboAudioQuality.SelectedItem != "Mute" && (string)mainwindow.cboAudioStream.SelectedItem != "none" && (string)mainwindow.cboMediaType.SelectedItem != "Image" && (string)mainwindow.cboMediaType.SelectedItem != "Sequence") { // -------------------------------------------------- // Filters // -------------------------------------------------- // ------------------------- // Volume // ------------------------- Audio.Volume(mainwindow); // ------------------------- // Hard Limiter // ------------------------- Audio.HardLimiter(mainwindow); // ------------------------- // Remove Click // ------------------------- //RemoveClick_Filter(mainwindow); // ------------------------- // Lowpass // ------------------------- Lowpass_Filter(mainwindow); // ------------------------- // Highpass // ------------------------- Highpass_Filter(mainwindow); // ------------------------- // Contrast // ------------------------- Contrast_Filter(mainwindow); // ------------------------- // Extra Stereo // ------------------------- ExtraStereo_Filter(mainwindow); // ------------------------- // Headphones // ------------------------- Headphones_Filter(mainwindow); // ------------------------- // Tempo // ------------------------- Tempo_Filter(mainwindow); // ------------------------- // Filter Combine // ------------------------- if ((string)mainwindow.cboAudioCodec.SelectedItem != "None") // None Check { // ------------------------- // 1 Filter // ------------------------- if (aFiltersList.Count == 1) { // Always wrap in quotes aFilter = "-af \"" + string.Join(", \r\n\r\n", aFiltersList .Where(s => !string.IsNullOrEmpty(s))) + "\""; } // ------------------------- // Multiple Filters // ------------------------- else if (aFiltersList.Count > 1) { // Always wrap in quotes // Linebreak beginning and end aFilter = "-af \"\r\n" + string.Join(", \r\n\r\n", aFiltersList .Where(s => !string.IsNullOrEmpty(s))) + "\r\n\""; //System.Windows.MessageBox.Show(aFilter); //debug } // ------------------------- // Empty // ------------------------- else { aFilter = string.Empty; } } // Audio Codec None else { aFilter = string.Empty; } } // ------------------------- // Filter Clear // ------------------------- else { aFilter = string.Empty; if (aFiltersList != null) { aFiltersList.Clear(); aFiltersList.TrimExcess(); } } // Return Value return(aFilter); }
/// <summary> /// Selective SelectiveColorPreview (Method) /// <summary> public static void SelectiveColor_Filter(MainWindow mainwindow) { string selectiveColor = string.Empty; List <double> selectiveColorSliders = new List <double>() { // Reds mainwindow.slFiltersVideo_SelectiveColor_Reds_Cyan.Value, //ViewModel.Filters.slFiltersVideo_SelectiveColor_Reds_Cyan_Value, mainwindow.slFiltersVideo_SelectiveColor_Reds_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Reds_Yellow.Value, // Yellows mainwindow.slFiltersVideo_SelectiveColor_Yellows_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Yellows_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Yellows_Yellow.Value, // Greens mainwindow.slFiltersVideo_SelectiveColor_Greens_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Greens_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Greens_Yellow.Value, // Cyans mainwindow.slFiltersVideo_SelectiveColor_Cyans_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Cyans_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Cyans_Yellow.Value, // Blues mainwindow.slFiltersVideo_SelectiveColor_Blues_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Blues_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Blues_Yellow.Value, // Magentas mainwindow.slFiltersVideo_SelectiveColor_Magentas_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Magentas_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Magentas_Yellow.Value, // Whites mainwindow.slFiltersVideo_SelectiveColor_Whites_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Whites_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Whites_Yellow.Value, // Neutrals mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Yellow.Value, // Blacks mainwindow.slFiltersVideo_SelectiveColor_Blacks_Cyan.Value, mainwindow.slFiltersVideo_SelectiveColor_Blacks_Magenta.Value, mainwindow.slFiltersVideo_SelectiveColor_Blacks_Yellow.Value, }; // ------------------------- // Enable if at least one Slider is active // Combines values of all sliders // ------------------------- if (selectiveColorSliders.Sum() != 0) { // ------------------------- // Reds // ------------------------- // Cyan string reds_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Reds_Cyan.Value); //string reds_cyan = SelectiveColor_Normalize(ViewModel.Filters.slFiltersVideo_SelectiveColor_Reds_Cyan_Value); //if (string.IsNullOrEmpty(reds_cyan)) { reds_cyan = "0"; }; // Magenta string reds_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Reds_Magenta.Value); // Yellow string reds_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Reds_Yellow.Value); // ------------------------- // Yellows // ------------------------- // Cyan string yellows_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Yellows_Cyan.Value); // Magenta string yellows_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Yellows_Magenta.Value); // Yellow string yellows_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Yellows_Yellow.Value); // ------------------------- // Greens // ------------------------- // Cyan string greens_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Greens_Cyan.Value); // Magenta string greens_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Greens_Magenta.Value); // Yellow string greens_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Greens_Yellow.Value); // ------------------------- // Cyans // ------------------------- // Cyan string cyans_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Cyans_Cyan.Value); // Magenta string cyans_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Cyans_Magenta.Value); // Yellow string cyans_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Cyans_Yellow.Value); // ------------------------- // Blues // ------------------------- // Cyan string blues_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blues_Cyan.Value); // Magenta string blues_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blues_Magenta.Value); // Yellow string blues_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blues_Yellow.Value); // ------------------------- // Magentas // ------------------------- // Cyan string magentas_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Magentas_Cyan.Value); // Magenta string magentas_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Magentas_Magenta.Value); // Yellow string magentas_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Magentas_Yellow.Value); // ------------------------- // Whites // ------------------------- // Cyan string whites_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Whites_Cyan.Value); // Magenta string whites_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Whites_Magenta.Value); // Yellow string whites_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Whites_Yellow.Value); // ------------------------- // Nuetrals // ------------------------- // Cyan string neutrals_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Cyan.Value); // Magenta string neutrals_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Magenta.Value); // Yellow string neutrals_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Neutrals_Yellow.Value); // ------------------------- // Blacks // ------------------------- // Cyan string blacks_cyan = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blacks_Cyan.Value); // Magenta string blacks_magenta = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blacks_Magenta.Value); // Yellow string blacks_yellow = SelectiveColor_Normalize(mainwindow.slFiltersVideo_SelectiveColor_Blacks_Yellow.Value); // ------------------------- // Combine // ------------------------- List <string> selectiveColorList = new List <string>() { "selectivecolor=" + "\r\n" + "correction_method=" + mainwindow.cboFilterVideo_SelectiveColor_Correction_Method.SelectedItem.ToString() + "\r\n", "reds=" + reds_cyan + " " + reds_magenta + " " + reds_yellow + "\r\n", "yellows=" + yellows_cyan + " " + yellows_magenta + " " + yellows_yellow + "\r\n", "greens=" + greens_cyan + " " + greens_magenta + " " + greens_yellow + "\r\n", "cyans=" + cyans_cyan + " " + cyans_magenta + " " + cyans_yellow + "\r\n", "blues=" + blues_cyan + " " + blues_magenta + " " + blues_yellow + "\r\n", "magentas=" + magentas_cyan + " " + magentas_magenta + " " + magentas_yellow + "\r\n", "whites=" + whites_cyan + " " + whites_magenta + " " + whites_yellow + "\r\n", "neutrals=" + neutrals_cyan + " " + neutrals_magenta + " " + neutrals_yellow + "\r\n", "blacks=" + blacks_cyan + " " + blacks_magenta + " " + blacks_yellow + "\r\n", }; selectiveColor = string.Join(":", selectiveColorList .Where(s => !string.IsNullOrEmpty(s)) ); // ------------------------- // Add Filter to List // ------------------------- vFiltersList.Add(selectiveColor); } }
/// <summary> /// OnePassArgs /// </summary> // 1-Pass, CRF, & Auto public static String OnePassArgs(MainWindow mainwindow) { // ------------------------- // Single Pass // ------------------------- if ((string)mainwindow.cboPass.SelectedItem == "1 Pass" || (string)mainwindow.cboPass.SelectedItem == "CRF" || (string)mainwindow.cboPass.SelectedItem == "auto" || (string)mainwindow.cboFormat.SelectedItem == "ogv" //ogv (special rule) ) { // ------------------------- // Arguments List // ------------------------- List<string> FFmpegArgsSinglePassList = new List<string>() { "\r\n\r\n" + "-i "+ "\"" + MainWindow.InputPath(mainwindow) + "\"", "\r\n\r\n" + Video.Subtitles(mainwindow), "\r\n\r\n" + Video.VideoCodec(mainwindow), "\r\n" + Video.Speed(mainwindow, "pass single"), Video.VideoQuality(mainwindow), "\r\n" + Video.FPS(mainwindow), "\r\n" + VideoFilters.VideoFilter(mainwindow), "\r\n" + Video.ScalingAlgorithm(mainwindow), "\r\n" + Video.Images(mainwindow), "\r\n" + Video.Optimize(mainwindow), "\r\n" + Streams.VideoStreamMaps(mainwindow), "\r\n\r\n" + Video.SubtitleCodec(mainwindow), "\r\n" + Streams.SubtitleMaps(mainwindow), "\r\n\r\n" + Audio.AudioCodec(mainwindow), "\r\n" + Audio.AudioQuality(mainwindow), Audio.SampleRate(mainwindow), Audio.BitDepth(mainwindow), Audio.Channel(mainwindow), "\r\n" + AudioFilters.AudioFilter(mainwindow), "\r\n" + Streams.AudioStreamMaps(mainwindow), "\r\n\r\n" + Format.Cut(mainwindow), "\r\n\r\n" + Streams.FormatMaps(mainwindow), "\r\n\r\n" + Format.ForceFormat(mainwindow), "\r\n\r\n" + MainWindow.ThreadDetect(mainwindow), "\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\"" }; // Join List with Spaces // Remove: Empty, Null, Standalone LineBreak Video.passSingle = string.Join(" ", FFmpegArgsSinglePassList .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals(Environment.NewLine)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ); } // Return Value return Video.passSingle; }
// -------------------------------------------------------------------------------------------------------- /// <summary> /// FFmpeg Batch - Generate Args /// </summary> public static void FFmpegBatchGenerateArgs(MainWindow mainwindow) { if (mainwindow.tglBatch.IsChecked == true) { // Replace ( with ^( to avoid Windows 7 CMD Error //important! // This is only used in select areas //MainWindow.batchInputAuto = mainwindow.textBoxBrowse.Text.Replace(@"(", "^("); //MainWindow.batchInputAuto = MainWindow.batchInputAuto.Replace(@")", "^)"); // Log Console Message ///////// Log.WriteAction = () => { Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Batch: ")) { Foreground = Log.ConsoleDefault }); Log.logParagraph.Inlines.Add(new Run(Convert.ToString(mainwindow.tglBatch.IsChecked)) { Foreground = Log.ConsoleDefault }); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Generating Batch Script...")) { Foreground = Log.ConsoleTitle }); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Running Batch Convert...")) { Foreground = Log.ConsoleAction }); }; Log.LogActions.Add(Log.WriteAction); // ------------------------- // Batch Arguments Full // ------------------------- // Make List // List<string> FFmpegBatchArgsList = new List<string>() { "cd /d", "\"" + MainWindow.BatchInputDirectory(mainwindow) + "\"", "\r\n\r\n" + "&& for %f in", "(*" + MainWindow.batchExt + ")", "do (echo)", "\r\n\r\n" + Video.BatchVideoQualityAuto(mainwindow), "\r\n\r\n" + Audio.BatchAudioQualityAuto(mainwindow), "\r\n\r\n" + Audio.BatchAudioBitrateLimiter(mainwindow), "\r\n\r\n" + "&&", "\r\n\r\n" + MainWindow.FFmpegPath(), "\r\n\r\n" + Video.HWAcceleration(mainwindow), "-y", //%~f added in InputPath() FFmpeg.OnePassArgs(mainwindow), //disabled if 2-Pass FFmpeg.TwoPassArgs(mainwindow) //disabled if 1-Pass }; // Join List with Spaces // Remove: Empty, Null, Standalone LineBreak ffmpegArgsSort = string.Join(" ", FFmpegBatchArgsList .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals(Environment.NewLine)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ); // Inline ffmpegArgs = MainWindow.RemoveLineBreaks( string.Join(" ", FFmpegBatchArgsList .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals(Environment.NewLine)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ) ); //.Replace("\r\n", " ") // Replace Linebreaks with Spaces to avoid arguments touching //.Replace(Environment.NewLine, ""); } }
/// <summary> /// Batch 2Pass Args /// </summary> public static String TwoPassArgs(MainWindow mainwindow) { // ------------------------- // 2-Pass Auto Quality // ------------------------- // Enabled // if ((string)mainwindow.cboPass.SelectedItem == "2 Pass" && (string)mainwindow.cboMediaType.SelectedItem == "Video" // video only && (string)mainwindow.cboVideoCodec.SelectedItem != "Copy" // exclude copy && (string)mainwindow.cboFormat.SelectedItem != "ogv" // exclude ogv (special rule) ) { // ------------------------- // Pass 1 // ------------------------- List<string> FFmpegArgsPass1List = new List<string>() { "\r\n\r\n" + "-i "+ "\"" + MainWindow.InputPath(mainwindow) + "\"", //"\r\n\r\n" + //Video.Subtitles(mainwindow), "\r\n\r\n" + Video.VideoCodec(mainwindow), "\r\n" + Video.Speed(mainwindow, "pass 1"), Video.VideoQuality(mainwindow), "\r\n" + Video.FPS(mainwindow), "\r\n" + VideoFilters.VideoFilter(mainwindow), "\r\n" + Video.ScalingAlgorithm(mainwindow), "\r\n" + Video.Images(mainwindow), "\r\n" + Video.Optimize(mainwindow), "\r\n" + Video.Pass1Modifier(mainwindow), // -pass 1, -x265-params pass=2 "\r\n\r\n" + "-sn -an", // Disable Audio & Subtitles for Pass 1 to speed up encoding "\r\n\r\n" + Format.Cut(mainwindow), "\r\n\r\n" + Format.ForceFormat(mainwindow), "\r\n\r\n" + MainWindow.ThreadDetect(mainwindow), //"\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\"" "\r\n\r\n" + "NUL" }; // Join List with Spaces // Remove: Empty, Null, Standalone LineBreak Video.pass1Args = string.Join(" ", FFmpegArgsPass1List .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals(Environment.NewLine)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ); // ------------------------- // Pass 2 // ------------------------- List<string> FFmpegArgsPass2List = new List<string>() { // Video Methods have already defined Global Strings in Pass 1 // Use Strings instead of Methods // "\r\n\r\n" + "&&", "\r\n\r\n" + MainWindow.FFmpegPath(), "-y", "\r\n\r\n" + Video.HWAcceleration(mainwindow), "\r\n\r\n" + "-i " + "\"" + MainWindow.InputPath(mainwindow) + "\"", "\r\n\r\n" + Video.Subtitles(mainwindow), "\r\n\r\n" + Video.vCodec, "\r\n" + Video.Speed(mainwindow, "pass 2"), Video.vQuality, "\r\n" + Video.fps, "\r\n" + VideoFilters.vFilter, "\r\n" + Video.ScalingAlgorithm(mainwindow), "\r\n" + Video.image, "\r\n" + Video.optimize, "\r\n" + Streams.VideoStreamMaps(mainwindow), "\r\n" + Video.Pass2Modifier(mainwindow), // -pass 2, -x265-params pass=2 "\r\n\r\n" + Video.SubtitleCodec(mainwindow), "\r\n" + Streams.SubtitleMaps(mainwindow), "\r\n\r\n" + Audio.AudioCodec(mainwindow), "\r\n" + Audio.AudioQuality(mainwindow), Audio.SampleRate(mainwindow), Audio.BitDepth(mainwindow), Audio.Channel(mainwindow), "\r\n" + AudioFilters.AudioFilter(mainwindow), "\r\n" + Streams.AudioStreamMaps(mainwindow), "\r\n\r\n" + Format.trim, "\r\n\r\n" + Streams.FormatMaps(mainwindow), "\r\n\r\n" + Format.ForceFormat(mainwindow), "\r\n\r\n" + Configure.threads, "\r\n\r\n" + "\"" + MainWindow.OutputPath(mainwindow) + "\"" }; // Join List with Spaces // Remove: Empty, Null, Standalone LineBreak Video.pass2Args = string.Join(" ", FFmpegArgsPass2List .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals(Environment.NewLine)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ); // Combine Pass 1 & Pass 2 Args // Video.v2PassArgs = Video.pass1Args + " " + Video.pass2Args; } // Return Value return Video.v2PassArgs; }
/// <summary> /// Create Output Log (Method) /// </summary> public static void CreateOutputLog(MainWindow mainwindow) { // ------------------------- // Background Thread Worker // ------------------------- BackgroundWorker bwlog = new BackgroundWorker(); bwlog.WorkerSupportsCancellation = true; // This allows the worker to report progress during work bwlog.WorkerReportsProgress = true; // What to do in the background thread bwlog.DoWork += new DoWorkEventHandler(delegate(object o, DoWorkEventArgs args) { BackgroundWorker b = o as BackgroundWorker; // Dispatcher Allows Cross-Thread Communication mainwindow.Dispatcher.Invoke(() => { // Log Path if (VM.ConfigureView.LogCheckBox_IsChecked == true) // Only if Log is Enabled through Configure Checkbox { // Start write output log file //Catch Directory Access Errors try { TextRange t = new TextRange(mainwindow.logconsole.rtbLog.Document.ContentStart, mainwindow.logconsole.rtbLog.Document.ContentEnd); FileStream file = new FileStream(VM.ConfigureView.LogPath_Text + "axiom.log", FileMode.Create); t.Save(file, System.Windows.DataFormats.Text); file.Close(); } catch { // Log Console Message ///////// Log.WriteAction = () => { Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Warning: Saving Output Log to " + "\"" + VM.ConfigureView.LogPath_Text + "\"" + " is Denied. May require Administrator Privileges.")) { Foreground = ConsoleWarning }); }; Log.LogActions.Add(Log.WriteAction); // Popup Message Dialog Box MessageBox.Show("Error Saving Output Log to " + "\"" + VM.ConfigureView.LogPath_Text + "\"" + ". May require Administrator Privileges.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); // do not halt program } } }); //end dispatcher }); //end thread // ------------------------- // When Background Worker Completes Task // ------------------------- bwlog.RunWorkerCompleted += new RunWorkerCompletedEventHandler(delegate(object o, RunWorkerCompletedEventArgs args) { // Close the Background Worker bwlog.CancelAsync(); bwlog.Dispose(); }); //end worker completed task bwlog.RunWorkerAsync(); }