Skip to content

Commit

Permalink
1.7.16
Browse files Browse the repository at this point in the history
[Changes]
- Possibilty to "run" any file with "Run program action"
  • Loading branch information
Codectory committed Dec 11, 2021
1 parent 8762f51 commit a63c0b7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
55 changes: 32 additions & 23 deletions Source/HDRProfile/Profiles/Actions/CloseProgramAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/HDRProfile/Profiles/Actions/RunProgramAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> result = fileDialog.ShowDialog();
string filePath = string.Empty;
if (result == true)
Expand Down
4 changes: 2 additions & 2 deletions Source/HDRProfile/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit a63c0b7

Please sign in to comment.