created-date-offset (Day-Helper-2025-08-03)

P and J drives

Tasks json file inputs

IDE0005 none
This commit is contained in:
2025-08-11 09:08:14 -07:00
parent e74a0ccdce
commit 88bdd33285
4 changed files with 240 additions and 118 deletions

View File

@ -120,7 +120,7 @@ dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template
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.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary dotnet_diagnostic.IDE0005.severity = none # Using directive is unnecessary
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010) dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031) dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)

15
.vscode/launch.json vendored
View File

@ -8,19 +8,20 @@
"name": ".NET Core Launch (console)", "name": ".NET Core Launch (console)",
"type": "coreclr", "type": "coreclr",
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "Build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll", "program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
"args": [ "args": [
"s", "s",
"X", "X",
"V:/7-Question/Event 2024 Directories-xmp", "P:/1-Images-A/Images-0b793904",
"Day-Helper-2025-07-26", "Day-Helper-2025-07-26",
"4e+9",
"L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json", "L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json",
"*.xmp", ".avif~.bmp~.gif~.heic~.insp~.jp2~.jpe~.jpeg~.jpg~.jxl~.png~.psd~.raw~.rw2~.svg~.tif~.tiff~.webp~.3gp~.3gpp~.avi~.dvr-ms~.flv~.insv~.m2t~.m2ts~.m4v~.mkv~.mov~.mp4~.mpe~.mpeg~.mpg~.mts~.ts~.webm~.wmv",
"V:/7-Question/Event 2024 Directories-xmp-moved", "P:/6-Other-Large-Z/Current-Results/C)Resize/0b793904/Original/(helper)",
"s", "s",
"X", "X",
"V:/1-Images-A/Images-0b793904", "P:/1-Images-A/Images-0b793904",
"Day-Helper-2024-12-17", "Day-Helper-2024-12-17",
".job.json", ".job.json",
"thumbs.db~sync.ffs_db~verify.json~.html", "thumbs.db~sync.ffs_db~verify.json~.html",
@ -28,7 +29,7 @@
"D:/5-Other-Small/Disk/Snap2HTML/Snap2HTML.exe", "D:/5-Other-Small/Disk/Snap2HTML/Snap2HTML.exe",
"s", "s",
"X", "X",
"V:/Tmp/Phares/Helper-2025-07-20", "P:/Tmp/Phares/Helper-2025-07-20",
"Day-Helper-2025-07-20", "Day-Helper-2025-07-20",
"871467010009.jpg", "871467010009.jpg",
"L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json", "L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json",
@ -74,7 +75,7 @@
"\"vp154\"", "\"vp154\"",
"s", "s",
"X", "X",
"V:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung", "P:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung",
"Day-Helper-2025-07-05", "Day-Helper-2025-07-05",
"x-653889110721.jpg~401223300869.jpg", "x-653889110721.jpg~401223300869.jpg",
"3648,2736,1~3024,4032,6", "3648,2736,1~3024,4032,6",

297
.vscode/tasks.json vendored
View File

@ -1,22 +1,135 @@
{ {
"version": "2.0.0", "inputs": [
{
"default": "Development",
"description": "Which ASP Net Core Environment?",
"id": "ASPNETCORE_ENVIRONMENT",
"options": [
"Development",
"Production"
],
"type": "pickString"
},
{
"default": "{AssemblyTitle}",
"description": "What Assembly Title?",
"id": "AssemblyTitle",
"type": "promptString"
},
{
"default": "{Build.BuildId}",
"description": "Which Build BuildId?",
"id": "Build.BuildId",
"type": "promptString"
},
{
"default": "{Build.Reason}",
"description": "Which Build Reason?",
"id": "Build.Reason",
"type": "promptString"
},
{
"default": "{Build.Repository.Id}",
"description": "Which Build Repository Id?",
"id": "Build.Repository.Id",
"type": "promptString"
},
{
"default": "{Build.Repository.Name}",
"description": "Which Build Repository Name?",
"id": "Build.Repository.Name",
"type": "promptString"
},
{
"default": "{Build.SourceVersion}",
"description": "Which Build Source Version?",
"id": "Build.SourceVersion",
"type": "promptString"
},
{
"default": "Debug",
"description": "Which Configuration?",
"id": "Configuration",
"options": [
"Debug",
"Release"
],
"type": "pickString"
},
{
"default": "net8.0",
"description": "Which Core Version?",
"id": "CoreVersion",
"options": [
"net8.0"
],
"type": "pickString"
},
{
"default": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"description": "Which MS Build?",
"id": "MSBuild",
"type": "promptString"
},
{
"default": "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/",
"description": "Which Nuget Source?",
"id": "NugetSource",
"type": "promptString"
},
{
"default": "win-x64",
"description": "Which Runtime?",
"id": "Runtime",
"options": [
"win-x64",
"win-x32",
"linux-x64",
"linux-x32"
],
"type": "pickString"
},
{
"default": "L:/",
"description": "Which System DefaultWorkingDirectory?",
"id": "System.DefaultWorkingDirectory",
"options": [
"L:/",
"D:/",
"C:/"
],
"type": "pickString"
},
{
"default": "v4.8",
"description": "Which Core Target Framework Version?",
"id": "TargetFrameworkVersion",
"options": [
"v4.8"
],
"type": "pickString"
},
{
"default": "{UserSecretsId}",
"description": "Which Core User Secrets Id?",
"id": "UserSecretsId",
"type": "promptString"
}
],
"tasks": [ "tasks": [
{ {
"label": "User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"user-secrets", "user-secrets",
"-p", "-p",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj",
"init" "init"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "User Secrets Init",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"user-secrets", "user-secrets",
"-p", "-p",
@ -25,12 +138,12 @@
"_UserSecretsId", "_UserSecretsId",
"0c43f9aa-96e9-4298-967c-ed069d79e262" "0c43f9aa-96e9-4298-967c-ed069d79e262"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "User Secrets Set",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"format", "format",
"--report", "--report",
@ -40,82 +153,78 @@
"--severity", "--severity",
"warn" "warn"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Format",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"format", "format",
"whitespace" "whitespace"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Format Whitespaces",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "build",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"build", "build",
"-r", "-r",
"win-x64", "win-x64",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Build",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "build Linux",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"build", "build",
"-r", "-r",
"linux-x64", "linux-x64",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Build Linux",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanLogin",
"command": "podman",
"type": "process",
"args": [ "args": [
"login", "login",
"gitea.phares.duckdns.org:443" "gitea.phares.duckdns.org:443"
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Login",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanBuild",
"command": "podman",
"type": "process",
"args": [ "args": [
"build", "build",
"-t", "-t",
"file-folder-helper", "file-folder-helper",
"." "."
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Build",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanImageList",
"command": "podman",
"type": "process",
"args": [ "args": [
"image", "image",
"ls" "ls"
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Image List",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanRun",
"command": "podman",
"type": "process",
"args": [ "args": [
"run", "run",
"-p", "-p",
@ -124,57 +233,55 @@
"file-folder-helper-001", "file-folder-helper-001",
"a3de856b5731" "a3de856b5731"
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Run",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanTag",
"command": "podman",
"type": "process",
"args": [ "args": [
"tag", "tag",
"a3de856b5731", "a3de856b5731",
"gitea.phares.duckdns.org:443/phares3757/file-folder-helper:latest" "gitea.phares.duckdns.org:443/phares3757/file-folder-helper:latest"
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Tag",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "podmanPush",
"command": "podman",
"type": "process",
"args": [ "args": [
"push", "push",
"gitea.phares.duckdns.org:443/phares3757/file-folder-helper:latest" "gitea.phares.duckdns.org:443/phares3757/file-folder-helper:latest"
], ],
"problemMatcher": "$msCompile" "command": "podman",
"label": "Podman Push",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"publish", "publish",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Publish",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"watch", "watch",
"run", "run",
"--project", "--project",
"${workspaceFolder}/File-Folder-Helper.csproj" "${workspaceFolder}/File-Folder-Helper.csproj"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Watch",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "Publish AOT",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"publish", "publish",
"-r", "-r",
@ -182,16 +289,14 @@
"-c", "-c",
"Release", "Release",
"-p:PublishAot=true", "-p:PublishAot=true",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Publish AOT",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "Publish AOT Linux",
"command": "dotnet",
"type": "process",
"args": [ "args": [
"publish", "publish",
"-r", "-r",
@ -199,40 +304,38 @@
"-c", "-c",
"Release", "Release",
"-p:PublishAot=true", "-p:PublishAot=true",
"${workspaceFolder}/File-Folder-Helper.csproj", "${workspaceFolder}/File-Folder-Helper.csproj"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "command": "dotnet",
"label": "Publish AOT Linux",
"problemMatcher": "$msCompile",
"type": "process"
}, },
{ {
"label": "Kanbn Console", "label": "Kanbn Console",
"type": "npm", "problemMatcher": [],
"script": "kanbn.board", "script": "kanbn.board",
"problemMatcher": [] "type": "npm"
}, },
{ {
"label": "Kanbn Write Boad",
"type": "shell",
"command": "& kanbn board -j | L:/Git/kanbn2md/kanbn2md.exe >.kanbn/board.md", "command": "& kanbn board -j | L:/Git/kanbn2md/kanbn2md.exe >.kanbn/board.md",
"problemMatcher": [] "label": "Kanbn Write Boad",
"problemMatcher": [],
"type": "shell"
}, },
{ {
"label": "Kanbn Write json", "label": "Kanbn Write json",
"type": "npm", "problemMatcher": [],
"script": "kanbn.board.json", "script": "kanbn.board.json",
"problemMatcher": [] "type": "npm"
}, },
{ {
"label": "Jest",
"type": "shell",
"command": "npx jest", "command": "npx jest",
"problemMatcher": [] "label": "Jest",
"problemMatcher": [],
"type": "shell"
}, },
{ {
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
"type": "shell",
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
"args": [ "args": [
"s", "s",
"X", "X",
@ -241,7 +344,11 @@
"false", "false",
"4" "4"
], ],
"problemMatcher": [] "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
"problemMatcher": [],
"type": "shell"
} }
] ],
"version": "2.0.0"
} }

View File

@ -1,13 +1,10 @@
using Microsoft.Extensions.Logging;
using Phares.Shared.Models;
using Phares.Shared.Models.Stateless;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Microsoft.Extensions.Logging;
using Phares.Shared.Models;
using Phares.Shared.Models.Stateless;
namespace File_Folder_Helper.ADO2025.PI6; namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250726 { internal static partial class Helper20250726 {
@ -27,23 +24,36 @@ internal static partial class Helper20250726 {
logger.LogInformation(args[2]); logger.LogInformation(args[2]);
logger.LogInformation(args[3]); logger.LogInformation(args[3]);
logger.LogInformation(args[4]); logger.LogInformation(args[4]);
string searchPattern = args[3]; logger.LogInformation(args[5]);
string jsonFile = Path.GetFullPath(args[2]); string[] files;
string[] searchPatterns = args[4].Split('~');
string jsonFile = Path.GetFullPath(args[3]);
if (!File.Exists(jsonFile)) { if (!File.Exists(jsonFile)) {
throw new Exception($"json file doesn't exist! <{jsonFile}>"); throw new Exception($"json file doesn't exist! <{jsonFile}>");
} }
ReadOnlyCollection<Record> records;
string json = File.ReadAllText(jsonFile); string json = File.ReadAllText(jsonFile);
ReadOnlyDictionary<byte, ReadOnlyCollection<string>> keyValues;
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]); string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
string destinationDirectory = Path.GetFullPath(args[4].Split('~')[0]); string destinationDirectory = Path.GetFullPath(args[5].Split('~')[0]);
long maxSize = long.Parse(args[2], System.Globalization.NumberStyles.Float);
ReadOnlyDictionary<int, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs;
Helper20250726Settings? settings = JsonSerializer.Deserialize(json, Helper20250726SettingsSourceGenerationContext.Default.Helper20250726Settings); Helper20250726Settings? settings = JsonSerializer.Deserialize(json, Helper20250726SettingsSourceGenerationContext.Default.Helper20250726Settings);
if (settings?.ResultSettings is null || settings.ResultSettings.ResultAllInOneSubdirectoryLength < 1 || settings.MetadataSettings is null) { if (settings?.ResultSettings is null || settings.ResultSettings.ResultAllInOneSubdirectoryLength < 1 || settings.MetadataSettings is null) {
throw new Exception(nameof(Helper20250726Settings)); throw new Exception(nameof(Helper20250726Settings));
} }
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories); foreach (string searchPattern in searchPatterns) {
ReadOnlyDictionary<int, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs = GetKeyValuePairs(destinationDirectory, settings.ResultSettings); files = Directory.GetFiles(sourceDirectory, $"*{searchPattern}", SearchOption.AllDirectories);
ReadOnlyCollection<Record> records = GetRecords(logger, settings.ResultSettings, settings.MetadataSettings, files); if (files.Length == 0) {
ReadOnlyDictionary<byte, ReadOnlyCollection<string>> keyValues = keyValuePairs.ElementAt(0).Value; logger.LogInformation($"Didn't find any {searchPattern} files");
CopyToCombinedEnumAndIndexFormat(logger, records, keyValues); continue;
}
logger.LogInformation($"Found {files.Length} {searchPattern} files");
keyValuePairs = GetKeyValuePairs(destinationDirectory, settings.ResultSettings);
records = GetRecords(logger, settings.ResultSettings, settings.MetadataSettings, files);
keyValues = keyValuePairs.ElementAt(0).Value;
CopyToCombinedEnumAndIndexFormat(logger, maxSize, records, keyValues);
}
Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, destinationDirectory); Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, destinationDirectory);
} }
@ -84,11 +94,15 @@ internal static partial class Helper20250726 {
return results.AsReadOnly(); return results.AsReadOnly();
} }
private static void CopyToCombinedEnumAndIndexFormat(ILogger<Worker> logger, ReadOnlyCollection<Record> records, ReadOnlyDictionary<byte, ReadOnlyCollection<string>> keyValuePairs) { private static void CopyToCombinedEnumAndIndexFormat(ILogger<Worker> logger, long maxSize, ReadOnlyCollection<Record> records, ReadOnlyDictionary<byte, ReadOnlyCollection<string>> keyValuePairs) {
string checkFile; string checkFile;
FileInfo fileInfo; FileInfo fileInfo;
FileAttributes fileAttributes; FileAttributes fileAttributes;
foreach (Record record in records) { foreach (Record record in records) {
if (record.FilePath.Length > maxSize) {
logger.LogWarning("<{file}> skipped because it is over {size}!", record.FilePath.Name, maxSize);
continue;
}
checkFile = Path.Combine(keyValuePairs[record.CombinedEnumAndIndex.Enum][record.CombinedEnumAndIndex.Index], record.FilePath.Name); checkFile = Path.Combine(keyValuePairs[record.CombinedEnumAndIndex.Enum][record.CombinedEnumAndIndex.Index], record.FilePath.Name);
if (File.Exists(checkFile)) { if (File.Exists(checkFile)) {
logger.LogWarning("<{file}> skipped because it already exists!", record.FilePath.Name); logger.LogWarning("<{file}> skipped because it already exists!", record.FilePath.Name);