mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 09:24:58 +00:00
Update ServiceMain.cs
This commit is contained in:
parent
44de5bfd1a
commit
06731f4d4b
|
@ -39,14 +39,14 @@ namespace WelsonJS.Service
|
||||||
{
|
{
|
||||||
public partial class ServiceMain : ServiceBase
|
public partial class ServiceMain : ServiceBase
|
||||||
{
|
{
|
||||||
|
private readonly string appName = "WelsonJS";
|
||||||
private static List<Timer> timers;
|
private static List<Timer> timers;
|
||||||
private string workingDirectory;
|
private string workingDirectory;
|
||||||
private string scriptName;
|
private string scriptName;
|
||||||
private string scriptFilePath;
|
private string scriptFilePath;
|
||||||
private string scriptText;
|
private string scriptText;
|
||||||
private ScriptControl scriptControl;
|
private ScriptControl scriptControl;
|
||||||
private readonly string logFilePath = Path.Combine(Path.GetTempPath(), "welsonjs_service.log");
|
private string logFilePath;
|
||||||
private readonly string appName = "WelsonJS";
|
|
||||||
private string[] args;
|
private string[] args;
|
||||||
private bool disabledHeartbeat = false;
|
private bool disabledHeartbeat = false;
|
||||||
private bool disabledScreenTime = false;
|
private bool disabledScreenTime = false;
|
||||||
|
@ -68,6 +68,9 @@ namespace WelsonJS.Service
|
||||||
// set service arguments
|
// set service arguments
|
||||||
this.args = args;
|
this.args = args;
|
||||||
|
|
||||||
|
// set the log file path
|
||||||
|
logFilePath = Path.Combine(Path.GetTempPath(), "welsonjs_service.log");
|
||||||
|
|
||||||
// mapping arguments to each variables
|
// mapping arguments to each variables
|
||||||
var arguments = ParseArguments(this.args);
|
var arguments = ParseArguments(this.args);
|
||||||
foreach (KeyValuePair<string, string> entry in arguments)
|
foreach (KeyValuePair<string, string> entry in arguments)
|
||||||
|
@ -211,8 +214,6 @@ namespace WelsonJS.Service
|
||||||
Log("Disabled the User Interactive Mode. (e.g., OnScreenTime)");
|
Log("Disabled the User Interactive Mode. (e.g., OnScreenTime)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the log file path
|
|
||||||
logFilePath = Path.Combine(Path.GetTempPath(), "WelsonJS.Service.Log.txt");
|
|
||||||
Log(appName + " Service Loaded");
|
Log(appName + " Service Loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +504,7 @@ namespace WelsonJS.Service
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Failed to write log: {ex.Message}");
|
Console.WriteLine($"LOGGING FAILED: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user