diff --git a/Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs b/Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs index e8320e6..8bf16c7 100644 --- a/Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs +++ b/Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs @@ -47,47 +47,56 @@ public override ActionEndResult RunAction(params object[] parameter) { try { - + bool result = false; Process[] runningProcesses = Process.GetProcesses(); + bool processFound = false; + CallNewLog(new LogEntry($"Searching for{ProcessName}...")); + string searchName = ProcessName; + if (searchName.ToUpperInvariant().EndsWith(".EXE")) + searchName.Substring(0, searchName.Length - 4); foreach (Process process in runningProcesses) { - if (process.ProcessName == ProcessName) + if (process.ProcessName == searchName) + { try { CallNewLog(new LogEntry($"Closing {ProcessName}...")); - bool result = process.CloseMainWindow(); - if (!result) - - process.Close(); + result = process.CloseMainWindow(); + process.WaitForExit(3000); } catch (Exception ex) { throw new Exception($"Closing {ProcessName} failed", ex); } - if (!process.HasExited) - { - if (Force) + if (!process.HasExited) { - CallNewLog(new LogEntry($"Killing {ProcessName}...")); - try - { - process.Kill(); - CallNewLog(new LogEntry($"Process {ProcessName} killed..")); - - } - catch (Exception ex) + if (Force) { - throw new Exception($"Killing {ProcessName} failed", ex); + CallNewLog(new LogEntry($"Killing {ProcessName}...")); + try + { + process.Kill(); + CallNewLog(new LogEntry($"Process {ProcessName} killed..")); + result = true; + + } + catch (Exception ex) + { + throw new Exception($"Killing {ProcessName} failed", ex); + } } + else + result = false; } + else + CallNewLog(new LogEntry($"Process {ProcessName} closed.")); } - else - CallNewLog(new LogEntry($"Process {ProcessName} closed.")); - - } - return new ActionEndResult(true); + if (!processFound) + CallNewLog(new LogEntry($"Process {ProcessName} not found.")); + + return new ActionEndResult(result); } catch (Exception ex) { diff --git a/Source/HDRProfile/Profiles/Actions/RunProgramAction.cs b/Source/HDRProfile/Profiles/Actions/RunProgramAction.cs index 44762aa..8e0f746 100644 --- a/Source/HDRProfile/Profiles/Actions/RunProgramAction.cs +++ b/Source/HDRProfile/Profiles/Actions/RunProgramAction.cs @@ -88,7 +88,7 @@ public void GetFile() { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.DefaultExt = ".exe"; - fileDialog.Filter = "Executables (.exe)|*.exe"; + fileDialog.Filter = "Executables (.exe)|*.exe| All Files| *.*"; Nullable result = fileDialog.ShowDialog(); string filePath = string.Empty; if (result == true) diff --git a/Source/HDRProfile/Properties/AssemblyInfo.cs b/Source/HDRProfile/Properties/AssemblyInfo.cs index 93ef35c..fffe92f 100644 --- a/Source/HDRProfile/Properties/AssemblyInfo.cs +++ b/Source/HDRProfile/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.15.0")] -[assembly: AssemblyFileVersion("1.7.15.0")] +[assembly: AssemblyVersion("1.7.16.0")] +[assembly: AssemblyFileVersion("1.7.16.0")]