Skip to content

Commit a63c0b7

Browse files
committed
1.7.16
[Changes] - Possibilty to "run" any file with "Run program action"
1 parent 8762f51 commit a63c0b7

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,47 +47,56 @@ public override ActionEndResult RunAction(params object[] parameter)
4747
{
4848
try
4949
{
50-
50+
bool result = false;
5151
Process[] runningProcesses = Process.GetProcesses();
52+
bool processFound = false;
53+
CallNewLog(new LogEntry($"Searching for{ProcessName}..."));
54+
string searchName = ProcessName;
55+
if (searchName.ToUpperInvariant().EndsWith(".EXE"))
56+
searchName.Substring(0, searchName.Length - 4);
5257
foreach (Process process in runningProcesses)
5358
{
54-
if (process.ProcessName == ProcessName)
59+
if (process.ProcessName == searchName)
60+
{
5561
try
5662
{
5763
CallNewLog(new LogEntry($"Closing {ProcessName}..."));
5864

59-
bool result = process.CloseMainWindow();
60-
if (!result)
61-
62-
process.Close();
65+
result = process.CloseMainWindow();
66+
process.WaitForExit(3000);
6367
}
6468
catch (Exception ex)
6569
{
6670
throw new Exception($"Closing {ProcessName} failed", ex);
6771
}
68-
if (!process.HasExited)
69-
{
70-
if (Force)
72+
if (!process.HasExited)
7173
{
72-
CallNewLog(new LogEntry($"Killing {ProcessName}..."));
73-
try
74-
{
75-
process.Kill();
76-
CallNewLog(new LogEntry($"Process {ProcessName} killed.."));
77-
78-
}
79-
catch (Exception ex)
74+
if (Force)
8075
{
81-
throw new Exception($"Killing {ProcessName} failed", ex);
76+
CallNewLog(new LogEntry($"Killing {ProcessName}..."));
77+
try
78+
{
79+
process.Kill();
80+
CallNewLog(new LogEntry($"Process {ProcessName} killed.."));
81+
result = true;
82+
83+
}
84+
catch (Exception ex)
85+
{
86+
throw new Exception($"Killing {ProcessName} failed", ex);
87+
}
8288
}
89+
else
90+
result = false;
8391
}
92+
else
93+
CallNewLog(new LogEntry($"Process {ProcessName} closed."));
8494
}
85-
else
86-
CallNewLog(new LogEntry($"Process {ProcessName} closed."));
87-
88-
8995
}
90-
return new ActionEndResult(true);
96+
if (!processFound)
97+
CallNewLog(new LogEntry($"Process {ProcessName} not found."));
98+
99+
return new ActionEndResult(result);
91100
}
92101
catch (Exception ex)
93102
{

Source/HDRProfile/Profiles/Actions/RunProgramAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void GetFile()
8888
{
8989
OpenFileDialog fileDialog = new OpenFileDialog();
9090
fileDialog.DefaultExt = ".exe";
91-
fileDialog.Filter = "Executables (.exe)|*.exe";
91+
fileDialog.Filter = "Executables (.exe)|*.exe| All Files| *.*";
9292
Nullable<bool> result = fileDialog.ShowDialog();
9393
string filePath = string.Empty;
9494
if (result == true)

Source/HDRProfile/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
5353
// indem Sie "*" wie unten gezeigt eingeben:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("1.7.15.0")]
56-
[assembly: AssemblyFileVersion("1.7.15.0")]
55+
[assembly: AssemblyVersion("1.7.16.0")]
56+
[assembly: AssemblyFileVersion("1.7.16.0")]

0 commit comments

Comments
 (0)