2 Commits

20 changed files with 212 additions and 95 deletions

6
.vscode/launch.json vendored
View File

@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Build-Compare",
"program": "${workspaceFolder}/Compare/bin/Debug/net9.0/win-x64/AA.Compare.dll",
"program": "${workspaceFolder}/Compare/bin/Debug/net10.0/win-x64/AA.Compare.dll",
"args": [
"s"
],
@ -23,7 +23,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Build-Rename",
"program": "${workspaceFolder}/Rename/bin/Debug/net9.0/win-x64/AA.Rename.dll",
"program": "${workspaceFolder}/Rename/bin/Debug/net10.0/win-x64/AA.Rename.dll",
"args": [
"s"
],
@ -40,7 +40,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Build-Windows",
"program": "${workspaceFolder}/Windows/bin/Debug/net9.0/win-x64/AA.Windows.dll",
"program": "${workspaceFolder}/Windows/bin/Debug/net10.0/win-x64/AA.Windows.dll",
"args": [
"s"
],

2
.vscode/tasks.json vendored
View File

@ -631,7 +631,7 @@
{
"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",
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net10.0/win-x64/publish/File-Folder-Helper.exe",
"args": [
"s",
"X",

View File

@ -4,15 +4,15 @@
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<UserSecretsId>770b6ae3-266e-4d5f-970a-173709b064de</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Compare</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -42,10 +42,10 @@
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
</ItemGroup>
<ItemGroup>

View File

@ -4,14 +4,14 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.Distance</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -38,12 +38,12 @@
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\"/>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="MetadataExtractor" Version="2.8.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="MetadataExtractor" Version="2.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="WindowsShortcutFactory" Version="1.2.0" />
</ItemGroup>
<ItemGroup>

View File

@ -4,14 +4,14 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.Face</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -38,12 +38,12 @@
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\"/>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="MetadataExtractor" Version="2.8.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="MetadataExtractor" Version="2.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metadata\AA.Metadata.csproj" />

View File

@ -4,15 +4,15 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.FaceRecognitionDotNet</PackageId>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Authors>Mike Phares</Authors>
<Company>Phares</Company>
<IncludeSymbols>true</IncludeSymbols>

View File

@ -4,14 +4,14 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember142023>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1699920000)), 3600))))</HoursSinceNovember142023>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.Metadata</PackageId>
<Version>8.0.118.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1699920000)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -41,9 +41,8 @@
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MetadataExtractor" Version="2.8.1" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="MetadataExtractor" Version="2.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\AA.Shared.csproj" />

View File

@ -106,7 +106,7 @@ internal abstract class GPS
string longitudeDMS = gpsDirectory.Longitude;
double longitude = ParseValueFromDmsString(longitudeDMS);
result = new(latitude, longitude);
string dms = result.ToDmsString();
string dms = result.Value.ToDmsString();
if ($"{latitudeDMS}, {longitudeDMS}" != dms)
result = null;
}

View File

@ -4,14 +4,14 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.People</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -38,11 +38,11 @@
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\"/>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MetadataExtractor" Version="2.8.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="MetadataExtractor" Version="2.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="WindowsShortcutFactory" Version="1.2.0" />
</ItemGroup>
<ItemGroup>

View File

@ -4,16 +4,16 @@
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<UserSecretsIdOld>fa0fa59b-afe4-4960-9afc-18fcbc7fb41b</UserSecretsIdOld>
<UserSecretsId>843db3e1-e18f-4cba-8b00-967529a32635</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Rename</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -43,13 +43,13 @@
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.8.2" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.12" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="CliWrap" Version="3.9.0" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.12" />
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />

View File

