Esempio n. 1
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();
        }
Esempio n. 2
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();
            }
        }