mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 08:55:14 +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 List<Bitmap> templateImages;
|
||||||
private string templateDirectoryPath;
|
private string templateDirectoryPath;
|
||||||
private int templateCurrentIndex = 0;
|
private int templateCurrentIndex = 0;
|
||||||
private double threshold = 0.5;
|
private double threshold = 0.4;
|
||||||
private string mode = "screen";
|
private string mode;
|
||||||
|
private string[] _params;
|
||||||
|
|
||||||
public ScreenMatching(ServiceBase parent, string workingDirectory)
|
public ScreenMatching(ServiceBase parent, string workingDirectory)
|
||||||
{
|
{
|
||||||
|
@ -65,14 +66,47 @@ public class ScreenMatching
|
||||||
templateDirectoryPath = Path.Combine(workingDirectory, "app/assets/img/_templates");
|
templateDirectoryPath = Path.Combine(workingDirectory, "app/assets/img/_templates");
|
||||||
templateImages = new List<Bitmap>();
|
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();
|
LoadTemplateImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMode(string mode)
|
public void SetMode(string mode)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(mode))
|
||||||
{
|
{
|
||||||
this.mode = 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)
|
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_SCREEN_TIME=false
|
||||||
DISABLE_FILE_MONITOR=false
|
DISABLE_FILE_MONITOR=false
|
||||||
SCREEN_TIME_MODE=screen ;screen or window
|
SCREEN_TIME_MODE=screen ;screen or window
|
||||||
SCREEN_TIME_PARAMS=
|
SCREEN_TIME_PARAMS= ;filename.exe
|
||||||
GRPC_HOST=http://localhost:50051
|
GRPC_HOST=http://localhost:50051
|
||||||
ES_HOST=http://localhost:9200
|
ES_HOST=http://localhost:9200
|
||||||
ES_USER=elastic
|
ES_USER=elastic
|
||||||
|
|
Loading…
Reference in New Issue
Block a user