@ -7,7 +7,6 @@ namespace View_by_Distance.Rename.Models;
public record RenameSettings(string Company,
string DefaultMaker,
Dictionary<string, string?> DirectoryDictionary,
string? FirstPassFile,
bool ForceNewId,
bool InPlace,
@ -27,6 +26,7 @@ public record RenameSettings(string Company,
public override string ToString()
{
#pragma warning disable CS0117, CS0534
string result = JsonSerializer.Serialize(this, RenameSettingsSourceGenerationContext.Default.RenameSettings);
return result;
}

View File

@ -152,19 +152,24 @@ public partial class Rename : IRename, IDisposable
long epoch = new DateTime(1970, 1, 1).Ticks;
long net8ReleaseDate = new DateTime(2023, 11, 14).Ticks;
long net9ReleaseDate = new DateTime(2024, 11, 12).Ticks;
long net10ReleaseDate = new DateTime(2026, 01, 01).Ticks;
long net10ReleaseDate = new DateTime(2025, 11, 11).Ticks;
long net11ReleaseDate = new DateTime(2026, 11, 11).Ticks;
double net8TotalSeconds = new TimeSpan(net8ReleaseDate - epoch).TotalSeconds;
double net9TotalSeconds = new TimeSpan(net9ReleaseDate - epoch).TotalSeconds;
double net10TotalSeconds = new TimeSpan(net10ReleaseDate - epoch).TotalSeconds;
double net11TotalSeconds = new TimeSpan(net11ReleaseDate - epoch).TotalSeconds;
logger?.LogInformation("It has been {net8TotalSeconds} seconds since net8 was released", net8TotalSeconds);
logger?.LogInformation("It has been {net9TotalSeconds} seconds since net9 was released", net9TotalSeconds);
logger?.LogInformation("It has been {net10TotalSeconds} seconds since net10 was released", net10TotalSeconds);
logger?.LogInformation("It has been {net11TotalSeconds} seconds since net11 was released", net11TotalSeconds);
double net8TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net8TotalSeconds) / secondsInAHour);
double net9TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net9TotalSeconds) / secondsInAHour);
double net10TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net10TotalSeconds) / secondsInAHour);
double net11TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net11TotalSeconds) / secondsInAHour);
logger?.LogInformation("It has been {net8TotalHours} hours since net8 was released", net8TotalHours);
logger?.LogInformation("It has been {net9TotalHours} hours since net9 was released", net9TotalHours);
logger?.LogInformation("It has been {net10TotalHours} hours since net10 was released", net10TotalHours);
logger?.LogInformation("It has been {net11TotalHours} hours since net11 was released", net11TotalHours);
}
private void RenameWork(ILogger<Program>? logger, AppSettings appSettings, IRename rename)
@ -273,7 +278,6 @@ public partial class Rename : IRename, IDisposable
{
List<FirstPass> results = [];
int index = -1;
TimeSpan timeSpan;
foreach (KeyValuePair<string, List<FileHolder>> keyValuePair in keyValuePairs)
{
index += 1;
@ -287,9 +291,6 @@ public partial class Rename : IRename, IDisposable
if (keyValuePair.Value.Count > 2)
throw new NotSupportedException("Too many sidecar files!");
SetFirstPassCollection(logger, appSettings, rename, ids, metadata, index, keyValuePair, results);
timeSpan = new(DateTime.Now.Ticks - rename.Ticks);
if (timeSpan.TotalMilliseconds > appSettings.RenameSettings.MaxMilliSecondsPerCall)
break;
}
return results;
}
@ -643,7 +644,6 @@ public partial class Rename : IRename, IDisposable
{
if (record.ExifDirectory.FilePath.FullName[..2] != directoryInfo.FullName[..2])
isWrongYear = null;
string directoryName;
string tfw = GetTFW(record, isWrongYear);
string? maker = IMetaBase.GetMaker(record.ExifDirectory);
string rootDirectory = appSettings.ResultSettings.RootDirectory;
@ -652,14 +652,7 @@ public partial class Rename : IRename, IDisposable
string? splat = checkDirectoryName.Length > 3 && checkDirectoryName[^3..][1] == '!' ? checkDirectoryName[^3..] : null;
string contains = record.ExifDirectory.FilePath.Id is null || ids.Contains(record.ExifDirectory.FilePath.Id.Value) ? "_ Exists _" : "_ New-Destination _";
string makerSplit = string.IsNullOrEmpty(maker) ? string.IsNullOrEmpty(appSettings.RenameSettings.DefaultMaker) ? string.Empty : appSettings.RenameSettings.DefaultMaker : $" {maker.Split(' ')[0]}";
if (!string.IsNullOrEmpty(splat) || isWrongYear is null || isWrongYear.Value || appSettings.RenameSettings.DirectoryDictionary.Count < 2)
directoryName = GetDirectoryName(year, tfw, segments[0], splat, seasonValue, seasonName, makerSplit);
else
{
directoryName = record.DateTime.ToString("yyyy-MM-dd");
if (appSettings.RenameSettings.DirectoryDictionary.TryGetValue(directoryName, out string? value) && !string.IsNullOrEmpty(value))
directoryName = value;
}
string directoryName = GetDirectoryName(year, tfw, segments[0], splat, seasonValue, seasonName, makerSplit);
result = Path.GetFullPath(Path.Combine(rootDirectory, contains, directoryName));
}
}

