diff --git a/vmaf-gui/App.config b/vmaf-gui/App.config index 731f6de..ecdcf8a 100644 --- a/vmaf-gui/App.config +++ b/vmaf-gui/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/vmaf-gui/Form1.cs b/vmaf-gui/Form1.cs index 8ca4412..8632bf7 100644 --- a/vmaf-gui/Form1.cs +++ b/vmaf-gui/Form1.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; @@ -14,6 +15,17 @@ public Form1() InitializeComponent(); } + private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + processHandles.ForEach((handle) => + { + handle.Close(); + }); + currentThread.Abort(); + } + + private List processHandles = new List(); + private Thread currentThread; string ChildProcess(string program_name, string args, bool show) { @@ -39,17 +51,17 @@ string ChildProcess(string program_name, string args, bool show) Console.WriteLine(program_name); Console.WriteLine(args); - + processHandles.Add(p); p.WaitForExit(); int exitCode = p.ExitCode; - if(exitCode != 0) + if (exitCode != 0) { throw new Exception(p.StandardError.ReadToEnd()); } - + return output; } @@ -141,7 +153,7 @@ private void button1_Click(object sender, EventArgs e) bool psnr = false; bool ssim = false; - + // Define what functions the thread does ThreadStart tStart = new ThreadStart( @@ -179,14 +191,16 @@ private void button1_Click(object sender, EventArgs e) results resultsForm = new results(); resultsForm.showResults("./log.xml"); resultsForm.ShowDialog(); - }catch + } + catch (Exception err) { - prgProgress.Invoke(new Action(delegate () { + prgProgress.Invoke(new Action(delegate () + { prgProgress.Value = 0; })); lblProgress.Invoke(new Action(delegate () { lblProgress.Text = "There was a problem running VMAF"; })); button1.Invoke(new Action(delegate () { button1.Enabled = true; })); - + MessageBox.Show(err.ToString(),"VMAF-GUI",MessageBoxButtons.OK,MessageBoxIcon.Error); } @@ -195,12 +209,12 @@ private void button1_Click(object sender, EventArgs e) ); // Define the thread and start it - Thread t = new Thread(tStart); - t.Start(); + currentThread = new Thread(tStart); + currentThread.Start(); } catch (Exception err) { - + MessageBox.Show(err.Message); } } @@ -243,11 +257,13 @@ void vmaf(string resolution, string model, bool psnr, bool ssim) }*/ lblProgress.Invoke(new Action(delegate () { lblProgress.Text = "Performing VMAF..."; })); - try{ + try + { ChildProcess("vmaf.exe", args, false); - }catch(Exception err) + } + catch (Exception err) { - MessageBox.Show(err.Message,"There was a problem with VMAF"); + MessageBox.Show(err.Message, "There was a problem with VMAF"); throw new Exception(); } diff --git a/vmaf-gui/Properties/Resources.Designer.cs b/vmaf-gui/Properties/Resources.Designer.cs index 103b36c..cf32a4b 100644 --- a/vmaf-gui/Properties/Resources.Designer.cs +++ b/vmaf-gui/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace vmaf_gui.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/vmaf-gui/Properties/Settings.Designer.cs b/vmaf-gui/Properties/Settings.Designer.cs index 1d7c361..1280653 100644 --- a/vmaf-gui/Properties/Settings.Designer.cs +++ b/vmaf-gui/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace vmaf_gui.Properties -{ - - +namespace vmaf_gui.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/vmaf-gui/vmaf-gui.csproj b/vmaf-gui/vmaf-gui.csproj index 8256fd3..a7140b9 100644 --- a/vmaf-gui/vmaf-gui.csproj +++ b/vmaf-gui/vmaf-gui.csproj @@ -8,7 +8,7 @@ WinExe vmaf_gui vmaf-gui - v4.6.1 + v4.7.2 512 true true @@ -28,6 +28,7 @@ false true true + AnyCPU @@ -58,7 +59,7 @@ true - true + false false @@ -76,6 +77,7 @@ +