This commit is contained in:
Serge
2023-10-03 12:22:47 +02:00
parent 46bfda3ad5
commit 2d7009d8fb
3 changed files with 26 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.127</AssemblyVersion>
<AssemblyVersion>0.128</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -10,7 +10,7 @@ public class Startup
public static bool IsScheduled()
{
TaskService taskService = new TaskService();
using (TaskService taskService = new TaskService())
return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName));
}
@@ -23,6 +23,26 @@ public class Startup
}
}
public static void StartupCheck()
{
using (TaskService taskService = new TaskService())
{
var task = taskService.RootFolder.AllTasks.FirstOrDefault(t => t.Name == taskName);
if (task != null)
{
string strExeFilePath = Application.ExecutablePath.Trim();
string action = task.Definition.Actions.FirstOrDefault()!.ToString().Trim();
if (!strExeFilePath.Equals(action, StringComparison.OrdinalIgnoreCase))
{
Logger.WriteLine(action);
Logger.WriteLine("Rescheduling to: " + strExeFilePath);
UnSchedule();
Schedule();
}
}
}
}
public static void Schedule()
{

View File

@@ -265,6 +265,9 @@ namespace GHelper
settingsForm.FansToggle(2);
modeControl.SetRyzen();
break;
default:
Startup.StartupCheck();
break;
}
}
}