8
Scripts/lsblk.ts Normal file
View File

@ -0,0 +1,8 @@
fetch('https://html.affirm.duckdns.org/lsblk.json')
.then((res:any) => res.text())
.then((text:any) => {
const data = JSON.parse(text);
console.log(data);
})
.catch((e:any) => console.error(e));

115
Scripts/podman.ts Normal file
View File

@ -0,0 +1,115 @@
const server = 'jmlc';
let debug: Array<string> = [];
let warning: Array<string> = [];
let volumes: Array<string> = [];
let volumeExportLines: Array<string> = [];
const pathA = 'L:/Git/AA/.vscode/helper/podman.txt';
await fetch(`https://html.${server}.duckdns.org/root.txt`)
.then((res: any) => res.text())
.then((text: any) => {
const lines = text.trim().split('\n');
for (let index = 0; index < lines.length; index++) {
const element = lines[index];
if (element == undefined || element.length === 0 || element[0] === '#' || !element.includes('podman volume export')) {
continue;
}
volumeExportLines.push(`${server}: root: ${element}`);
debug.push(`${server}: volume [${element}] is exported.`);
}
})
.catch((e: any) => console.error(e));
await fetch(`https://html.${server}.duckdns.org/podman.txt`)
.then((res: any) => res.text())
.then((text: any) => {
const lines = text.trim().split('\n');
for (let index = 0; index < lines.length; index++) {
const element = lines[index];
if (element == undefined || element.length === 0 || element[0] === '#' || !element.includes('podman volume export')) {
continue;
}
volumeExportLines.push(`${server}: podman: ${element}`);
debug.push(`${server}: volume [${element}] is exported.`);
}
})
.catch((e: any) => console.error(e));
await fetch(`https://html.${server}.duckdns.org/images-dangling-false.jsonl`)
.then((res: any) => res.text())
.then((text: any) => {
const json = '[' + text.trim().split('\n').join(',') + ']';
const data = JSON.parse(json);
for (let index = 0; index < data.length; index++) {
const element = data[index];
debug.push(`${server}: image ${element.Name} is in use.`);
}
})
.catch((e: any) => console.error(e));
await fetch(`https://html.${server}.duckdns.org/volumes-dangling-false.jsonl`)
.then((res: any) => res.text())
.then((text: any) => {
const json = '[' + text.trim().split('\n').join(',') + ']';
const data = JSON.parse(json);
for (let index = 0; index < data.length; index++) {
const element = data[index];
volumes.push(element.Name);
debug.push(`${server}: volume [${element.Name}] is in use.`);
}
})
.catch((e: any) => console.error(e));
await fetch(`https://html.${server}.duckdns.org/containers.jsonl`)
.then((res: any) => res.text())
.then((text: any) => {
const json = '[' + text.trim().split('\n').join(',') + ']';
const data = JSON.parse(json);
for (let index = 0; index < data.length; index++) {
const element = data[index];
debug.push(`${server}: container [${element.Name}] is in use.`);
}
})
.catch((e: any) => console.error(e));
for (let index = 0; index < volumes.length; index++) {
let check: boolean = false;
const volumeExportLine: string | any = volumes[index];
volumeExportLines.forEach(element => {
if (element.includes(volumeExportLine)) {
check = true;
}
});
if (check) {
debug.push(`${server}: volume [${volumes[index]}] is being exported.`);
}
else {
warning.push(`${server}: ## 11 * * * podman volume export ${volumes[index]} --output /home/podman/cron-backup/${server}-${volumes[index]}-$(date +"\%Y-\%m-\%d--\%H-\%M-\%S").tar`);
}
}
await fetch(`https://html.${server}.duckdns.org/volumes-dangling-true.jsonl`)
.then((res: any) => res.text())
.then((text: any) => {
const json = '[' + text.trim().split('\n').join(',') + ']';
const data = JSON.parse(json);
for (let index = 0; index < data.length; index++) {
const element = data[index];
debug.push(`${server}: podman volume rm ${element.Name}`);
}
})
.catch((e: any) => console.error(e));
await fetch(`https://html.${server}.duckdns.org/images-dangling-true.jsonl`)
.then((res: any) => res.text())
.then((text: any) => {
const json = '[' + text.trim().split('\n').join(',') + ']';
const data = JSON.parse(json);
for (let index = 0; index < data.length; index++) {
const element = data[index];
debug.push(`${server}: podman image rm ${element.ID}`);
}
})
.catch((e: any) => console.error(e));
await Bun.write(pathA, `${debug.join('\n')}\n${warning.join('\n')}`);

