Update ScreenMatch.cs, settings.example.ini

This commit is contained in:
Namhyeon Go 2024-09-06 17:03:11 +09:00
parent a69603a10c
commit 6f3153a816
2 changed files with 74 additions and 54 deletions

View File

@ -157,69 +157,89 @@ public class ScreenMatch
parts => parts.Length > 1 ? parts[1] : parts[0]
);
foreach (var config in screen_time_configs)
var config_keys = new string[]
{
switch (config.Key)
"process_name",
"sample_width",
"sample_height",
"sample_adjust_x",
"sample_adjust_y",
"sample_only",
"backward",
"save",
"sample_clipboard",
"sample_ocr"
};
foreach (var config_key in config_keys)
{
string config_value;
screen_time_configs.TryGetValue(config_key, out config_value);
if (config_value != null)
{
case "backward":
{
isSearchFromEnd = true;
this.parent.Log("Use the backward search when screen time");
break;
}
switch (config_key)
{
case "backward":
{
isSearchFromEnd = true;
this.parent.Log("Use the backward search when screen time");
break;
}
case "save":
{
isSaveToFile = true;
this.parent.Log("Will be save an image file when capture the screens");
break;
}
case "save":
{
isSaveToFile = true;
this.parent.Log("Will be save an image file when capture the screens");
break;
}
case "sample_clipboard":
{
isUseSampleClipboard = true;
this.parent.Log("Use Clipboard within a 128x128 pixel range around specific coordinates.");
break;
}
case "sample_clipboard":
{
isUseSampleClipboard = true;
this.parent.Log($"Use Clipboard within a 128x128 pixel range around specific coordinates.");
break;
}
case "sample_ocr":
{
tesseractDataPath = Path.Combine(workingDirectory, "app/assets/tessdata_best");
tesseractLanguage = "eng";
isUseSampleOCR = true;
this.parent.Log("Use OCR within a 128x128 pixel range around specific coordinates.");
break;
}
case "sample_ocr":
{
tesseractDataPath = Path.Combine(workingDirectory, "app/assets/tessdata_best");
tesseractLanguage = "eng";
isUseSampleOCR = true;
this.parent.Log($"Use OCR within a 128x128 pixel range around specific coordinates.");
break;
}
case "sample_width":
{
int.TryParse(config.Value, out sampleWidth);
break;
}
case "sample_width":
{
int.TryParse(config_value, out sampleWidth);
break;
}
case "sample_height":
{
int.TryParse(config.Value, out sampleHeight);
break;
}
case "sample_height":
{
int.TryParse(config_value, out sampleHeight);
break;
}
case "sample_adjust_x":
{
int.TryParse(config.Value, out sampleAdjustX);
break;
}
case "sample_adjust_x":
{
int.TryParse(config_value, out sampleAdjustX);
break;
}
case "sample_adjust_y":
{
int.TryParse(config.Value, out sampleAdjustY);
break;
}
case "sample_adjust_y":
{
int.TryParse(config_value, out sampleAdjustY);
break;
}
case "sample_only":
{
sampleOnly = config.Value;
break;
}
case "sample_only":
{
sampleOnly = config_value;
break;
}
}
}
}
}

View File

@ -13,7 +13,7 @@ DISABLE_SCREEN_TIME=true
DISABLE_FILE_MONITOR=true
; screen or window
SCREEN_TIME_MODE=screen
;filename.exe,backward,save,sample_ocr,sample_clipboard,sample_width=128,sample_height=128,sample_adjust_x=0,sample_adjust_y=0,sample_only=
;backward,save,sample_ocr,sample_clipboard,sample_width=128,sample_height=128,sample_adjust_x=0,sample_adjust_y=0,sample_only=,process_name=notepad.exe
SCREEN_TIME_PARAMS=
GRPC_HOST=http://localhost:50051
ES_HOST=http://localhost:9200