nuget bump
2023-11-02 2023-11-08 net8.0 editorconfig NuGet NuSpec Kanban
This commit is contained in:
parent
948937d8a5
commit
5fe51ef645
@ -1,3 +1,19 @@
|
|||||||
|
[*.md]
|
||||||
|
end_of_line = crlf
|
||||||
|
file_header_template = unset
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
root = true
|
||||||
|
tab_width = 2
|
||||||
|
[*.csproj]
|
||||||
|
end_of_line = crlf
|
||||||
|
file_header_template = unset
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
root = true
|
||||||
|
tab_width = 2
|
||||||
[*.cs]
|
[*.cs]
|
||||||
csharp_indent_block_contents = true
|
csharp_indent_block_contents = true
|
||||||
csharp_indent_braces = false
|
csharp_indent_braces = false
|
||||||
@ -13,6 +29,7 @@ csharp_new_line_before_members_in_object_initializers = true
|
|||||||
csharp_new_line_before_open_brace = all
|
csharp_new_line_before_open_brace = all
|
||||||
csharp_new_line_between_query_expression_clauses = true
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
csharp_prefer_braces = false
|
csharp_prefer_braces = false
|
||||||
|
csharp_prefer_qualified_reference = true:error
|
||||||
csharp_prefer_simple_default_expression = true:warning
|
csharp_prefer_simple_default_expression = true:warning
|
||||||
csharp_prefer_simple_using_statement = true:warning
|
csharp_prefer_simple_using_statement = true:warning
|
||||||
csharp_prefer_static_local_function = true:warning
|
csharp_prefer_static_local_function = true:warning
|
||||||
@ -79,11 +96,22 @@ dotnet_code_quality.CAXXXX.api_surface = private, internal
|
|||||||
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
|
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
|
||||||
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
||||||
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||||
|
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
|
||||||
|
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
|
||||||
|
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
|
||||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
|
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||||
|
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
|
||||||
|
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||||
|
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||||
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||||
|
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
||||||
|
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
|
||||||
|
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
|
||||||
|
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||||
@ -215,7 +243,7 @@ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
|||||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||||
dotnet_style_predefined_type_for_member_access = true
|
dotnet_style_predefined_type_for_member_access = true:warning
|
||||||
dotnet_style_prefer_auto_properties = true:warning
|
dotnet_style_prefer_auto_properties = true:warning
|
||||||
dotnet_style_prefer_compound_assignment = true:warning
|
dotnet_style_prefer_compound_assignment = true:warning
|
||||||
dotnet_style_prefer_conditional_expression_over_assignment = false
|
dotnet_style_prefer_conditional_expression_over_assignment = false
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -330,4 +330,4 @@ ASALocalRun/
|
|||||||
|
|
||||||
.vscode/Helper/**
|
.vscode/Helper/**
|
||||||
|
|
||||||
.kanbn/board*
|
.kanbn
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -9,7 +9,7 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
"program": "${workspaceFolder}/bin/Debug/net7.0/win-x64/File-Folder-Helper.dll",
|
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s",
|
"s",
|
||||||
"\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\Traces\\HTR-PLC\\R72-PLC\\PollPath"
|
"\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\Traces\\HTR-PLC\\R72-PLC\\PollPath"
|
||||||
|
15
.vscode/mklink.md
vendored
Normal file
15
.vscode/mklink.md
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
type: "note"
|
||||||
|
created: "2023-10-20T03:53:13.742Z"
|
||||||
|
updated: "2023-10-20T04:00:37.259Z"
|
||||||
|
---
|
||||||
|
|
||||||
|
# mklink
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.kanbn" "D:\Documents\Kanban\File-Folder-Helper"
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.kanbn" "D:\5-Other-Small\Kanban\File-Folder-Helper"
|
||||||
|
```
|
30
.vscode/tasks.json
vendored
30
.vscode/tasks.json
vendored
@ -100,91 +100,91 @@
|
|||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H Run Data Repository",
|
"label": "File-Folder-Helper AOT s H Run Data Repository",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s J Verdaccio",
|
"label": "File-Folder-Helper AOT s J Verdaccio",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s J 'L:/Verdaccio/storage'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s J 'L:/Verdaccio/storage'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s M Self .Kanbn Tasks",
|
"label": "File-Folder-Helper AOT s M Self .Kanbn Tasks",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s S BaGet",
|
"label": "File-Folder-Helper AOT s S BaGet",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s S 'L:/BaGet/packages'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s S 'L:/BaGet/packages'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s V Helpers",
|
"label": "File-Folder-Helper AOT s V Helpers",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s V Helpers",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s V Helpers",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08ANLYSDIFAAST230",
|
"label": "File-Folder-Helper AOT s H MET08ANLYSDIFAAST230",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08ANLYSDIFAAST230\\Source\\MET08ANLYSDIFAAST230'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08ANLYSDIFAAST230\\Source\\MET08ANLYSDIFAAST230'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08DDUPSFS6420",
|
"label": "File-Folder-Helper AOT s H MET08DDUPSFS6420",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08DDUPSFS6420\\Source\\MET08DDUPSFS6420'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSFS6420\\Source\\MET08DDUPSFS6420'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08DDUPSP1TBI",
|
"label": "File-Folder-Helper AOT s H MET08DDUPSP1TBI",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08DDUPSP1TBI\\Source\\MET08DDUPSP1TBI'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSP1TBI\\Source\\MET08DDUPSP1TBI'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08RESIHGCV",
|
"label": "File-Folder-Helper AOT s H MET08RESIHGCV",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08RESIHGCV\\Source\\MET08RESIHGCV'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIHGCV\\Source\\MET08RESIHGCV'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08RESIMAPCDE",
|
"label": "File-Folder-Helper AOT s H MET08RESIMAPCDE",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08RESIMAPCDE\\Source\\MET08RESIMAPCDE'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIMAPCDE\\Source\\MET08RESIMAPCDE'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08RESISRP2100",
|
"label": "File-Folder-Helper AOT s H MET08RESISRP2100",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08RESISRP2100\\Source\\MET08RESISRP2100'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESISRP2100\\Source\\MET08RESISRP2100'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08THFTIRQS408M",
|
"label": "File-Folder-Helper AOT s H MET08THFTIRQS408M",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08THFTIRQS408M\\Source\\MET08THFTIRQS408M'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRQS408M\\Source\\MET08THFTIRQS408M'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H MET08THFTIRSTRATUS",
|
"label": "File-Folder-Helper AOT s H MET08THFTIRSTRATUS",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\Metrology\\Run Data Repository\\MET08THFTIRSTRATUS\\Source\\MET08THFTIRSTRATUS'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRSTRATUS\\Source\\MET08THFTIRSTRATUS'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s H WaferCounter",
|
"label": "File-Folder-Helper AOT s H WaferCounter",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.ec.local\\apps\\WaferCounter\\BackupFiles'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\WaferCounter\\BackupFiles'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "File-Folder-Helper AOT s F Staging _Logs",
|
"label": "File-Folder-Helper AOT s F Staging _Logs",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s F '\\\\messv02ecc1.ec.local\\EC_EAFLog\\Staging\\_ Logs'",
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s F '\\\\messv02ecc1.ec.local\\EC_EAFLog\\Staging\\_ Logs'",
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
125
Day/Helper-2023-10-24.cs
Normal file
125
Day/Helper-2023-10-24.cs
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace File_Folder_Helper.Day;
|
||||||
|
|
||||||
|
internal record Drive(string Share,
|
||||||
|
bool Use,
|
||||||
|
string User);
|
||||||
|
|
||||||
|
internal static class Helper20231024
|
||||||
|
{
|
||||||
|
|
||||||
|
internal static void NetUse(ILogger<Worker> logger, string argsZero)
|
||||||
|
{
|
||||||
|
Process? process;
|
||||||
|
string arguments;
|
||||||
|
string[] segments;
|
||||||
|
string standardError;
|
||||||
|
string standardOutput;
|
||||||
|
string fileName = "net";
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
string json = File.ReadAllText(Path.Combine(argsZero, ".json"));
|
||||||
|
string decrypted = File.ReadAllText(Path.Combine(argsZero, ".password"));
|
||||||
|
List<Drive> drives = JsonSerializer.Deserialize(json, DrivesSourceGenerationContext.Default.ListDrive) ?? throw new NullReferenceException();
|
||||||
|
foreach (Drive drive in drives)
|
||||||
|
{
|
||||||
|
if (!drive.Use)
|
||||||
|
continue;
|
||||||
|
arguments = $"use * \"{drive.Share}\" /p:yes /user:{drive.User} {decrypted}";
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
segments = arguments.Split(' ');
|
||||||
|
for (int j = 0; j < segments.Length - 1; j++)
|
||||||
|
_ = stringBuilder.Append(segments[j]).Append(' ');
|
||||||
|
logger.LogInformation("// {stringBuilder}", stringBuilder);
|
||||||
|
ProcessStartInfo processStartInfo = new(fileName, arguments)
|
||||||
|
{
|
||||||
|
RedirectStandardError = true,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
UseShellExecute = false
|
||||||
|
};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
process = Process.Start(processStartInfo);
|
||||||
|
if (process is null)
|
||||||
|
continue;
|
||||||
|
for (int j = 1; j < 45; j++)
|
||||||
|
{
|
||||||
|
_ = process.WaitForExit(1000);
|
||||||
|
if (process.HasExited)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!process.HasExited)
|
||||||
|
logger.LogError("// Never exited!");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
standardError = process.StandardError.ReadToEnd();
|
||||||
|
standardOutput = process.StandardOutput.ReadToEnd();
|
||||||
|
logger.LogInformation("// {standardError}{Environment.NewLine}{Environment.NewLine}// {standardOutput}", standardError, Environment.NewLine, Environment.NewLine, standardOutput);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_ = Directory.CreateDirectory($"{drive.Share}\\Tmp\\Phares");
|
||||||
|
string reg = """
|
||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\SPCEPIWORLD]
|
||||||
|
"Driver"="C:\\WINDOWS\\system32\\SQLSRV32.dll"
|
||||||
|
"Description"="InfinityQS SPC (Si)"
|
||||||
|
"Server"="messqlec1.infineon.com\\PROD1,53959"
|
||||||
|
"Database"="SPCEPIWORLD"
|
||||||
|
"LastUser"=""
|
||||||
|
"Trusted_Connection"="Yes"
|
||||||
|
|
||||||
|
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources]
|
||||||
|
"SPCEPIWORLD"="SQL Server"
|
||||||
|
""";
|
||||||
|
string bat = """
|
||||||
|
@ECHO OFF
|
||||||
|
NET USE G: /delete
|
||||||
|
NET USE H: /delete
|
||||||
|
NET USE M: /delete
|
||||||
|
NET USE P: /delete
|
||||||
|
NET USE R: /delete
|
||||||
|
NET USE T: /delete
|
||||||
|
NET USE V: /delete
|
||||||
|
NET USE Y: /delete
|
||||||
|
NET USE G: \\mesfs.infineon.com\EC_Engineering /PERSISTENT:YES
|
||||||
|
NET USE H: \\mesfs.infineon.com\EC_TempHumidity_Controls /PERSISTENT:YES
|
||||||
|
NET USE M: \\mesfs.infineon.com\EC_Maintenance /PERSISTENT:YES
|
||||||
|
NET USE P: \\mesfs.infineon.com\EC_Production /PERSISTENT:YES
|
||||||
|
NET USE R: \\mesfs.infineon.com\EC_Customer_Service /PERSISTENT:YES
|
||||||
|
NET USE T: \\mesfs.infineon.com\EC_Materials /PERSISTENT:YES
|
||||||
|
NET USE V: \\mesfs.infineon.com\EC_Engineering /PERSISTENT:YES
|
||||||
|
NET USE Y: \\mesfs.infineon.com\EC_EpiReactorRecipes /PERSISTENT:YES
|
||||||
|
""";
|
||||||
|
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\SPCEPIWORLD_hklm.reg", reg);
|
||||||
|
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\MESA-Users-Drives.bat", bat);
|
||||||
|
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\lnk.txt", """"\\messa04ec.infineon.com\EC_SPC_Si\SPC\Projects\Active\ir epi services database.ipj"""");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "Error:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(Drive))]
|
||||||
|
internal partial class DriveSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(List<Drive>))]
|
||||||
|
internal partial class DrivesSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
35
Day/Helper-2023-11-02.cs
Normal file
35
Day/Helper-2023-11-02.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace File_Folder_Helper.Day;
|
||||||
|
|
||||||
|
internal static class Helper20231102
|
||||||
|
{
|
||||||
|
|
||||||
|
internal static void NuSpec(ILogger<Worker> logger, string argsZero)
|
||||||
|
{
|
||||||
|
string[] lines;
|
||||||
|
string? idLine;
|
||||||
|
string? versionLine;
|
||||||
|
string[] files = Directory.GetFiles(argsZero);
|
||||||
|
logger.LogInformation("{fileCount}", files.Length.ToString());
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
idLine = null;
|
||||||
|
versionLine = null;
|
||||||
|
lines = File.ReadAllLines(file);
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
if (!line.EndsWith("</id>") && !line.EndsWith("</version>"))
|
||||||
|
continue;
|
||||||
|
if (line.EndsWith("</id>"))
|
||||||
|
idLine = line.TrimEnd();
|
||||||
|
if (line.EndsWith("</version>"))
|
||||||
|
versionLine = line.TrimEnd();
|
||||||
|
if (idLine is not null && versionLine is not null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
File.AppendAllText(".txt", $"{idLine}{versionLine}{Environment.NewLine}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
Day/Helper-2023-11-08.cs
Normal file
37
Day/Helper-2023-11-08.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace File_Folder_Helper.Day;
|
||||||
|
|
||||||
|
internal static class Helper20231108
|
||||||
|
{
|
||||||
|
|
||||||
|
internal static void MasterImage(ILogger<Worker> logger, List<string> args)
|
||||||
|
{
|
||||||
|
string fileName;
|
||||||
|
string checkFile;
|
||||||
|
string[] aSegments;
|
||||||
|
string[] bSegments;
|
||||||
|
if (!Directory.Exists(args[0]))
|
||||||
|
throw new Exception(args[0]);
|
||||||
|
if (!Directory.Exists(args[2]))
|
||||||
|
throw new Exception(args[2]);
|
||||||
|
string directoryName = Path.GetFileName(args[0]) ?? throw new Exception();
|
||||||
|
string[] files = Directory.GetFiles(args[0]);
|
||||||
|
logger.LogInformation("{fileCount}", files.Length.ToString());
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
aSegments = Path.GetFileNameWithoutExtension(file).Split('-');
|
||||||
|
if (aSegments.Length != 2)
|
||||||
|
continue;
|
||||||
|
bSegments = aSegments[1].Split('_');
|
||||||
|
if (bSegments.Length != 3)
|
||||||
|
continue;
|
||||||
|
fileName = $"{directoryName}-{bSegments[1]}-{bSegments[0]}{Path.GetExtension(file)}";
|
||||||
|
checkFile = Path.Combine(args[2], fileName);
|
||||||
|
if (File.Exists(checkFile))
|
||||||
|
continue;
|
||||||
|
File.Copy(file, checkFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -14,6 +14,12 @@ internal static class HelperDay
|
|||||||
Day.Helper20231010.HgCV(logger, args[0]);
|
Day.Helper20231010.HgCV(logger, args[0]);
|
||||||
else if (args[1] == "Day-Helper-2023-10-16")
|
else if (args[1] == "Day-Helper-2023-10-16")
|
||||||
Day.Helper20231016.MoveDirectory(logger, args[0]);
|
Day.Helper20231016.MoveDirectory(logger, args[0]);
|
||||||
|
else if (args[1] == "Day-Helper-2023-10-24")
|
||||||
|
Day.Helper20231024.NetUse(logger, args[0]);
|
||||||
|
else if (args[1] == "Day-Helper-2023-11-02")
|
||||||
|
Day.Helper20231102.NuSpec(logger, args[0]);
|
||||||
|
else if (args[1] == "Day-Helper-2023-11-08")
|
||||||
|
Day.Helper20231108.MasterImage(logger, args);
|
||||||
else
|
else
|
||||||
throw new Exception(appSettings.Company);
|
throw new Exception(appSettings.Company);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<LangVersion>11.0</LangVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
@ -9,10 +8,10 @@
|
|||||||
<UserSecretsId>eb9e8f58-fcb5-45bb-9d4d-54f064c485b1</UserSecretsId>
|
<UserSecretsId>eb9e8f58-fcb5-45bb-9d4d-54f064c485b1</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0-rc.1.23419.4" />
|
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
<PackageReference Include="System.Text.Json" Version="8.0.0" />
|
||||||
<PackageReference Include="TextCopy" Version="6.2.1" />
|
<PackageReference Include="TextCopy" Version="6.2.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -146,8 +146,8 @@ internal static partial class HelperCreateNoteFiles
|
|||||||
file = string.Concat(Path.Combine(directory, $"{dateTime:yyyy-MM-dd}.md"));
|
file = string.Concat(Path.Combine(directory, $"{dateTime:yyyy-MM-dd}.md"));
|
||||||
if (File.Exists(file))
|
if (File.Exists(file))
|
||||||
continue;
|
continue;
|
||||||
File.WriteAllLines(file, new string[]
|
File.WriteAllLines(file,
|
||||||
{
|
[
|
||||||
"---",
|
"---",
|
||||||
"type: daily-note",
|
"type: daily-note",
|
||||||
$"created: {dateTime:yyyy-MM-dd}",
|
$"created: {dateTime:yyyy-MM-dd}",
|
||||||
@ -158,7 +158,7 @@ internal static partial class HelperCreateNoteFiles
|
|||||||
"```bash",
|
"```bash",
|
||||||
string.Empty,
|
string.Empty,
|
||||||
"```",
|
"```",
|
||||||
});
|
]);
|
||||||
if (directory != lastDirectory)
|
if (directory != lastDirectory)
|
||||||
{
|
{
|
||||||
Directory.SetCreationTime(directory, dateTime);
|
Directory.SetCreationTime(directory, dateTime);
|
||||||
@ -192,8 +192,8 @@ internal static partial class HelperCreateNoteFiles
|
|||||||
string? attributes;
|
string? attributes;
|
||||||
int descriptionKey = 2;
|
int descriptionKey = 2;
|
||||||
string[]? headerColumns;
|
string[]? headerColumns;
|
||||||
|
List<string> allLines = [];
|
||||||
string destinationDirectory;
|
string destinationDirectory;
|
||||||
List<string> allLines = new();
|
|
||||||
DateTime dateTime = new(ticks);
|
DateTime dateTime = new(ticks);
|
||||||
string csvHeader = "type,title,description,tags,links,body";
|
string csvHeader = "type,title,description,tags,links,body";
|
||||||
string tsvHeader = "type\ttitle\tdescription\ttags\tlinks\tbody";
|
string tsvHeader = "type\ttitle\tdescription\ttags\tlinks\tbody";
|
||||||
@ -275,8 +275,8 @@ internal static partial class HelperCreateNoteFiles
|
|||||||
|
|
||||||
internal static void CreateNoteFiles(ILogger<Worker> logger, string argsZero)
|
internal static void CreateNoteFiles(ILogger<Worker> logger, string argsZero)
|
||||||
{
|
{
|
||||||
|
List<string> importFiles = [];
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
List<string> importFiles = new();
|
|
||||||
CleanExistingFiles(logger, argsZero, ticks);
|
CleanExistingFiles(logger, argsZero, ticks);
|
||||||
importFiles.AddRange(Directory.GetFiles(argsZero, "*.csv", SearchOption.TopDirectoryOnly));
|
importFiles.AddRange(Directory.GetFiles(argsZero, "*.csv", SearchOption.TopDirectoryOnly));
|
||||||
importFiles.AddRange(Directory.GetFiles(argsZero, "*.tsv", SearchOption.TopDirectoryOnly));
|
importFiles.AddRange(Directory.GetFiles(argsZero, "*.tsv", SearchOption.TopDirectoryOnly));
|
||||||
|
@ -24,7 +24,7 @@ internal static class HelperDeleteEmptyDirectories
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (directories.Length > 0)
|
if (directories.Length > 0)
|
||||||
files = Array.Empty<string>();
|
files = [];
|
||||||
else
|
else
|
||||||
files = Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly);
|
files = Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
if (directories.Length == 0 && files.Length == 0)
|
if (directories.Length == 0 && files.Length == 0)
|
||||||
@ -40,7 +40,7 @@ internal static class HelperDeleteEmptyDirectories
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<string> check = new();
|
List<string> check = [];
|
||||||
foreach (string directory in directories)
|
foreach (string directory in directories)
|
||||||
{
|
{
|
||||||
DeleteOldLogFilesAndDeleteEmptyDirectories(ticks, searchPattern, directory, check);
|
DeleteOldLogFilesAndDeleteEmptyDirectories(ticks, searchPattern, directory, check);
|
||||||
@ -53,7 +53,7 @@ internal static class HelperDeleteEmptyDirectories
|
|||||||
|
|
||||||
private static void DeleteOldLogFilesAndDeleteEmptyDirectories(ILogger<Worker> logger, long? ticks, string? searchPattern, string rootDirectory)
|
private static void DeleteOldLogFilesAndDeleteEmptyDirectories(ILogger<Worker> logger, long? ticks, string? searchPattern, string rootDirectory)
|
||||||
{
|
{
|
||||||
List<string> check = new();
|
List<string> check = [];
|
||||||
List<string> directories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly).ToList();
|
List<string> directories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly).ToList();
|
||||||
directories.Add(rootDirectory);
|
directories.Add(rootDirectory);
|
||||||
foreach (string directory in directories)
|
foreach (string directory in directories)
|
||||||
|
@ -23,7 +23,7 @@ internal static class HelperFindReplace
|
|||||||
|
|
||||||
private static ReadOnlyCollection<(string, string)> GetFindReplace(string tnsNamesOraFile)
|
private static ReadOnlyCollection<(string, string)> GetFindReplace(string tnsNamesOraFile)
|
||||||
{
|
{
|
||||||
List<(string, string)> results = new();
|
List<(string, string)> results = [];
|
||||||
string[] segments;
|
string[] segments;
|
||||||
string[] lines = File.ReadAllLines(tnsNamesOraFile);
|
string[] lines = File.ReadAllLines(tnsNamesOraFile);
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
|
@ -73,7 +73,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static ReadOnlyDictionary<long, ReadOnlyCollection<string>> Convert(Dictionary<long, List<string>> keyValuePairs)
|
private static ReadOnlyDictionary<long, ReadOnlyCollection<string>> Convert(Dictionary<long, List<string>> keyValuePairs)
|
||||||
{
|
{
|
||||||
Dictionary<long, ReadOnlyCollection<string>> results = new();
|
Dictionary<long, ReadOnlyCollection<string>> results = [];
|
||||||
foreach (KeyValuePair<long, List<string>> keyValuePair in keyValuePairs)
|
foreach (KeyValuePair<long, List<string>> keyValuePair in keyValuePairs)
|
||||||
results.Add(keyValuePair.Key, new(keyValuePair.Value));
|
results.Add(keyValuePair.Key, new(keyValuePair.Value));
|
||||||
return new(results);
|
return new(results);
|
||||||
@ -81,7 +81,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static Dictionary<string, ReadOnlyCollection<ReadOnlyCollection<string>>> Convert(Dictionary<string, List<ReadOnlyCollection<string>>> keyValuePairs)
|
private static Dictionary<string, ReadOnlyCollection<ReadOnlyCollection<string>>> Convert(Dictionary<string, List<ReadOnlyCollection<string>>> keyValuePairs)
|
||||||
{
|
{
|
||||||
Dictionary<string, ReadOnlyCollection<ReadOnlyCollection<string>>> results = new();
|
Dictionary<string, ReadOnlyCollection<ReadOnlyCollection<string>>> results = [];
|
||||||
foreach (KeyValuePair<string, List<ReadOnlyCollection<string>>> keyValuePair in keyValuePairs)
|
foreach (KeyValuePair<string, List<ReadOnlyCollection<string>>> keyValuePair in keyValuePairs)
|
||||||
results.Add(keyValuePair.Key, new(keyValuePair.Value));
|
results.Add(keyValuePair.Key, new(keyValuePair.Value));
|
||||||
return new(results);
|
return new(results);
|
||||||
@ -91,13 +91,13 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
{
|
{
|
||||||
List<string> results;
|
List<string> results;
|
||||||
if (person is null)
|
if (person is null)
|
||||||
results = new() { "Id", "First-Name", "Last-Name", "Birth-Date", "Sex", "Address", "City", "State", "Zip", "Phone", "E-mail", "Facebook", "Facebook-Id", "Comment", "U-Id" };
|
results = ["Id", "First-Name", "Last-Name", "Birth-Date", "Sex", "Address", "City", "State", "Zip", "Phone", "E-mail", "Facebook", "Facebook-Id", "Comment", "U-Id"];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string? facebook = GetFaceBook(person);
|
string? facebook = GetFaceBook(person);
|
||||||
string? facebookId = GetFaceBookId(person);
|
string? facebookId = GetFaceBookId(person);
|
||||||
results = new()
|
results =
|
||||||
{
|
[
|
||||||
person.Id.ToString(),
|
person.Id.ToString(),
|
||||||
string.Concat(person.Name?.Given),
|
string.Concat(person.Name?.Given),
|
||||||
string.Concat(person.Name?.Sur),
|
string.Concat(person.Name?.Sur),
|
||||||
@ -113,7 +113,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
string.Concat(facebookId),
|
string.Concat(facebookId),
|
||||||
string.Empty,
|
string.Empty,
|
||||||
string.Concat(person.UId)
|
string.Concat(person.UId)
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
{
|
{
|
||||||
string[] results;
|
string[] results;
|
||||||
string key;
|
string key;
|
||||||
List<(string? Index, string Key)> collection = new();
|
List<(string? Index, string Key)> collection = [];
|
||||||
foreach (Family family in familyCollection)
|
foreach (Family family in familyCollection)
|
||||||
{
|
{
|
||||||
if (family.Id is null)
|
if (family.Id is null)
|
||||||
@ -138,7 +138,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static Dictionary<string, List<ReadOnlyCollection<string>>> Convert(ReadOnlyCollection<string> distinctSortedKKeys)
|
private static Dictionary<string, List<ReadOnlyCollection<string>>> Convert(ReadOnlyCollection<string> distinctSortedKKeys)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<ReadOnlyCollection<string>>> results = new();
|
Dictionary<string, List<ReadOnlyCollection<string>>> results = [];
|
||||||
ReadOnlyCollection<string> collection;
|
ReadOnlyCollection<string> collection;
|
||||||
List<ReadOnlyCollection<string>>? objectCollection;
|
List<ReadOnlyCollection<string>>? objectCollection;
|
||||||
foreach (string key in distinctSortedKKeys)
|
foreach (string key in distinctSortedKKeys)
|
||||||
@ -147,7 +147,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
continue;
|
continue;
|
||||||
if (!results.TryGetValue(key, out objectCollection))
|
if (!results.TryGetValue(key, out objectCollection))
|
||||||
{
|
{
|
||||||
results.Add(key, new());
|
results.Add(key, []);
|
||||||
if (!results.TryGetValue(key, out objectCollection))
|
if (!results.TryGetValue(key, out objectCollection))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static ReadOnlyCollection<string> GetHeaderLines(string startsWith, string[] sourceLines)
|
private static ReadOnlyCollection<string> GetHeaderLines(string startsWith, string[] sourceLines)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
for (int i = 0; i < sourceLines.Length; i++)
|
for (int i = 0; i < sourceLines.Length; i++)
|
||||||
{
|
{
|
||||||
if (sourceLines[i].StartsWith(startsWith))
|
if (sourceLines[i].StartsWith(startsWith))
|
||||||
@ -179,7 +179,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static Dictionary<string, List<string>> GetTxtFileCollection(Input input)
|
private static Dictionary<string, List<string>> GetTxtFileCollection(Input input)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<string>> results = new();
|
Dictionary<string, List<string>> results = [];
|
||||||
string[] lines;
|
string[] lines;
|
||||||
string[] directories;
|
string[] directories;
|
||||||
string directoryName;
|
string directoryName;
|
||||||
@ -188,7 +188,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
List<string>? collectionA;
|
List<string>? collectionA;
|
||||||
List<string>? collectionB;
|
List<string>? collectionB;
|
||||||
string siblingDirectoryName;
|
string siblingDirectoryName;
|
||||||
string[] files = input.SingletonDirectory is null || !Directory.Exists(input.SingletonDirectory) ? Array.Empty<string>() : Directory.GetFiles(input.SingletonDirectory, "*.txt", SearchOption.AllDirectories);
|
string[] files = input.SingletonDirectory is null || !Directory.Exists(input.SingletonDirectory) ? [] : Directory.GetFiles(input.SingletonDirectory, "*.txt", SearchOption.AllDirectories);
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
sourceDirectory = Path.GetDirectoryName(file);
|
sourceDirectory = Path.GetDirectoryName(file);
|
||||||
@ -203,7 +203,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
directoryName = Path.GetFileName(sourceDirectory);
|
directoryName = Path.GetFileName(sourceDirectory);
|
||||||
if (!results.TryGetValue(directoryName, out collectionA))
|
if (!results.TryGetValue(directoryName, out collectionA))
|
||||||
{
|
{
|
||||||
results.Add(directoryName, new());
|
results.Add(directoryName, []);
|
||||||
if (!results.TryGetValue(directoryName, out collectionA))
|
if (!results.TryGetValue(directoryName, out collectionA))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
siblingDirectoryName = Path.GetFileName(directory);
|
siblingDirectoryName = Path.GetFileName(directory);
|
||||||
if (!results.TryGetValue(siblingDirectoryName, out collectionB))
|
if (!results.TryGetValue(siblingDirectoryName, out collectionB))
|
||||||
{
|
{
|
||||||
results.Add(siblingDirectoryName, new());
|
results.Add(siblingDirectoryName, []);
|
||||||
if (!results.TryGetValue(siblingDirectoryName, out collectionB))
|
if (!results.TryGetValue(siblingDirectoryName, out collectionB))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
@ -270,8 +270,8 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
bool moreAdded = false;
|
bool moreAdded = false;
|
||||||
List<string>? collection;
|
List<string>? collection;
|
||||||
DateOnly? dateOnly = null;
|
DateOnly? dateOnly = null;
|
||||||
List<string> distinct = new();
|
List<string> distinct = [];
|
||||||
List<string> @continue = new();
|
List<string> @continue = [];
|
||||||
for (int j = i + 1; j < lines.Count; j++)
|
for (int j = i + 1; j < lines.Count; j++)
|
||||||
{
|
{
|
||||||
if (lines[j][0] == '1')
|
if (lines[j][0] == '1')
|
||||||
@ -324,7 +324,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
string seven;
|
string seven;
|
||||||
string? note = null;
|
string? note = null;
|
||||||
DateOnly? dateOnly = null;
|
DateOnly? dateOnly = null;
|
||||||
List<string> @continue = new();
|
List<string> @continue = [];
|
||||||
bool? isDead = lines[i].Length == 8 && lines[i][..8] == "1 DEAT Y" ? true : lines[i].Length == 8 && lines[i][..8] == "1 DEAT N" ? false : null;
|
bool? isDead = lines[i].Length == 8 && lines[i][..8] == "1 DEAT Y" ? true : lines[i].Length == 8 && lines[i][..8] == "1 DEAT N" ? false : null;
|
||||||
for (int j = i + 1; j < lines.Count; j++)
|
for (int j = i + 1; j < lines.Count; j++)
|
||||||
{
|
{
|
||||||
@ -364,7 +364,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
string seven;
|
string seven;
|
||||||
string? note = null;
|
string? note = null;
|
||||||
DateOnly? dateOnly = null;
|
DateOnly? dateOnly = null;
|
||||||
List<string> @continue = new();
|
List<string> @continue = [];
|
||||||
for (int j = i + 1; j < lines.Count; j++)
|
for (int j = i + 1; j < lines.Count; j++)
|
||||||
{
|
{
|
||||||
if (lines[j][0] == '1')
|
if (lines[j][0] == '1')
|
||||||
@ -399,11 +399,11 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static string[] GetNewLines(ReadOnlyCollection<string> lines, Birth? birth)
|
private static string[] GetNewLines(ReadOnlyCollection<string> lines, Birth? birth)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
string six;
|
string six;
|
||||||
string text;
|
string text;
|
||||||
string seven;
|
string seven;
|
||||||
List<string> @continue = birth is null ? new() : birth.Continue.ToList();
|
List<string> @continue = birth is null ? [] : birth.Continue.ToList();
|
||||||
for (int i = 0; i < lines.Count; i++)
|
for (int i = 0; i < lines.Count; i++)
|
||||||
{
|
{
|
||||||
if (birth is null)
|
if (birth is null)
|
||||||
@ -447,7 +447,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static List<long> GetIdsWhenPersonHasTitle(ReadOnlyDictionary<long, Person> people)
|
private static List<long> GetIdsWhenPersonHasTitle(ReadOnlyDictionary<long, Person> people)
|
||||||
{
|
{
|
||||||
List<long> results = new();
|
List<long> results = [];
|
||||||
foreach (KeyValuePair<long, Person> keyValuePair in people)
|
foreach (KeyValuePair<long, Person> keyValuePair in people)
|
||||||
{
|
{
|
||||||
if (keyValuePair.Value.Title is null)
|
if (keyValuePair.Value.Title is null)
|
||||||
@ -459,7 +459,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static ReadOnlyCollection<GenealogicalDataCommunicationRelation> GetRelations(ReadOnlyCollection<ReadOnlyCollection<string>> familyGroupLines)
|
private static ReadOnlyCollection<GenealogicalDataCommunicationRelation> GetRelations(ReadOnlyCollection<ReadOnlyCollection<string>> familyGroupLines)
|
||||||
{
|
{
|
||||||
List<GenealogicalDataCommunicationRelation> results = new();
|
List<GenealogicalDataCommunicationRelation> results = [];
|
||||||
int id;
|
int id;
|
||||||
string relation;
|
string relation;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
@ -585,12 +585,12 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
{
|
{
|
||||||
GenealogicalDataCommunicationCollections result;
|
GenealogicalDataCommunicationCollections result;
|
||||||
long? id;
|
long? id;
|
||||||
List<string> lines = new();
|
List<string> lines = [];
|
||||||
|
List<string> footerLines = [];
|
||||||
const string startsWith = "0 @";
|
const string startsWith = "0 @";
|
||||||
List<string> footerLines = new();
|
Dictionary<long, List<string>> keyValuePairs = [];
|
||||||
Dictionary<long, List<string>> keyValuePairs = new();
|
List<ReadOnlyCollection<string>> familyGroupLines = [];
|
||||||
List<ReadOnlyCollection<string>> familyGroupLines = new();
|
string[] sourceLines = string.IsNullOrEmpty(input.GenealogicalDataCommunicationFile) || !File.Exists(input.GenealogicalDataCommunicationFile) ? [] : File.ReadAllLines(input.GenealogicalDataCommunicationFile);
|
||||||
string[] sourceLines = string.IsNullOrEmpty(input.GenealogicalDataCommunicationFile) || !File.Exists(input.GenealogicalDataCommunicationFile) ? Array.Empty<string>() : File.ReadAllLines(input.GenealogicalDataCommunicationFile);
|
|
||||||
ReadOnlyCollection<string> headerLines = GetHeaderLines(startsWith, sourceLines);
|
ReadOnlyCollection<string> headerLines = GetHeaderLines(startsWith, sourceLines);
|
||||||
for (int i = headerLines.Count; i < sourceLines.Length; i++)
|
for (int i = headerLines.Count; i < sourceLines.Length; i++)
|
||||||
{
|
{
|
||||||
@ -632,7 +632,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
}
|
}
|
||||||
if (id is null)
|
if (id is null)
|
||||||
throw new Exception(string.Join(Environment.NewLine, lines));
|
throw new Exception(string.Join(Environment.NewLine, lines));
|
||||||
keyValuePairs.Add(id.Value, new());
|
keyValuePairs.Add(id.Value, []);
|
||||||
if (lines.Count == 0)
|
if (lines.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
keyValuePairs[id.Value].AddRange(lines);
|
keyValuePairs[id.Value].AddRange(lines);
|
||||||
@ -648,7 +648,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static ReadOnlyDictionary<long, Person> GetPeople(Input input, GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections)
|
private static ReadOnlyDictionary<long, Person> GetPeople(Input input, GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections)
|
||||||
{
|
{
|
||||||
Dictionary<long, Person> results = new();
|
Dictionary<long, Person> results = [];
|
||||||
long? id;
|
long? id;
|
||||||
char? sex;
|
char? sex;
|
||||||
Name? name;
|
Name? name;
|
||||||
@ -724,11 +724,11 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
Collections result;
|
Collections result;
|
||||||
long personKey;
|
long personKey;
|
||||||
char[] ageCollection;
|
char[] ageCollection;
|
||||||
Dictionary<long, string> idToName = new();
|
List<PersonExport> collection = [];
|
||||||
Dictionary<long, long> idToPersonKey = new();
|
Dictionary<long, string> idToName = [];
|
||||||
Dictionary<long, string> idToGivenName = new();
|
Dictionary<long, long> idToPersonKey = [];
|
||||||
|
Dictionary<long, string> idToGivenName = [];
|
||||||
int length = appSettings.PersonBirthdayFormat.Length;
|
int length = appSettings.PersonBirthdayFormat.Length;
|
||||||
List<PersonExport> collection = new();
|
|
||||||
foreach (KeyValuePair<long, Person> keyValuePair in people)
|
foreach (KeyValuePair<long, Person> keyValuePair in people)
|
||||||
{
|
{
|
||||||
if (keyValuePair.Value.Birth?.Note is null)
|
if (keyValuePair.Value.Birth?.Note is null)
|
||||||
@ -742,7 +742,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
personKey = dateTime.Ticks;
|
personKey = dateTime.Ticks;
|
||||||
idToPersonKey.Add(keyValuePair.Key, personKey);
|
idToPersonKey.Add(keyValuePair.Key, personKey);
|
||||||
idToName.Add(keyValuePair.Key, WindowsFileSystem().Replace(keyValuePair.Value.Name.ForwardSlashFull, "_"));
|
idToName.Add(keyValuePair.Key, WindowsFileSystem().Replace(keyValuePair.Value.Name.ForwardSlashFull, "_"));
|
||||||
ageCollection = keyValuePair.Value.Birth.Continue.Count == 0 ? Array.Empty<char>() : keyValuePair.Value.Birth.Continue[0].ToArray();
|
ageCollection = keyValuePair.Value.Birth.Continue.Count == 0 ? [] : keyValuePair.Value.Birth.Continue[0].ToArray();
|
||||||
idToGivenName.Add(keyValuePair.Key, string.IsNullOrEmpty(keyValuePair.Value.Name.Given) ? WindowsFileSystem().Replace(keyValuePair.Value.Name.ForwardSlashFull, "_") : WindowsFileSystem().Replace(keyValuePair.Value.Name.Given, "_"));
|
idToGivenName.Add(keyValuePair.Key, string.IsNullOrEmpty(keyValuePair.Value.Name.Given) ? WindowsFileSystem().Replace(keyValuePair.Value.Name.ForwardSlashFull, "_") : WindowsFileSystem().Replace(keyValuePair.Value.Name.Given, "_"));
|
||||||
collection.Add(new(keyValuePair.Key, new(keyValuePair.Value.Lines), keyValuePair.Value.Birth.Note, ageCollection, dateTime, personKey));
|
collection.Add(new(keyValuePair.Key, new(keyValuePair.Value.Lines), keyValuePair.Value.Birth.Note, ageCollection, dateTime, personKey));
|
||||||
}
|
}
|
||||||
@ -752,7 +752,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static List<Family> GetFamilyCollection(ReadOnlyCollection<ReadOnlyCollection<string>> familyGroupLines, ReadOnlyDictionary<long, Person> people, ReadOnlyDictionary<long, long> idToPersonKey, ReadOnlyDictionary<long, string> idToName, ReadOnlyDictionary<long, string> idToGivenName)
|
private static List<Family> GetFamilyCollection(ReadOnlyCollection<ReadOnlyCollection<string>> familyGroupLines, ReadOnlyDictionary<long, Person> people, ReadOnlyDictionary<long, long> idToPersonKey, ReadOnlyDictionary<long, string> idToName, ReadOnlyDictionary<long, string> idToGivenName)
|
||||||
{
|
{
|
||||||
List<Family> results = new();
|
List<Family> results = [];
|
||||||
string? name;
|
string? name;
|
||||||
long personKey;
|
long personKey;
|
||||||
Person? person;
|
Person? person;
|
||||||
@ -862,8 +862,8 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
|
|
||||||
private static void WriteGenealogicalDataCommunicationCollections(ILogger<Worker> logger, Input input, GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections, ReadOnlyDictionary<long, Person> people)
|
private static void WriteGenealogicalDataCommunicationCollections(ILogger<Worker> logger, Input input, GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections, ReadOnlyDictionary<long, Person> people)
|
||||||
{
|
{
|
||||||
List<string> lines = new();
|
List<string> lines = [];
|
||||||
List<string> allLines = new();
|
List<string> allLines = [];
|
||||||
if (genealogicalDataCommunicationCollections.HeaderLines.Count > 0)
|
if (genealogicalDataCommunicationCollections.HeaderLines.Count > 0)
|
||||||
{
|
{
|
||||||
allLines.AddRange(genealogicalDataCommunicationCollections.HeaderLines);
|
allLines.AddRange(genealogicalDataCommunicationCollections.HeaderLines);
|
||||||
@ -931,8 +931,8 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
long count = ticks;
|
long count = ticks;
|
||||||
string rootDirectory;
|
string rootDirectory;
|
||||||
string approximateYears;
|
string approximateYears;
|
||||||
List<string> distinct = new();
|
List<string> distinct = [];
|
||||||
List<string> duplicates = new();
|
List<string> duplicates = [];
|
||||||
string personDisplayDirectoryName;
|
string personDisplayDirectoryName;
|
||||||
foreach (PersonExport personExport in personExportCollection)
|
foreach (PersonExport personExport in personExportCollection)
|
||||||
{
|
{
|
||||||
@ -1010,7 +1010,7 @@ internal static partial class HelperGenealogicalDataCommunication
|
|||||||
[Obsolete]
|
[Obsolete]
|
||||||
private static string[] GetNewLines(ReadOnlyCollection<string> lines, Name? name, string[] kFiles, string[] mFiles, string[] k2Files, string[] m2Files)
|
private static string[] GetNewLines(ReadOnlyCollection<string> lines, Name? name, string[] kFiles, string[] mFiles, string[] k2Files, string[] m2Files)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
string six;
|
string six;
|
||||||
int? birthLastLine = null;
|
int? birthLastLine = null;
|
||||||
string slugName = WindowsFileSystem().Replace(string.Concat(name?.ForwardSlashFull), "_");
|
string slugName = WindowsFileSystem().Replace(string.Concat(name?.ForwardSlashFull), "_");
|
||||||
|
@ -17,8 +17,8 @@ internal static class HelperHardcodedFileSearchAndSort
|
|||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
CultureInfo cultureInfo = new("en-US");
|
CultureInfo cultureInfo = new("en-US");
|
||||||
Calendar calendar = cultureInfo.Calendar;
|
Calendar calendar = cultureInfo.Calendar;
|
||||||
string[] hardcodedValues = new string[]
|
string[] hardcodedValues =
|
||||||
{
|
[
|
||||||
"BIORAD2",
|
"BIORAD2",
|
||||||
"BIORAD3",
|
"BIORAD3",
|
||||||
"BIORAD4",
|
"BIORAD4",
|
||||||
@ -40,7 +40,7 @@ internal static class HelperHardcodedFileSearchAndSort
|
|||||||
"WC6Inch",
|
"WC6Inch",
|
||||||
"WC8Inch",
|
"WC8Inch",
|
||||||
"Bio-Rad"
|
"Bio-Rad"
|
||||||
};
|
];
|
||||||
string[] files = Directory.GetFiles(sourceDirectory, "*", searchOption);
|
string[] files = Directory.GetFiles(sourceDirectory, "*", searchOption);
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,8 @@ internal static class HelperILMerge
|
|||||||
bool result;
|
bool result;
|
||||||
ProcessStartInfo processStartInfo;
|
ProcessStartInfo processStartInfo;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
string[] successChecks = new string[] { "success" };
|
string[] successChecks = ["success"];
|
||||||
string[] errorChecks = new string[] { "Error", "Conflict", "error:" };
|
string[] errorChecks = ["Error", "Conflict", "error:"];
|
||||||
FileInfo ilMerge = new("C:/Users/phares/AppData/Local/IFXApps/ILMerge/ILMerge.exe");
|
FileInfo ilMerge = new("C:/Users/phares/AppData/Local/IFXApps/ILMerge/ILMerge.exe");
|
||||||
string[] dllFiles = Directory.GetFiles(workingDirectory, "*.dll", SearchOption.TopDirectoryOnly);
|
string[] dllFiles = Directory.GetFiles(workingDirectory, "*.dll", SearchOption.TopDirectoryOnly);
|
||||||
string errorFile = Path.Combine(workingDirectory, string.Concat(Path.GetFileName(workingDirectory), ".err"));
|
string errorFile = Path.Combine(workingDirectory, string.Concat(Path.GetFileName(workingDirectory), ".err"));
|
||||||
|
@ -66,7 +66,7 @@ internal static partial class HelperKanbanMetadata
|
|||||||
|
|
||||||
private static List<(int, int, string, FileInfo)> GetCollectionFromIndex(string sourceDirectory, string[] lines)
|
private static List<(int, int, string, FileInfo)> GetCollectionFromIndex(string sourceDirectory, string[] lines)
|
||||||
{
|
{
|
||||||
List<(int, int, string, FileInfo)> results = new();
|
List<(int, int, string, FileInfo)> results = [];
|
||||||
string line;
|
string line;
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
|
@ -13,14 +13,14 @@ internal static class HelperLogMerge
|
|||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
|
List<string> lines = [];
|
||||||
string format = "yyyyMMdd";
|
string format = "yyyyMMdd";
|
||||||
|
List<string> moveFiles = [];
|
||||||
string segment1 = string.Empty;
|
string segment1 = string.Empty;
|
||||||
string sourceFileNameWithoutExtension;
|
string sourceFileNameWithoutExtension;
|
||||||
List<string> lines = new();
|
|
||||||
List<string> moveFiles = new();
|
|
||||||
DateTime dateTime = DateTime.Now.AddMinutes(2);
|
DateTime dateTime = DateTime.Now.AddMinutes(2);
|
||||||
string[] sourceFiles = Directory.GetFiles(argsZero, "*.log", SearchOption.TopDirectoryOnly);
|
string[] sourceFiles = Directory.GetFiles(argsZero, "*.log", SearchOption.TopDirectoryOnly);
|
||||||
Dictionary<string, Dictionary<int, string[]>> keyValuePairs = new();
|
Dictionary<string, Dictionary<int, string[]>> keyValuePairs = [];
|
||||||
foreach (string sourceFile in sourceFiles)
|
foreach (string sourceFile in sourceFiles)
|
||||||
{
|
{
|
||||||
sourceFileNameWithoutExtension = Path.GetFileNameWithoutExtension(sourceFile);
|
sourceFileNameWithoutExtension = Path.GetFileNameWithoutExtension(sourceFile);
|
||||||
@ -33,7 +33,7 @@ internal static class HelperLogMerge
|
|||||||
moveFiles.Add(sourceFile);
|
moveFiles.Add(sourceFile);
|
||||||
day = sourceFileNameWithoutExtension[..8];
|
day = sourceFileNameWithoutExtension[..8];
|
||||||
if (!keyValuePairs.ContainsKey(day))
|
if (!keyValuePairs.ContainsKey(day))
|
||||||
keyValuePairs.Add(day, new Dictionary<int, string[]>());
|
keyValuePairs.Add(day, []);
|
||||||
if (sourceFileNameWithoutExtension.Substring(8, 1) == "_")
|
if (sourceFileNameWithoutExtension.Substring(8, 1) == "_")
|
||||||
continue;
|
continue;
|
||||||
segments = sourceFileNameWithoutExtension.Split('_');
|
segments = sourceFileNameWithoutExtension.Split('_');
|
||||||
|
@ -71,7 +71,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<string> GetFrontMatterLines(string[] parsedLines)
|
private static List<string> GetFrontMatterLines(string[] parsedLines)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
string afterTrim;
|
string afterTrim;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
@ -153,8 +153,8 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<MarkdownFileAndLines> GetMarkdownFileAndLines(string file, List<MarkdownFileAndLines> markdownFiles)
|
private static List<MarkdownFileAndLines> GetMarkdownFileAndLines(string file, List<MarkdownFileAndLines> markdownFiles)
|
||||||
{
|
{
|
||||||
List<MarkdownFileAndLines> results = new();
|
List<MarkdownFileAndLines> results = [];
|
||||||
List<string> distinct = new();
|
List<string> distinct = [];
|
||||||
string? directory = Path.GetDirectoryName(file);
|
string? directory = Path.GetDirectoryName(file);
|
||||||
foreach (MarkdownFileAndLines markdownFileAndLines in markdownFiles)
|
foreach (MarkdownFileAndLines markdownFileAndLines in markdownFiles)
|
||||||
{
|
{
|
||||||
@ -259,12 +259,12 @@ internal static partial class HelperMarkdown
|
|||||||
int notCompleted;
|
int notCompleted;
|
||||||
List<string> lines;
|
List<string> lines;
|
||||||
string? effort = null;
|
string? effort = null;
|
||||||
List<string> assignees = new();
|
List<string> assignees = [];
|
||||||
string? requestedDateTime = null;
|
string? requestedDateTime = null;
|
||||||
ReadOnlyCollection<Group> groups;
|
ReadOnlyCollection<Group> groups;
|
||||||
List<H2HexColor> h2HexColors = new();
|
List<H2HexColor> h2HexColors = [];
|
||||||
List<H2NoCheckboxes> h2NoCheckboxes = new();
|
List<H2NoCheckboxes> h2NoCheckboxes = [];
|
||||||
List<H2WithCheckboxes> h2WithCheckboxes = new();
|
List<H2WithCheckboxes> h2WithCheckboxes = [];
|
||||||
if (markdownFileAndLines.MarkdownFile.LineNumber.FrontMatterYamlEnd is not null)
|
if (markdownFileAndLines.MarkdownFile.LineNumber.FrontMatterYamlEnd is not null)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < markdownFileAndLines.Lines.Length; i++)
|
for (int i = 1; i < markdownFileAndLines.Lines.Length; i++)
|
||||||
@ -300,7 +300,7 @@ internal static partial class HelperMarkdown
|
|||||||
h2HexColors.Add(new(line[skip..], $"#{groups.First(l => l.Value.Length == 6)}"));
|
h2HexColors.Add(new(line[skip..], $"#{groups.First(l => l.Value.Length == 6)}"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lines = new();
|
lines = [];
|
||||||
if (i + 1 == markdownFileAndLines.Lines.Length)
|
if (i + 1 == markdownFileAndLines.Lines.Length)
|
||||||
continue;
|
continue;
|
||||||
for (int j = i + 1; j < markdownFileAndLines.Lines.Length; j++)
|
for (int j = i + 1; j < markdownFileAndLines.Lines.Length; j++)
|
||||||
@ -335,10 +335,10 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<MarkdownFileAndLines> Distinct(IEnumerable<MarkdownFileAndLines>? markdownFileAndLinesCollection)
|
private static List<MarkdownFileAndLines> Distinct(IEnumerable<MarkdownFileAndLines>? markdownFileAndLinesCollection)
|
||||||
{
|
{
|
||||||
List<MarkdownFileAndLines> results = new();
|
List<MarkdownFileAndLines> results = [];
|
||||||
if (markdownFileAndLinesCollection is not null)
|
if (markdownFileAndLinesCollection is not null)
|
||||||
{
|
{
|
||||||
List<string> distinct = new();
|
List<string> distinct = [];
|
||||||
foreach (MarkdownFileAndLines markdownFileAndLines in markdownFileAndLinesCollection)
|
foreach (MarkdownFileAndLines markdownFileAndLines in markdownFileAndLinesCollection)
|
||||||
{
|
{
|
||||||
if (distinct.Contains(markdownFileAndLines.MarkdownFile.File))
|
if (distinct.Contains(markdownFileAndLines.MarkdownFile.File))
|
||||||
@ -352,7 +352,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<MarkdownFileAndLines> GetMarkdownFileAndLines(ReadOnlyDictionary<string, List<MarkdownFileAndLines>> keyValuePairs)
|
private static List<MarkdownFileAndLines> GetMarkdownFileAndLines(ReadOnlyDictionary<string, List<MarkdownFileAndLines>> keyValuePairs)
|
||||||
{
|
{
|
||||||
List<MarkdownFileAndLines> results = new();
|
List<MarkdownFileAndLines> results = [];
|
||||||
foreach (KeyValuePair<string, List<MarkdownFileAndLines>> keyValuePair in keyValuePairs)
|
foreach (KeyValuePair<string, List<MarkdownFileAndLines>> keyValuePair in keyValuePairs)
|
||||||
{
|
{
|
||||||
foreach (MarkdownFileAndLines markdownFileAndLines in keyValuePair.Value)
|
foreach (MarkdownFileAndLines markdownFileAndLines in keyValuePair.Value)
|
||||||
@ -370,7 +370,7 @@ internal static partial class HelperMarkdown
|
|||||||
string[] segmentsB;
|
string[] segmentsB;
|
||||||
string segmentsLast;
|
string segmentsLast;
|
||||||
string segmentsFirst;
|
string segmentsFirst;
|
||||||
List<string> jsonLines = new();
|
List<string> jsonLines = [];
|
||||||
for (int i = 0; i < frontMatterYamlEnd; i++)
|
for (int i = 0; i < frontMatterYamlEnd; i++)
|
||||||
{
|
{
|
||||||
if (lines[i] == "---")
|
if (lines[i] == "---")
|
||||||
@ -430,13 +430,13 @@ internal static partial class HelperMarkdown
|
|||||||
if (jsonLines.Count > 0)
|
if (jsonLines.Count > 0)
|
||||||
(result, keyValuePairs, results) = Get(jsonLines);
|
(result, keyValuePairs, results) = Get(jsonLines);
|
||||||
else
|
else
|
||||||
(result, keyValuePairs, results) = (null, null, new());
|
(result, keyValuePairs, results) = (null, null, []);
|
||||||
return (result, keyValuePairs, results.ToArray());
|
return (result, keyValuePairs, results.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyDictionary<string, List<MarkdownFileAndLines>> GetKeyValuePairs(ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
private static ReadOnlyDictionary<string, List<MarkdownFileAndLines>> GetKeyValuePairs(ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<MarkdownFileAndLines>> results = new();
|
Dictionary<string, List<MarkdownFileAndLines>> results = [];
|
||||||
MarkdownFile markdownFile;
|
MarkdownFile markdownFile;
|
||||||
string fileNameWithoutExtension;
|
string fileNameWithoutExtension;
|
||||||
string fileNameWithoutExtensionB;
|
string fileNameWithoutExtensionB;
|
||||||
@ -446,7 +446,7 @@ internal static partial class HelperMarkdown
|
|||||||
markdownFile = relativeTo.Value.MarkdownFile;
|
markdownFile = relativeTo.Value.MarkdownFile;
|
||||||
if (!results.TryGetValue(relativeTo.Key, out markdownFiles))
|
if (!results.TryGetValue(relativeTo.Key, out markdownFiles))
|
||||||
{
|
{
|
||||||
results.Add(relativeTo.Key, new());
|
results.Add(relativeTo.Key, []);
|
||||||
if (!results.TryGetValue(relativeTo.Key, out markdownFiles))
|
if (!results.TryGetValue(relativeTo.Key, out markdownFiles))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ internal static partial class HelperMarkdown
|
|||||||
fileNameWithoutExtensionB = fileNameWithoutExtension.Replace("%20", "-").Replace(' ', '-');
|
fileNameWithoutExtensionB = fileNameWithoutExtension.Replace("%20", "-").Replace(' ', '-');
|
||||||
if (!results.TryGetValue(markdownFile.FileNameWithoutExtension, out markdownFiles))
|
if (!results.TryGetValue(markdownFile.FileNameWithoutExtension, out markdownFiles))
|
||||||
{
|
{
|
||||||
results.Add(markdownFile.FileNameWithoutExtension, new());
|
results.Add(markdownFile.FileNameWithoutExtension, []);
|
||||||
if (!results.TryGetValue(markdownFile.FileNameWithoutExtension, out markdownFiles))
|
if (!results.TryGetValue(markdownFile.FileNameWithoutExtension, out markdownFiles))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ internal static partial class HelperMarkdown
|
|||||||
continue;
|
continue;
|
||||||
if (!results.TryGetValue(fileNameWithoutExtension, out markdownFiles))
|
if (!results.TryGetValue(fileNameWithoutExtension, out markdownFiles))
|
||||||
{
|
{
|
||||||
results.Add(fileNameWithoutExtension, new());
|
results.Add(fileNameWithoutExtension, []);
|
||||||
if (!results.TryGetValue(fileNameWithoutExtension, out markdownFiles))
|
if (!results.TryGetValue(fileNameWithoutExtension, out markdownFiles))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -476,7 +476,7 @@ internal static partial class HelperMarkdown
|
|||||||
continue;
|
continue;
|
||||||
if (!results.TryGetValue(fileNameWithoutExtensionB, out markdownFiles))
|
if (!results.TryGetValue(fileNameWithoutExtensionB, out markdownFiles))
|
||||||
{
|
{
|
||||||
results.Add(fileNameWithoutExtensionB, new());
|
results.Add(fileNameWithoutExtensionB, []);
|
||||||
if (!results.TryGetValue(fileNameWithoutExtensionB, out markdownFiles))
|
if (!results.TryGetValue(fileNameWithoutExtensionB, out markdownFiles))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ internal static partial class HelperMarkdown
|
|||||||
markdownFile = relativeTo.Value.MarkdownFile;
|
markdownFile = relativeTo.Value.MarkdownFile;
|
||||||
if (!results.TryGetValue(markdownFile.H1, out markdownFiles))
|
if (!results.TryGetValue(markdownFile.H1, out markdownFiles))
|
||||||
{
|
{
|
||||||
results.Add(markdownFile.H1, new());
|
results.Add(markdownFile.H1, []);
|
||||||
if (!results.TryGetValue(markdownFile.H1, out markdownFiles))
|
if (!results.TryGetValue(markdownFile.H1, out markdownFiles))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
@ -548,7 +548,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static ReadOnlyDictionary<string, MarkdownFileAndLines> GetRelativeToCollection(AppSettings appSettings, Input input, string[] files, bool force)
|
private static ReadOnlyDictionary<string, MarkdownFileAndLines> GetRelativeToCollection(AppSettings appSettings, Input input, string[] files, bool force)
|
||||||
{
|
{
|
||||||
Dictionary<string, MarkdownFileAndLines> results = new();
|
Dictionary<string, MarkdownFileAndLines> results = [];
|
||||||
string h1;
|
string h1;
|
||||||
string key;
|
string key;
|
||||||
string type;
|
string type;
|
||||||
@ -571,7 +571,7 @@ internal static partial class HelperMarkdown
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = appSettings.DefaultNoteType;
|
type = appSettings.DefaultNoteType;
|
||||||
File.WriteAllLines(file, new string[] { "---", $"type: \"{type}\"", "---", string.Empty, $"# {h1}" });
|
File.WriteAllLines(file, ["---", $"type: \"{type}\"", "---", string.Empty, $"# {h1}"]);
|
||||||
lines = File.ReadAllLines(file).ToList();
|
lines = File.ReadAllLines(file).ToList();
|
||||||
}
|
}
|
||||||
markdownFile = new(fileInfo.CreationTime,
|
markdownFile = new(fileInfo.CreationTime,
|
||||||
@ -587,23 +587,23 @@ internal static partial class HelperMarkdown
|
|||||||
if (force || input.StartAt is null || file.StartsWith(input.StartAt))
|
if (force || input.StartAt is null || file.StartsWith(input.StartAt))
|
||||||
results.Add(key, new(markdownFile, lines.ToArray()));
|
results.Add(key, new(markdownFile, lines.ToArray()));
|
||||||
else
|
else
|
||||||
results.Add(key, new(markdownFile, Array.Empty<string>()));
|
results.Add(key, new(markdownFile, []));
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyDictionary<string, List<Card>> GetColumnsToCards(Input input, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
private static ReadOnlyDictionary<string, List<Card>> GetColumnsToCards(Input input, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<Card>> results = new();
|
Dictionary<string, List<Card>> results = [];
|
||||||
Card card;
|
Card card;
|
||||||
string key;
|
string key;
|
||||||
string[] lines;
|
string[] lines;
|
||||||
string[] segmentsA;
|
string[] segmentsA;
|
||||||
string? column = null;
|
string? column = null;
|
||||||
List<Card> cards = new();
|
List<Card> cards = [];
|
||||||
|
List<string> allKeys = [];
|
||||||
MarkdownFile markdownFile;
|
MarkdownFile markdownFile;
|
||||||
MarkdownExtra markdownExtra;
|
MarkdownExtra markdownExtra;
|
||||||
List<string> allKeys = new();
|
|
||||||
MarkdownFileAndLines? markdownFileAndLines;
|
MarkdownFileAndLines? markdownFileAndLines;
|
||||||
foreach (KeyValuePair<string, MarkdownFileAndLines> relativeTo in relativeToCollection)
|
foreach (KeyValuePair<string, MarkdownFileAndLines> relativeTo in relativeToCollection)
|
||||||
allKeys.Add(relativeTo.Key);
|
allKeys.Add(relativeTo.Key);
|
||||||
@ -626,7 +626,7 @@ internal static partial class HelperMarkdown
|
|||||||
if (column is null)
|
if (column is null)
|
||||||
throw new NullReferenceException(nameof(column));
|
throw new NullReferenceException(nameof(column));
|
||||||
results.Add(column, cards);
|
results.Add(column, cards);
|
||||||
cards = new();
|
cards = [];
|
||||||
}
|
}
|
||||||
column = lines[i][3..].TrimEnd();
|
column = lines[i][3..].TrimEnd();
|
||||||
if (lines.Length == i + 1)
|
if (lines.Length == i + 1)
|
||||||
@ -695,7 +695,7 @@ internal static partial class HelperMarkdown
|
|||||||
{
|
{
|
||||||
column = "Not Linked";
|
column = "Not Linked";
|
||||||
results.Add(column, cards);
|
results.Add(column, cards);
|
||||||
cards = new();
|
cards = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
@ -714,7 +714,7 @@ internal static partial class HelperMarkdown
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<MarkdownFileAndLines> matches;
|
List<MarkdownFileAndLines> matches;
|
||||||
matches = markdownFileAndLinesCollection is null ? new() : GetMarkdownFileAndLines(file, markdownFileAndLinesCollection);
|
matches = markdownFileAndLinesCollection is null ? [] : GetMarkdownFileAndLines(file, markdownFileAndLinesCollection);
|
||||||
if (matches.Count == 1)
|
if (matches.Count == 1)
|
||||||
result = matches[0];
|
result = matches[0];
|
||||||
else
|
else
|
||||||
@ -793,7 +793,7 @@ internal static partial class HelperMarkdown
|
|||||||
private static int ConvertFrontMatterToJsonFriendly(ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
private static int ConvertFrontMatterToJsonFriendly(ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
bool write;
|
bool write;
|
||||||
string[] lines;
|
string[] lines;
|
||||||
MarkdownFile markdownFile;
|
MarkdownFile markdownFile;
|
||||||
@ -1101,7 +1101,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<MarkdownFileAndLines> GetRecursiveLines(AppSettings appSettings, Input input, ILogger<Worker> logger, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
private static List<MarkdownFileAndLines> GetRecursiveLines(AppSettings appSettings, Input input, ILogger<Worker> logger, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
||||||
{
|
{
|
||||||
List<MarkdownFileAndLines> results = new();
|
List<MarkdownFileAndLines> results = [];
|
||||||
string[] lines;
|
string[] lines;
|
||||||
List<char> indentations;
|
List<char> indentations;
|
||||||
MarkdownFile markdownFile;
|
MarkdownFile markdownFile;
|
||||||
@ -1113,8 +1113,8 @@ internal static partial class HelperMarkdown
|
|||||||
continue;
|
continue;
|
||||||
if (input.StartAt is null || !relativeTo.Value.MarkdownFile.File.StartsWith(input.StartAt) || Path.GetFileName(relativeTo.Value.MarkdownFile.Directory) != Path.GetFileName(input.StartAt))
|
if (input.StartAt is null || !relativeTo.Value.MarkdownFile.File.StartsWith(input.StartAt) || Path.GetFileName(relativeTo.Value.MarkdownFile.Directory) != Path.GetFileName(input.StartAt))
|
||||||
continue;
|
continue;
|
||||||
indentations = new();
|
indentations = [];
|
||||||
recursiveLines = new();
|
recursiveLines = [];
|
||||||
lines = relativeTo.Value.Lines;
|
lines = relativeTo.Value.Lines;
|
||||||
markdownFile = relativeTo.Value.MarkdownFile;
|
markdownFile = relativeTo.Value.MarkdownFile;
|
||||||
SetRecursiveLines(appSettings, logger, keyValuePairs, markdownFile.FileNameWithoutExtension, markdownFile, lines, indentations, recursiveLines);
|
SetRecursiveLines(appSettings, logger, keyValuePairs, markdownFile.FileNameWithoutExtension, markdownFile, lines, indentations, recursiveLines);
|
||||||
@ -1153,7 +1153,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<Record> GetWithLinksForHugo(AppSettings appSettings, Input input)
|
private static List<Record> GetWithLinksForHugo(AppSettings appSettings, Input input)
|
||||||
{
|
{
|
||||||
List<Record> results = new();
|
List<Record> results = [];
|
||||||
string file;
|
string file;
|
||||||
string line;
|
string line;
|
||||||
string[] lines;
|
string[] lines;
|
||||||
@ -1212,7 +1212,7 @@ internal static partial class HelperMarkdown
|
|||||||
|
|
||||||
private static List<string> GetDistinct(List<Record> collection)
|
private static List<string> GetDistinct(List<Record> collection)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
foreach (Record record in collection)
|
foreach (Record record in collection)
|
||||||
{
|
{
|
||||||
if (results.Contains(record.Directory))
|
if (results.Contains(record.Directory))
|
||||||
@ -1278,7 +1278,7 @@ internal static partial class HelperMarkdown
|
|||||||
private static int SetFrontMatterAndH1(AppSettings appSettings, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
private static int SetFrontMatterAndH1(AppSettings appSettings, ReadOnlyDictionary<string, MarkdownFileAndLines> relativeToCollection)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
string h1Line;
|
string h1Line;
|
||||||
string[] lines;
|
string[] lines;
|
||||||
string typeLine;
|
string typeLine;
|
||||||
|
@ -17,9 +17,9 @@ internal static class HelperPackageFilesByDate
|
|||||||
PackageJson? packageJson;
|
PackageJson? packageJson;
|
||||||
string[] packageJsonFiles;
|
string[] packageJsonFiles;
|
||||||
string? packageJsonDirectory;
|
string? packageJsonDirectory;
|
||||||
|
List<DateTime> dateTimes = [];
|
||||||
string fileNameWithoutExtension;
|
string fileNameWithoutExtension;
|
||||||
string packageJsonDirectoryName;
|
string packageJsonDirectoryName;
|
||||||
List<DateTime> dateTimes = new();
|
|
||||||
if (log is null)
|
if (log is null)
|
||||||
throw new NullReferenceException();
|
throw new NullReferenceException();
|
||||||
if (!Directory.Exists(sourceDirectory))
|
if (!Directory.Exists(sourceDirectory))
|
||||||
|
@ -113,7 +113,7 @@ internal static class HelperPdfStripperWrapper
|
|||||||
string[] lines;
|
string[] lines;
|
||||||
string fileName;
|
string fileName;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
List<string> collection = new();
|
List<string> collection = [];
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
lines = File.ReadAllLines(file);
|
lines = File.ReadAllLines(file);
|
||||||
|
@ -14,7 +14,7 @@ internal static class HelperRenameToOldMoveDeleteOldMerge
|
|||||||
{
|
{
|
||||||
string renameFile;
|
string renameFile;
|
||||||
string destinationFile;
|
string destinationFile;
|
||||||
List<string> deleteFiles = new();
|
List<string> deleteFiles = [];
|
||||||
string[] moveFiles = Directory.GetFiles(argsZero, "*", SearchOption.TopDirectoryOnly);
|
string[] moveFiles = Directory.GetFiles(argsZero, "*", SearchOption.TopDirectoryOnly);
|
||||||
log.LogInformation("<{moveFiles.Length}> to move", moveFiles.Length);
|
log.LogInformation("<{moveFiles.Length}> to move", moveFiles.Length);
|
||||||
foreach (string moveFile in moveFiles)
|
foreach (string moveFile in moveFiles)
|
||||||
|
@ -48,7 +48,7 @@ internal static class HelperStart
|
|||||||
if (!result)
|
if (!result)
|
||||||
result = standardOutput == string.Empty && standardError == string.Empty;
|
result = standardOutput == string.Empty && standardError == string.Empty;
|
||||||
if (!result)
|
if (!result)
|
||||||
File.WriteAllLines(errorFile, new string[] { standardOutput, Environment.NewLine, Environment.NewLine, standardError });
|
File.WriteAllLines(errorFile, [standardOutput, Environment.NewLine, Environment.NewLine, standardError]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ internal static partial class HelperVSCodePossibleExtension
|
|||||||
|
|
||||||
private static ReadOnlyCollection<int> GetMethodLines(ReadOnlyCollection<Method> methods)
|
private static ReadOnlyCollection<int> GetMethodLines(ReadOnlyCollection<Method> methods)
|
||||||
{
|
{
|
||||||
List<int> results = new();
|
List<int> results = [];
|
||||||
foreach (Method method in methods)
|
foreach (Method method in methods)
|
||||||
{
|
{
|
||||||
for (int i = method.StartLine; i < method.EndLine + 1; i++)
|
for (int i = method.StartLine; i < method.EndLine + 1; i++)
|
||||||
@ -133,7 +133,7 @@ internal static partial class HelperVSCodePossibleExtension
|
|||||||
|
|
||||||
private static ReadOnlyCollection<Method> GetMethods(string cSharpFile, ILogger<Worker> logger, string[] lines)
|
private static ReadOnlyCollection<Method> GetMethods(string cSharpFile, ILogger<Worker> logger, string[] lines)
|
||||||
{
|
{
|
||||||
List<Method> results = new();
|
List<Method> results = [];
|
||||||
int blocks;
|
int blocks;
|
||||||
bool isLinq;
|
bool isLinq;
|
||||||
int endLine;
|
int endLine;
|
||||||
@ -210,7 +210,7 @@ internal static partial class HelperVSCodePossibleExtension
|
|||||||
private static bool WriteAllLines(string cSharpFile, string[] lines, ReadOnlyCollection<Method> methods)
|
private static bool WriteAllLines(string cSharpFile, string[] lines, ReadOnlyCollection<Method> methods)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
List<string> results = new();
|
List<string> results = [];
|
||||||
ReadOnlyCollection<int> methodLines = GetMethodLines(methods);
|
ReadOnlyCollection<int> methodLines = GetMethodLines(methods);
|
||||||
int minMethodLines = methodLines.Min();
|
int minMethodLines = methodLines.Min();
|
||||||
for (int i = 0; i < minMethodLines; i++)
|
for (int i = 0; i < minMethodLines; i++)
|
||||||
|
@ -11,29 +11,50 @@ internal static partial class HelperZipFilesBy
|
|||||||
[GeneratedRegex("[a-zA-Z0-9]{1,}")]
|
[GeneratedRegex("[a-zA-Z0-9]{1,}")]
|
||||||
private static partial Regex LowerAlphaAlphaAndNumber();
|
private static partial Regex LowerAlphaAlphaAndNumber();
|
||||||
|
|
||||||
private static bool SetDateFromZipEntry(ILogger<Worker> logger, string[] zipFiles, string keyFile, string keyFileB, string keyFileC)
|
private static DateTimeOffset? GetDateTimeOffset(string keyFileExtension, FileInfo fileInfo, FileInfo extractKeyFileInfo)
|
||||||
|
{
|
||||||
|
DateTimeOffset? dateTimeOffset = null;
|
||||||
|
using ZipArchive zip = ZipFile.Open(fileInfo.FullName, ZipArchiveMode.Read);
|
||||||
|
foreach (ZipArchiveEntry zipArchiveEntry in zip.Entries)
|
||||||
|
{
|
||||||
|
if (!zipArchiveEntry.Name.EndsWith(keyFileExtension))
|
||||||
|
continue;
|
||||||
|
dateTimeOffset = zipArchiveEntry.LastWriteTime;
|
||||||
|
if (fileInfo.FullName[0] != '\\')
|
||||||
|
{
|
||||||
|
zipArchiveEntry.ExtractToFile(extractKeyFileInfo.FullName);
|
||||||
|
File.SetCreationTime(extractKeyFileInfo.FullName, fileInfo.CreationTime);
|
||||||
|
File.SetLastWriteTime(extractKeyFileInfo.FullName, dateTimeOffset.Value.LocalDateTime);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return dateTimeOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ExtractKeyFileAndSetDateFromZipEntry(ILogger<Worker> logger, string[] zipFiles, string keyFileExtension, string keyFileExtensionB, string keyFileExtensionC)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
string[] files;
|
string[] files;
|
||||||
string checkFile;
|
string checkFile;
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
string? zipDirectory;
|
FileInfo extractKeyFileInfo;
|
||||||
DateTimeOffset? dateTimeOffset;
|
DateTimeOffset? dateTimeOffset;
|
||||||
foreach (string zipFile in zipFiles)
|
foreach (string zipFile in zipFiles)
|
||||||
|
{
|
||||||
|
fileInfo = new(zipFile);
|
||||||
|
if (fileInfo.DirectoryName is null)
|
||||||
|
throw new NullReferenceException(nameof(fileInfo.DirectoryName));
|
||||||
|
extractKeyFileInfo = new(Path.Combine(fileInfo.DirectoryName, $"{Path.GetFileNameWithoutExtension(fileInfo.Name)}{keyFileExtension}"));
|
||||||
|
if (extractKeyFileInfo.Exists)
|
||||||
|
{
|
||||||
|
if (extractKeyFileInfo.CreationTime.ToString("yyyy-MM-dd") == fileInfo.CreationTime.ToString("yyyy-MM-dd") && extractKeyFileInfo.LastWriteTime.ToString("yyyy-MM-dd") == fileInfo.LastWriteTime.ToString("yyyy-MM-dd"))
|
||||||
|
continue;
|
||||||
|
File.Delete(extractKeyFileInfo.FullName);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dateTimeOffset = null;
|
dateTimeOffset = GetDateTimeOffset(keyFileExtension, fileInfo, extractKeyFileInfo);
|
||||||
fileInfo = new(zipFile);
|
if (dateTimeOffset is null)
|
||||||
using ZipArchive zip = ZipFile.Open(zipFile, ZipArchiveMode.Read);
|
|
||||||
foreach (ZipArchiveEntry zipArchiveEntry in zip.Entries)
|
|
||||||
{
|
|
||||||
if (!zipArchiveEntry.Name.EndsWith(keyFile))
|
|
||||||
continue;
|
|
||||||
dateTimeOffset = zipArchiveEntry.LastWriteTime;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
zipDirectory = Path.GetDirectoryName(zipFile);
|
|
||||||
if (dateTimeOffset is null || zipDirectory is null)
|
|
||||||
continue;
|
continue;
|
||||||
if (fileInfo.LastWriteTime != dateTimeOffset.Value.LocalDateTime)
|
if (fileInfo.LastWriteTime != dateTimeOffset.Value.LocalDateTime)
|
||||||
{
|
{
|
||||||
@ -41,7 +62,9 @@ internal static partial class HelperZipFilesBy
|
|||||||
if (!result)
|
if (!result)
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
files = Directory.GetFiles(zipDirectory, $"*{keyFile}", SearchOption.TopDirectoryOnly);
|
if (string.IsNullOrEmpty(keyFileExtensionB))
|
||||||
|
continue;
|
||||||
|
files = Directory.GetFiles(fileInfo.DirectoryName, keyFileExtensionB, SearchOption.TopDirectoryOnly);
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
fileInfo = new(file);
|
fileInfo = new(file);
|
||||||
@ -52,22 +75,11 @@ internal static partial class HelperZipFilesBy
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(keyFileB))
|
if (string.IsNullOrEmpty(keyFileExtensionC))
|
||||||
continue;
|
continue;
|
||||||
files = Directory.GetFiles(zipDirectory, keyFileB, SearchOption.TopDirectoryOnly);
|
if (fileInfo.DirectoryName is null)
|
||||||
foreach (string file in files)
|
throw new NullReferenceException(nameof(fileInfo.DirectoryName));
|
||||||
{
|
files = Directory.GetFiles(fileInfo.DirectoryName, keyFileExtensionC, SearchOption.TopDirectoryOnly);
|
||||||
fileInfo = new(file);
|
|
||||||
if (fileInfo.LastWriteTime != dateTimeOffset.Value.LocalDateTime)
|
|
||||||
{
|
|
||||||
File.SetLastWriteTime(fileInfo.FullName, dateTimeOffset.Value.LocalDateTime);
|
|
||||||
if (!result)
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(keyFileC))
|
|
||||||
continue;
|
|
||||||
files = Directory.GetFiles(zipDirectory, keyFileC, SearchOption.TopDirectoryOnly);
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
fileInfo = new(file);
|
fileInfo = new(file);
|
||||||
@ -93,6 +105,7 @@ internal static partial class HelperZipFilesBy
|
|||||||
{ File.Move(zipFile, checkFile); }
|
{ File.Move(zipFile, checkFile); }
|
||||||
catch (Exception) { logger.LogInformation("<{zipFile}> couldn't be moved!", zipFile); }
|
catch (Exception) { logger.LogInformation("<{zipFile}> couldn't be moved!", zipFile); }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,9 +128,9 @@ internal static partial class HelperZipFilesBy
|
|||||||
DateTime dateTime = DateTime.MinValue;
|
DateTime dateTime = DateTime.MinValue;
|
||||||
DateTime firstEmail = new(2019, 3, 8);
|
DateTime firstEmail = new(2019, 3, 8);
|
||||||
CultureInfo cultureInfo = new("en-US");
|
CultureInfo cultureInfo = new("en-US");
|
||||||
|
Dictionary<string, DateTime> weeks = [];
|
||||||
Calendar calendar = cultureInfo.Calendar;
|
Calendar calendar = cultureInfo.Calendar;
|
||||||
Regex regex = LowerAlphaAlphaAndNumber();
|
Regex regex = LowerAlphaAlphaAndNumber();
|
||||||
Dictionary<string, DateTime> weeks = new();
|
|
||||||
int ticksLength = nowDateTime.AddDays(-6).Ticks.ToString().Length;
|
int ticksLength = nowDateTime.AddDays(-6).Ticks.ToString().Length;
|
||||||
for (int i = 0; i < int.MaxValue; i++)
|
for (int i = 0; i < int.MaxValue; i++)
|
||||||
{
|
{
|
||||||
@ -131,10 +144,10 @@ internal static partial class HelperZipFilesBy
|
|||||||
}
|
}
|
||||||
weekOfYear = calendar.GetWeekOfYear(nowDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
weekOfYear = calendar.GetWeekOfYear(nowDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
string skipKey = string.Concat(nowDateTime.ToString("yyyy"), "_Week_", weekOfYear);
|
string skipKey = string.Concat(nowDateTime.ToString("yyyy"), "_Week_", weekOfYear);
|
||||||
Dictionary<string, List<string>> keyValuePairs = new();
|
Dictionary<string, List<string>> keyValuePairs = [];
|
||||||
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
if (topDirectories.Length == 0)
|
if (topDirectories.Length == 0)
|
||||||
topDirectories = new string[] { sourceDirectory };
|
topDirectories = [sourceDirectory];
|
||||||
foreach (string topDirectory in topDirectories)
|
foreach (string topDirectory in topDirectories)
|
||||||
{
|
{
|
||||||
keyValuePairs.Clear();
|
keyValuePairs.Clear();
|
||||||
@ -187,7 +200,7 @@ internal static partial class HelperZipFilesBy
|
|||||||
if (key == skipKey)
|
if (key == skipKey)
|
||||||
continue;
|
continue;
|
||||||
if (!keyValuePairs.ContainsKey(key))
|
if (!keyValuePairs.ContainsKey(key))
|
||||||
keyValuePairs.Add(key, new List<string>());
|
keyValuePairs.Add(key, []);
|
||||||
keyValuePairs[key].Add(subFile);
|
keyValuePairs[key].Add(subFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,30 +250,30 @@ internal static partial class HelperZipFilesBy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool SetDateFromZipEntryForNuspec(ILogger<Worker> logger, string[] files) =>
|
internal static bool ExportNuspecAndSetDateFromZipEntry(ILogger<Worker> logger, string[] files) =>
|
||||||
SetDateFromZipEntry(logger, files, ".nuspec", "icon", "readme");
|
ExtractKeyFileAndSetDateFromZipEntry(logger, files, ".nuspec", "icon", "readme");
|
||||||
|
|
||||||
internal static bool SetDateFromZipEntry(ILogger<Worker> logger, string sourceDirectory, SearchOption searchOption = SearchOption.AllDirectories)
|
internal static bool ExtractKeyFileAndSetDateFromZipEntry(ILogger<Worker> logger, string sourceDirectory, SearchOption searchOption = SearchOption.AllDirectories)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
bool loop;
|
bool loop;
|
||||||
string keyFile;
|
|
||||||
string keyFileB;
|
|
||||||
string keyFileC;
|
|
||||||
string[] zipFiles;
|
string[] zipFiles;
|
||||||
string searchPattern;
|
string searchPattern;
|
||||||
|
string keyFileExtension;
|
||||||
|
string keyFileExtensionB;
|
||||||
|
string keyFileExtensionC;
|
||||||
if (!Directory.Exists(sourceDirectory))
|
if (!Directory.Exists(sourceDirectory))
|
||||||
_ = Directory.CreateDirectory(sourceDirectory);
|
_ = Directory.CreateDirectory(sourceDirectory);
|
||||||
for (int i = 1; i < 3; i++)
|
for (int i = 1; i < 3; i++)
|
||||||
{
|
{
|
||||||
(searchPattern, keyFile, keyFileB, keyFileC) = i switch
|
(searchPattern, keyFileExtension, keyFileExtensionB, keyFileExtensionC) = i switch
|
||||||
{
|
{
|
||||||
1 => ("*.nupkg", ".nuspec", "icon", "readme"),
|
1 => ("*.nupkg", ".nuspec", "icon", "readme"),
|
||||||
2 => ("*.vsix", ".vsixmanifest", string.Empty, string.Empty),
|
2 => ("*.vsix", ".vsixmanifest", string.Empty, string.Empty),
|
||||||
_ => throw new NotSupportedException()
|
_ => throw new NotSupportedException()
|
||||||
};
|
};
|
||||||
zipFiles = Directory.GetFiles(sourceDirectory, searchPattern, searchOption);
|
zipFiles = Directory.GetFiles(sourceDirectory, searchPattern, searchOption);
|
||||||
loop = SetDateFromZipEntry(logger, zipFiles, keyFile, keyFileB, keyFileC);
|
loop = ExtractKeyFileAndSetDateFromZipEntry(logger, zipFiles, keyFileExtension, keyFileExtensionB, keyFileExtensionC);
|
||||||
if (loop && !result)
|
if (loop && !result)
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ public class AppSettings
|
|||||||
continue;
|
continue;
|
||||||
throw new NotSupportedException(physicalFileProvider.Root);
|
throw new NotSupportedException(physicalFileProvider.Root);
|
||||||
}
|
}
|
||||||
|
throw new NotSupportedException("Not found!");
|
||||||
}
|
}
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
|
@ -24,8 +24,8 @@ public class Worker : BackgroundService
|
|||||||
_IsSilent = silentIndex > -1;
|
_IsSilent = silentIndex > -1;
|
||||||
if (_IsSilent)
|
if (_IsSilent)
|
||||||
args.RemoveAt(silentIndex);
|
args.RemoveAt(silentIndex);
|
||||||
_ConsoleKeys = new ConsoleKey[]
|
_ConsoleKeys =
|
||||||
{
|
[
|
||||||
ConsoleKey.A,
|
ConsoleKey.A,
|
||||||
ConsoleKey.B,
|
ConsoleKey.B,
|
||||||
ConsoleKey.C,
|
ConsoleKey.C,
|
||||||
@ -52,7 +52,7 @@ public class Worker : BackgroundService
|
|||||||
ConsoleKey.Y,
|
ConsoleKey.Y,
|
||||||
ConsoleKey.Z,
|
ConsoleKey.Z,
|
||||||
ConsoleKey.Delete
|
ConsoleKey.Delete
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task StartAsync(CancellationToken cancellationToken) =>
|
public override Task StartAsync(CancellationToken cancellationToken) =>
|
||||||
@ -174,7 +174,7 @@ public class Worker : BackgroundService
|
|||||||
Helpers.HelperRenameToOldMoveDeleteOldMerge.RenameToOldMoveDeleteOld(_Logger, _Args[0]);
|
Helpers.HelperRenameToOldMoveDeleteOldMerge.RenameToOldMoveDeleteOld(_Logger, _Args[0]);
|
||||||
break;
|
break;
|
||||||
case ConsoleKey.S:
|
case ConsoleKey.S:
|
||||||
_ = Helpers.HelperZipFilesBy.SetDateFromZipEntry(_Logger, _Args[0]);
|
_ = Helpers.HelperZipFilesBy.ExtractKeyFileAndSetDateFromZipEntry(_Logger, _Args[0]);
|
||||||
break;
|
break;
|
||||||
case ConsoleKey.T:
|
case ConsoleKey.T:
|
||||||
Helpers.HelperTooLong.UpdateDateVerifyAndGetTicksDirectories(_Logger, _AppSettings, _Args[0]);
|
Helpers.HelperTooLong.UpdateDateVerifyAndGetTicksDirectories(_Logger, _AppSettings, _Args[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user