diff --git a/WelsonJS.Toolkit/WelsonJS.Service/ServiceMain.cs b/WelsonJS.Toolkit/WelsonJS.Service/ServiceMain.cs index 48897d8..3b9a7a1 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/ServiceMain.cs +++ b/WelsonJS.Toolkit/WelsonJS.Service/ServiceMain.cs @@ -31,6 +31,7 @@ using System.Runtime.InteropServices; using MSScriptControl; using System.IO; using System.Collections.Generic; +using System.Text; namespace WelsonJS.Service { @@ -44,7 +45,7 @@ namespace WelsonJS.Service private ScriptControl scriptControl; private readonly string logFilePath = Path.Combine(Path.GetTempPath(), "WelsonJS.Service.Log.txt"); private readonly string appName = "WelsonJS"; - private string[] _args; + private string[] args; private bool disabledScreenTime = false; private bool disabledFileMonitor = false; private ScreenMatching screenMatcher; @@ -52,17 +53,25 @@ namespace WelsonJS.Service [DllImport("user32.dll")] public static extern int GetSystemMetrics(int nIndex); - public static int SM_REMOTESESSION = 0x1000; + + [DllImport("kernel32.dll")] + private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); + + [DllImport("kernel32.dll")] + private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); + + + private static int SM_REMOTESESSION = 0x1000; public ServiceMain(string[] args) { InitializeComponent(); // set service arguments - _args = args; + this.args = args; // mapping arguments to each variables - var arguments = ParseArguments(_args); + var arguments = ParseArguments(this.args); foreach (KeyValuePair entry in arguments) { switch (entry.Key) diff --git a/settings.ini b/settings.ini new file mode 100644 index 0000000..76e5242 --- /dev/null +++ b/settings.ini @@ -0,0 +1,11 @@ +[Default] +JSCRIPT_ENV=development ;development or production +CHATGPT_APIKEY=file:data/chatgpt-apikey.txt +NONFREE_STRICT=false ;User consent may be required when using third-party software with an EULA license. + +[Service] +DISABLE_SCREEN_TIME=false +DISABLE_FILE_MONITOR=false +ES_HOST=http://localhost:9200 +ES_USER=elastic +ES_PASSWORD=changeme \ No newline at end of file