Ejemplo n.º 1
0
        /// <summary>
        ///    Window Loaded
        /// </summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ViewModel vm = mainwindow.DataContext as ViewModel;

            // -------------------------
            // Display FFprobe File Properties
            // -------------------------

            // Get FFprobe Path
            MainWindow.FFprobePath(vm);

            // -------------------------
            // Write Properties to Window
            // -------------------------
            try
            {
                Paragraph propertiesParagraph = new Paragraph(); //RichTextBox

                // Clear Rich Text Box on Start
                propertiesParagraph.Inlines.Clear();

                // Start
                rtbFileProperties.Document = new FlowDocument(propertiesParagraph);

                FFprobe.argsFileProperties = " -i" + " " + "\"" + vm.Input_Text + "\"" + " -v quiet -print_format ini -show_format -show_streams";

                FFprobe.inputFileProperties = FFprobe.InputFileInfo(vm.Input_Text,
                                                                    vm.Batch_IsChecked,
                                                                    FFprobe.argsFileProperties
                                                                    );

                // Write All File Properties to Rich Text Box
                if (!string.IsNullOrEmpty(FFprobe.inputFileProperties))
                {
                    rtbFileProperties.BeginChange(); // begin change

                    propertiesParagraph.Inlines.Add(new Run(FFprobe.inputFileProperties)
                    {
                        Foreground = Log.ConsoleDefault
                    });

                    rtbFileProperties.EndChange(); // end change
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Debug Test Button
        /// </summary>
        private void btnDebugTest_Click(object sender, RoutedEventArgs e)
        {
            // -------------------------
            // Keep FFmpeg Window Toggle
            // -------------------------
            //MainWindow.KeepWindow(mainwindow);

            // -------------------------
            // Batch Extention Period Check
            // -------------------------
            MainWindow.BatchExtCheck(mainwindow);

            // -------------------------
            // Set FFprobe Path
            // -------------------------
            MainWindow.FFprobePath(mainwindow);

            // -------------------------
            // Ready Halts
            // -------------------------
            MainWindow.ReadyHalts(mainwindow);


            // -------------------------
            // Background Thread Worker
            // -------------------------
            BackgroundWorker fileprocess = new BackgroundWorker();

            fileprocess.WorkerSupportsCancellation = true;
            fileprocess.WorkerReportsProgress      = true;

            fileprocess.DoWork += new DoWorkEventHandler(delegate(object o, DoWorkEventArgs args)
            {
                BackgroundWorker b = o as BackgroundWorker;

                // Cross-Thread Communication
                this.Dispatcher.Invoke(() =>
                {
                    // -------------------------
                    // Single
                    // -------------------------
                    if (mainwindow.tglBatch.IsChecked == false)
                    {
                        // -------------------------
                        // FFprobe Detect Metadata
                        // -------------------------
                        FFprobe.Metadata(mainwindow);

                        // -------------------------
                        // FFmpeg Generate Arguments (Single)
                        // -------------------------
                        //disabled if batch
                        FFmpeg.FFmpegSingleGenerateArgs(mainwindow);
                    }

                    // -------------------------
                    // Batch
                    // -------------------------
                    else if (mainwindow.tglBatch.IsChecked == true)
                    {
                        // -------------------------
                        // FFprobe Video Entry Type Containers
                        // -------------------------
                        //FFprobe.VideoEntryTypeBatch(this);
                        FFprobe.VideoEntryType(mainwindow);

                        // -------------------------
                        // FFprobe Video Entry Type Containers
                        // -------------------------
                        //FFprobe.AudioEntryTypeBatch(this);
                        FFprobe.AudioEntryType(mainwindow);

                        // -------------------------
                        // FFmpeg Generate Arguments (Batch)
                        // -------------------------
                        //disabled if single file
                        FFmpeg.FFmpegBatchGenerateArgs(mainwindow);
                    }
                }); //end dispatcher
            });     //end thread


            // When background worker completes task
            fileprocess.RunWorkerCompleted += new RunWorkerCompletedEventHandler(delegate(object o, RunWorkerCompletedEventArgs args)
            {
                // -------------------------
                // Write Variables to Debug Window
                // -------------------------
                DebugWrite(this, mainwindow);

                // -------------------------
                // Close the Background Worker
                // -------------------------
                fileprocess.CancelAsync();
                fileprocess.Dispose();

                // -------------------------
                // Clear Variables for next Run
                // -------------------------
                MainWindow.ClearVariables(mainwindow);
                GC.Collect();
            }); //end worker completed task


            // -------------------------
            // Background Worker Run Async
            // -------------------------
            fileprocess.RunWorkerAsync();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Debug Test Button
        /// </summary>
        private void btnDebugTest_Click(object sender, RoutedEventArgs e)
        {
            MainWindow mainwindow = (MainWindow)System.Windows.Application.Current.MainWindow;
            ViewModel  vm         = mainwindow.DataContext as ViewModel;

            // -------------------------
            // Clear Variables before Run
            // -------------------------
            MainWindow.ClearGlobalVariables(vm);

            // -------------------------
            // Batch Extention Period Check
            // -------------------------
            MainWindow.BatchExtCheck(vm);

            // -------------------------
            // Set FFprobe Path
            // -------------------------
            MainWindow.FFprobePath(vm);

            // -------------------------
            // Set youtube-dl Path
            // -------------------------
            MainWindow.youtubedlPath(vm);

            // -------------------------
            // Ready Halts
            // -------------------------
            if (MainWindow.ReadyHalts(vm) == true)
            {
                // -------------------------
                // Single
                // -------------------------
                if (vm.Batch_IsChecked == false)
                {
                    // -------------------------
                    // FFprobe Detect Metadata
                    // -------------------------
                    FFprobe.Metadata(vm);

                    // -------------------------
                    // FFmpeg Generate Arguments (Single)
                    // -------------------------
                    //disabled if batch
                    FFmpeg.FFmpegSingleGenerateArgs(vm);
                }

                // -------------------------
                // Batch
                // -------------------------
                else if (vm.Batch_IsChecked == true)
                {
                    // -------------------------
                    // FFprobe Video Entry Type Containers
                    // -------------------------
                    FFprobe.VideoEntryType(vm);

                    // -------------------------
                    // FFprobe Video Entry Type Containers
                    // -------------------------
                    FFprobe.AudioEntryType(vm);

                    // -------------------------
                    // FFmpeg Generate Arguments (Batch)
                    // -------------------------
                    //disabled if single file
                    FFmpeg.FFmpegBatchGenerateArgs(vm);
                }

                // -------------------------
                // Write Variables to Debug Window
                // -------------------------
                DebugWrite(this, vm);

                // -------------------------
                // Clear Variables for next Run
                // -------------------------
                MainWindow.ClearGlobalVariables(vm);
                GC.Collect();
            }
        }