added IsOneTimeOpaque functionality, on end will be stored configuraion.json

This commit is contained in:
Michal Buzik 2024-10-17 22:03:07 +02:00
parent 1b7fdc4a53
commit cdfa50e1ec
4 changed files with 27 additions and 15 deletions

View File

@ -1,4 +1,5 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using tbfDBBackup.configuration;
namespace tbfDBBackup;
@ -9,11 +10,19 @@ public class Configuration
public const string FileName = "configuration.json";
public string? PathToDumpMysql { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Boolean? WaitOnEndCmdOpen { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Boolean? PrintConfigurationEnabled { get; set; }
public List<DbConnection>? DbConnectionStrings { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Update>? UpdateString { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Backup>? BackupDB { get; set; }

View File

@ -203,7 +203,7 @@ void BackupDatabase(BackupCombination backupCombination)
//Deactivate if only one time possible run
if ((backupCombination.Path.IsOneTimeOpaque ?? false) && (backupCombination.Path.Enabled??false))
if ((backupCombination.Path.IsOneTimeOpaque ?? false) && (backupCombination.Path.Enabled??true))
{
backupCombination.Path.Enabled = false;
}

View File

@ -4,16 +4,16 @@
"PrintConfigurationEnabled": false,
"DbConnectionStrings": [
{
"Enabled": false,
"Name": "Settings DB",
"Connection": "SERVER=localhost; DATABASE={DatabaseName}; UID=root; PASSWORD=; CHARSET=utf8;",
"DatabaseName": "wrcswindon298"
"DatabaseName": "wrcswindon298",
"Enabled": false
},
{
"Enabled": true,
"Name": "Results DB",
"Connection": "SERVER=localhost; DATABASE={DatabaseName}; UID=root; PASSWORD=; CHARSET=utf8;",
"DatabaseName": "wrcswindon298-r"
"DatabaseName": "wrcswindon298-r",
"Enabled": true
}
],
"UpdateString": [
@ -26,30 +26,29 @@
],
"BackupDB": [
{
"Enabled": true,
"DbConnectionStringsName": "Results DB",
"StoreDirPaths": [
{
"Path": "C:\\TBF\\"
"Path": "C:\\TBF\\",
"IsOneTimeOpaque": true
},
{
"Path": "C:\\TBF\\storeString",
"Enable": false
"Path": "C:\\TBF\\storeString"
}
]
],
"Enabled": true
},
{
"Enabled": false,
"DbConnectionStringsName": "Settings DB",
"StoreDirPaths": [
{
"Path": "C:\\TBF\\"
},
{
"Path": "C:\\TBF\\storeString",
"Enable": true
"Path": "C:\\TBF\\storeString"
}
]
],
"Enabled": false
}
]
}

View File

@ -1,7 +1,11 @@
namespace tbfDBBackup.configuration;
using System.Text.Json.Serialization;
namespace tbfDBBackup.configuration;
public class StandardBehaviour
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Boolean? Enabled { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Boolean? IsOneTimeOpaque { get; set; }
}