mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 16:35:13 +00:00
Update the screen time feature
This commit is contained in:
parent
7b62e47fd2
commit
66d4926bba
|
@ -56,8 +56,9 @@ public class ScreenMatching
|
|||
private List<Bitmap> templateImages;
|
||||
private string templateDirectoryPath;
|
||||
private int templateCurrentIndex = 0;
|
||||
private double threshold = 0.5;
|
||||
private string mode = "screen";
|
||||
private double threshold = 0.4;
|
||||
private string mode;
|
||||
private string[] _params;
|
||||
|
||||
public ScreenMatching(ServiceBase parent, string workingDirectory)
|
||||
{
|
||||
|
@ -65,13 +66,46 @@ public class ScreenMatching
|
|||
templateDirectoryPath = Path.Combine(workingDirectory, "app/assets/img/_templates");
|
||||
templateImages = new List<Bitmap>();
|
||||
|
||||
SetMode("screen");
|
||||
// Read values from configration file
|
||||
string mode;
|
||||
string _params;
|
||||
try
|
||||
{
|
||||
mode = this.parent.GetSettingsFileHandler().Read("SCREEN_TIME_MODE", "Service");
|
||||
_params = this.parent.GetSettingsFileHandler().Read("SCREEN_TIME_PARAMS", "Service");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.parent.Log($"Failed to read from configration file: {ex.Message}");
|
||||
}
|
||||
|
||||
SetMode(mode);
|
||||
SetParams(_params);
|
||||
LoadTemplateImages();
|
||||
}
|
||||
|
||||
public void SetMode(string mode)
|
||||
{
|
||||
this.mode = mode;
|
||||
if (!String.IsNullOrEmpty(mode))
|
||||
{
|
||||
this.mode = mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mode = "screen";
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParams(string[] _params)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(mode))
|
||||
{
|
||||
this._params = _params;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._params = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetThreshold(double threshold)
|
||||
|
|
|
@ -8,7 +8,7 @@ NONFREE_STRICT=false ;User consent may be required when using third-party soft
|
|||
DISABLE_SCREEN_TIME=false
|
||||
DISABLE_FILE_MONITOR=false
|
||||
SCREEN_TIME_MODE=screen ;screen or window
|
||||
SCREEN_TIME_PARAMS=
|
||||
SCREEN_TIME_PARAMS= ;filename.exe
|
||||
GRPC_HOST=http://localhost:50051
|
||||
ES_HOST=http://localhost:9200
|
||||
ES_USER=elastic
|
||||
|
|
Loading…
Reference in New Issue
Block a user