mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Read the initial configurations from settings.ini
This commit is contained in:
parent
659fb12db1
commit
222fe3c1a0
|
@ -129,6 +129,47 @@ namespace WelsonJS.Service
|
|||
Log($"Configuration file not found: {settingsFilePath}");
|
||||
}
|
||||
|
||||
// read configrations from settings.ini
|
||||
if (settingsFileHandler != null)
|
||||
{
|
||||
string[] configNames = new string[]
|
||||
{
|
||||
"DISABLE_SCREEN_TIME",
|
||||
"DISABLE_FILE_MONITOR",
|
||||
"DISABLE_MESSAGE_RECEIVER"
|
||||
};
|
||||
foreach (string configName in configNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ("true" == GetSettingsFileHandler().Read(configName, "Service"))
|
||||
{
|
||||
switch (configName)
|
||||
{
|
||||
case "DISABLE_SCREEN_TIME":
|
||||
disabledScreenTime = true;
|
||||
break;
|
||||
|
||||
case "DISABLE_FILE_MONITOR":
|
||||
disabledFileMonitor = true;
|
||||
break;
|
||||
|
||||
case "DISABLE_MESSAGE_RECEIVER":
|
||||
disabledMessageReceiver = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"{configName} is ignored: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set script name
|
||||
if (string.IsNullOrEmpty(scriptName))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user