View File

@ -3,14 +3,14 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember142023>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1699920000)), 3600))))</HoursSinceNovember142023>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.Shared</PackageId>
<Version>8.0.118.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1699920000)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -39,7 +39,4 @@
<ItemGroup>
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="9.0.3" />
</ItemGroup>
</Project>

View File

@ -4,15 +4,15 @@
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<UserSecretsId>076c87e8-c7f0-40a3-aba3-73eb7f9ea892</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<HoursSinceNovember122024>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</HoursSinceNovember122024>
<HoursSinceNovember112025>$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</HoursSinceNovember112025>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Windows</PackageId>
<Version>9.0.104.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1731369600)), 3600))))</Version>
<Version>10.0.100.$([System.Math]::Floor($([MSBuild]::Divide($([MSBuild]::Subtract($([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()), 1762819200)), 3600))))</Version>
<Company>Phares</Company>
<Authors>Mike Phares</Authors>
<IncludeSymbols>true</IncludeSymbols>
@ -42,13 +42,13 @@
<None Include=".vscode\read-me.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.8.2" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="CliWrap" Version="3.9.0" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.14" />
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />

View File

@ -171,19 +171,24 @@ public partial class Windows : IWindows, IDisposable
long epoch = new DateTime(1970, 1, 1).Ticks;
long net8ReleaseDate = new DateTime(2023, 11, 14).Ticks;
long net9ReleaseDate = new DateTime(2024, 11, 12).Ticks;
long net10ReleaseDate = new DateTime(2026, 01, 01).Ticks;
long net10ReleaseDate = new DateTime(2025, 11, 11).Ticks;
long net11ReleaseDate = new DateTime(2026, 11, 11).Ticks;
double net8TotalSeconds = new TimeSpan(net8ReleaseDate - epoch).TotalSeconds;
double net9TotalSeconds = new TimeSpan(net9ReleaseDate - epoch).TotalSeconds;
double net10TotalSeconds = new TimeSpan(net10ReleaseDate - epoch).TotalSeconds;
double net11TotalSeconds = new TimeSpan(net11ReleaseDate - epoch).TotalSeconds;
logger?.LogInformation("It has been {net8TotalSeconds} seconds since net8 was released", net8TotalSeconds);
logger?.LogInformation("It has been {net9TotalSeconds} seconds since net9 was released", net9TotalSeconds);
logger?.LogInformation("It has been {net10TotalSeconds} seconds since net10 was released", net10TotalSeconds);
logger?.LogInformation("It has been {net11TotalSeconds} seconds since net11 was released", net11TotalSeconds);
double net8TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net8TotalSeconds) / secondsInAHour);
double net9TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net9TotalSeconds) / secondsInAHour);
double net10TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net10TotalSeconds) / secondsInAHour);
double net11TotalHours = Math.Floor((DateTimeOffset.UtcNow.ToUnixTimeSeconds() - net11TotalSeconds) / secondsInAHour);
logger?.LogInformation("It has been {net8TotalHours} hours since net8 was released", net8TotalHours);
logger?.LogInformation("It has been {net9TotalHours} hours since net9 was released", net9TotalHours);
logger?.LogInformation("It has been {net10TotalHours} hours since net10 was released", net10TotalHours);
logger?.LogInformation("It has been {net11TotalHours} hours since net11 was released", net11TotalHours);
}
private void WindowsWork(ILogger<Program>? logger, AppSettings appSettings, IWindows windows)

View File

@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestMinor",
"version": "9.0.0"
"version": "10.0.100"
}
}

View File

@ -1,15 +1,15 @@
{
"name": "adaptation",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
},
"scripts": {
"garbage-collect": "git gc"
}
}
"name": "adaptation",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
},
"scripts": {
"garbage-collect": "git gc"
}
}

View File

@ -1,7 +1,7 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"lib": ["dom", "ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",