Weighing: Add option to opt-out of automatic datetime sync at startup
This commit is contained in:
@@ -17,10 +17,11 @@ namespace Elwig.Helpers {
|
||||
public string? Filling;
|
||||
public string? Limit;
|
||||
public bool Required;
|
||||
public bool SyncTime;
|
||||
public string? Log;
|
||||
public string? _Log;
|
||||
|
||||
public ScaleConfig(string id, string? type, string? model, string? cnx, string? empty, string? filling, string? limit, bool? required, string? log) {
|
||||
public ScaleConfig(string id, string? type, string? model, string? cnx, string? empty, string? filling, string? limit, bool? required, bool? syncTime, string? log) {
|
||||
Id = id;
|
||||
Type = type;
|
||||
Model = model;
|
||||
@@ -29,6 +30,7 @@ namespace Elwig.Helpers {
|
||||
Filling = filling;
|
||||
Limit = limit;
|
||||
Required = required ?? true;
|
||||
SyncTime = syncTime ?? true;
|
||||
_Log = log;
|
||||
Log = log != null ? Path.Combine(App.DataPath, log) : null;
|
||||
}
|
||||
@@ -37,11 +39,12 @@ namespace Elwig.Helpers {
|
||||
public class Config {
|
||||
|
||||
private static readonly string[] TrueValues = ["1", "true", "yes", "on"];
|
||||
private static readonly string[] FalseValues = ["0", "false", "no", "off"];
|
||||
|
||||
private readonly string FileName;
|
||||
|
||||
public bool Debug;
|
||||
public string DatabaseFile = App.DataPath + "database.sqlite3";
|
||||
public string DatabaseFile = Path.Combine(App.DataPath, "database.sqlite3");
|
||||
public string? DatabaseLog = null;
|
||||
public string? Branch = null;
|
||||
public WeighingMode? WeighingMode;
|
||||
@@ -105,6 +108,7 @@ namespace Elwig.Helpers {
|
||||
s, config[$"scale.{s}:type"], config[$"scale.{s}:model"], config[$"scale.{s}:connection"],
|
||||
config[$"scale.{s}:empty"], config[$"scale.{s}:filling"], config[$"scale.{s}:limit"],
|
||||
config[$"scale.{s}:required"] != null ? TrueValues.Contains(config[$"scale.{s}:required"]?.ToLower()) : null,
|
||||
config[$"scale.{s}:synctime"] != null ? !FalseValues.Contains(config[$"scale.{s}:synctime"]?.ToLower()) : null,
|
||||
config[$"scale.{s}:log"]
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user