only write config file when contents have changed (memo)
This commit is contained in:
parent
b5436e64aa
commit
851b936217
|
@ -38,7 +38,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
public required DeviceConfig Devices { get; set; }
|
public required DeviceConfig Devices { get; set; }
|
||||||
public required S3Config? S3 { get; set; }
|
public required S3Config? S3 { get; set; }
|
||||||
|
|
||||||
|
private static String? LastSavedData { get; set; }
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static Config Default => new()
|
public static Config Default => new()
|
||||||
|
@ -121,6 +121,12 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var jsonString = Serialize(this, JsonOptions);
|
var jsonString = Serialize(this, JsonOptions);
|
||||||
|
|
||||||
|
if (LastSavedData == jsonString)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LastSavedData = jsonString;
|
||||||
|
|
||||||
File.WriteAllText(configFilePath, jsonString);
|
File.WriteAllText(configFilePath, jsonString);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Reference in New Issue