Skip to content

Commit

Permalink
1.2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Sep 10, 2021
1 parent a76ff2e commit e937969
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
11 changes: 10 additions & 1 deletion SuperCAL/Classes/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ public static class Config2
{"FoldersToDelete", @"C:\Micros\Simphony"},

{"XComment11", @"Pipe delimited list of files to delete on re-cal / re-download. (Example: C:\File1.txt|C:\File2.txt )"},
{"FilesToDelete", @""}
{"FilesToDelete", @""},

{"XComment13", @"Pipe delimited list of processes to stop on re-cal / re-download. (Example: Process1|Process2 )"},
{"ProcessesToStop", @"WIN7CALStart|SarOpsWin32|KDSDisplay"},

{"XComment14", @"Pipe delimited list of services to stop on re-cal / re-download excluding 'Micros Cal Client'. (Example: Service1|Service2 )"},
{"ServicesToStop", @"World Wide Web Publishing Service|MICROS KDS Controller"},

{"XComment15", @"Pipe delimited list of services to start after re-cal / re-download excluding 'Micros Cal Client'. (Example: Service1|Service2 )"},
{"ServicesToStart", @"World Wide Web Publishing Service|MICROS KDS Controller"}
};
public static Dictionary<string, string> DefaultSettings = Settings;
public static void SaveConfig()
Expand Down
38 changes: 29 additions & 9 deletions SuperCAL/Classes/McrsCalSrvc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class McrsCalSrvc
{
public static Button StopStartCAL;
public static ServiceController Service = new ServiceController("MICROS CAL Client");
private static int StopTries = 3;
private static int StartTries = 3;
public static bool IsRunning()
{
Service.Refresh();
Expand All @@ -30,11 +32,8 @@ public static Task Stop()
try
{
if (Service.Status != ServiceControllerStatus.Stopped) Service.Stop();
TryStopService("World Wide Web Publishing Service");
TryStopService("MICROS KDS Controller");
TryStopProcesses(Process.GetProcessesByName("WIN7CALStart"));
TryStopProcesses(Process.GetProcessesByName("SarOpsWin32"));
TryStopProcesses(Process.GetProcessesByName("KDSDisplay"));
foreach (string srvs in Config2.Settings["ServicesToStop"].Split('|')) TryStopService(srvs);
foreach (string proc in Config2.Settings["ProcessesToStop"].Split('|')) TryStopProcesses(Process.GetProcessesByName(proc));
Logger.Good("CAL Stopped.");
StopStartCAL.Invoke(new Action(() => {
StopStartCAL.Text = "Start CAL";
Expand All @@ -44,7 +43,18 @@ public static Task Stop()
{
Logger.Warning("Failed to stop Micros CAL: " + e.Message);
await Task.Delay(1000);
await Stop();
if (--StopTries == 0)
{
StopTries = 3;
Logger.Error("Failed to stop Micros CAL! Tried 3 times.");
StopStartCAL.Invoke(new Action(() => {
StopStartCAL.Text = "Stop CAL";
}));
}
else
{
await Stop();
}
}
});
}
Expand All @@ -55,8 +65,7 @@ public static Task Start()
return Task.Run(async () => {
try
{
TryStartService("World Wide Web Publishing Service");
TryStartService("MICROS KDS Controller");
foreach (string srvs in Config2.Settings["ServicesToStart"].Split('|')) TryStartService(srvs);
Service.Start();
Logger.Good("CAL Started.");
StopStartCAL.Invoke(new Action(() => {
Expand All @@ -67,7 +76,18 @@ public static Task Start()
{
Logger.Warning("Failed to start Micros CAL: " + e.Message);
await Task.Delay(1000);
await Start();
if (--StartTries == 0)
{
StartTries = 3;
Logger.Error("Failed to start Micros CAL! Tried 3 times.");
StopStartCAL.Invoke(new Action(() => {
StopStartCAL.Text = "Start CAL";
}));
}
else
{
await Start();
}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions SuperCAL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(true)]
[assembly: Guid("12ea0caa-7402-4b6b-b75d-466f788900e2")]
[assembly: AssemblyVersion("1.2.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]
[assembly: AssemblyVersion("1.2.5.0")]
[assembly: AssemblyFileVersion("1.2.5.0")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit e937969

Please sign in to comment.