YamlDotNet sort yaml

Helper20240623 Sorted
Improved log
Force root directory modified date when updating file
Switched to bash over link
MoveUpOneDirectory
Only write if needed
UpdateSubTasksInMarkdownFiles
This commit is contained in:
2024-07-10 12:08:41 -07:00
parent 47e6b85c21
commit 1cd20fa08b
8 changed files with 375 additions and 164 deletions

View File

@ -133,7 +133,7 @@ internal static partial class Helper20240106
return results;
}
private static ReadOnlyCollection<string> GetIpAddressAndVerify(ILogger<Worker> logger, string key, Dictionary<string, Dictionary<string, string>> keyValuePairs, Dictionary<int, Host> hosts)
private static ReadOnlyCollection<string> GetIpAddressAndVerify(ILogger<Worker> logger, string key, Dictionary<string, Dictionary<string, string>> keyValuePairs, Dictionary<int, Host> hosts, string filter)
{
List<string> results = [];
int id;
@ -145,6 +145,8 @@ internal static partial class Helper20240106
foreach (KeyValuePair<string, Dictionary<string, string>> keyValuePair in keyValuePairs)
{
found = false;
if (keyValuePair.Key.StartsWith(filter))
continue;
if (!keyValuePair.Value.TryGetValue(key, out ipAddress))
throw new NotSupportedException($"{key} isn't present!");
if (ipAddress == "0.0.0.0")
@ -208,6 +210,7 @@ internal static partial class Helper20240106
int? headerLine;
FileInfo fileInfo;
string key = args[7];
string filter = args[10];
string replace = args[5];
int keyIndex = int.Parse(args[3]);
int keyLength = int.Parse(args[4]);
@ -234,7 +237,7 @@ internal static partial class Helper20240106
keyValuePairs = GetKeyValuePairs(keyIndex, keyLength, replace, headers, lines, headerLine.Value);
if (keyValuePairs.Count == 0)
continue;
ipAddress = GetIpAddressAndVerify(logger, key, keyValuePairs, hosts);
ipAddress = GetIpAddressAndVerify(logger, key, keyValuePairs, hosts, filter);
if (ipAddress.Count == 0)
continue;
json = JsonSerializer.Serialize(keyValuePairs, DictionaryDictionarySourceGenerationContext.Default.DictionaryStringDictionaryStringString);