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

@ -87,6 +87,37 @@ public class Worker : BackgroundService
}
}
private void LogOptions()
{
_Logger.LogInformation("A) Save (Top Directory Only),");
_Logger.LogInformation("B) Save (All Directories),");
_Logger.LogInformation("C) Clipboard (Top Directory Only),");
_Logger.LogInformation("D) Clipboard (All Directories),");
_Logger.LogInformation("E) Everything delete recursive,");
_Logger.LogInformation("F) Find and delete all *.log.* files then empty directories,");
_Logger.LogInformation("G) Genealogical Data Communication,");
// H
_Logger.LogInformation("I) Ignore case and rename files to lowercase,");
_Logger.LogInformation("J) Set Date from Json Entry,");
_Logger.LogInformation("K) Kanban support,");
_Logger.LogInformation("L) Log Merge (APC Log [0-9(8)]_*.log),");
_Logger.LogInformation("M) Markdown Wiki Link Verification,");
_Logger.LogInformation("N) Create Note Files,");
_Logger.LogInformation("O) Oracle tnsNames.ora,");
_Logger.LogInformation("P) PDF parse,");
// Q
_Logger.LogInformation("R) Rename to old, copy, delete old,");
_Logger.LogInformation("S) Set Date from Zip Entry,");
_Logger.LogInformation("T) *Ticks ~~Too long rename~~,");
// U
// V
// W
_Logger.LogInformation("X) Day Helpers,");
_Logger.LogInformation("Y) Zip file(s) by directory with file,");
_Logger.LogInformation("Z) Zip file(s) by date,");
_Logger.LogInformation("Delete) Delete empty directories,");
}
protected override async Task ExecuteAsync(CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
@ -109,48 +140,24 @@ public class Worker : BackgroundService
consoleKey = ConsoleKey.End;
if (singleCharIndex is not null)
_Args.RemoveAt(singleCharIndex.Value);
_Logger.LogInformation(consoleKey.ToString());
if (_Args.Count == 0)
{
_Logger.LogWarning("Must pass a argument!");
CreateWindowsShortcut();
}
else if (Directory.Exists(_Args[0]) && File.Exists(Path.Combine(_Args[0], string.Concat(Path.GetFileName(_Args[0]), ".dll"))))
Helpers.HelperILMerge.ILMerge(_Args[0]);
else if (Directory.Exists(_Args[0]))
{
for (int i = 0; i < int.MaxValue; i++)
if (!_ConsoleKeys.Contains(consoleKey))
{
if (_ConsoleKeys.Contains(consoleKey))
break;
_Logger.LogInformation("A) Save (Top Directory Only),");
_Logger.LogInformation("B) Save (All Directories),");
_Logger.LogInformation("C) Clipboard (Top Directory Only),");
_Logger.LogInformation("D) Clipboard (All Directories),");
_Logger.LogInformation("E) Everything delete recursive,");
_Logger.LogInformation("F) Find and delete all *.log.* files then empty directories,");
_Logger.LogInformation("G) Genealogical Data Communication,");
// H
_Logger.LogInformation("I) Ignore case and rename files to lowercase,");
_Logger.LogInformation("J) Set Date from Json Entry,");
_Logger.LogInformation("K) Kanban support,");
_Logger.LogInformation("L) Log Merge (APC Log [0-9(8)]_*.log),");
_Logger.LogInformation("M) Markdown Wiki Link Verification,");
_Logger.LogInformation("N) Create Note Files,");
_Logger.LogInformation("O) Oracle tnsNames.ora,");
_Logger.LogInformation("P) PDF parse,");
// Q
_Logger.LogInformation("R) Rename to old, copy, delete old,");
_Logger.LogInformation("S) Set Date from Zip Entry,");
_Logger.LogInformation("T) *Ticks ~~Too long rename~~,");
// U
// V
// W
_Logger.LogInformation("X) Day Helpers,");
_Logger.LogInformation("Y) Zip file(s) by directory with file,");
_Logger.LogInformation("Z) Zip file(s) by date,");
_Logger.LogInformation("Delete) Delete empty directories,");
consoleKey = Console.ReadKey().Key;
_Logger.LogInformation(" ");
for (int i = 0; i < int.MaxValue; i++)
{
if (_ConsoleKeys.Contains(consoleKey))
break;
LogOptions();
consoleKey = Console.ReadKey().Key;
_Logger.LogInformation(" ");
}
}
switch (consoleKey)
{
@ -230,7 +237,7 @@ public class Worker : BackgroundService
throw new Exception(_Args[0]);
}
catch (Exception ex)
{ _Logger.LogError("{Message}{NewLine}{StackTrace}", ex.Message, Environment.NewLine, ex.StackTrace); }
{ _Logger.LogError("{Message}{NewLine}{_Args}{NewLine}{StackTrace}", ex.Message, Environment.NewLine, string.Join(' ', _Args), Environment.NewLine, ex.StackTrace); }
if (_IsSilent)
_Logger.LogInformation("Done. Bye");
else