net7.0
This commit is contained in:
parent
c6aa7e8e3c
commit
3b988ba152
@ -81,8 +81,12 @@ dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array al
|
|||||||
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.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.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary using System.Text;
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
|
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||||
|
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||||
|
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_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
|
||||||
@ -215,7 +219,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
|
||||||
|
27
.txt
27
.txt
@ -1,13 +1,14 @@
|
|||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Compare" "L:\Git\View-by-Distance\Compare"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Compare" -Target "L:\Git\View-by-Distance\Compare"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Date-Group" "L:\Git\View-by-Distance\Date-Group"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Date-Group" -Target "L:\Git\View-by-Distance\Date-Group"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Distance" "L:\Git\View-by-Distance\Distance"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Distance" -Target "L:\Git\View-by-Distance\Distance"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Face" "L:\Git\View-by-Distance\Face"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Face" -Target "L:\Git\View-by-Distance\Face"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\FaceParts" "L:\Git\View-by-Distance\FaceParts"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\FaceParts" -Target "L:\Git\View-by-Distance\FaceParts"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Instance" "L:\Git\View-by-Distance\Instance"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Instance" -Target "L:\Git\View-by-Distance\Instance"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Metadata" "L:\Git\View-by-Distance\Metadata"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Metadata" -Target "L:\Git\View-by-Distance\Metadata"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Not-Copy-Copy" "L:\Git\View-by-Distance\Not-Copy-Copy"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Not-Copy-Copy" -Target "L:\Git\View-by-Distance\Not-Copy-Copy"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\PrepareForOld" "L:\Git\View-by-Distance\PrepareForOld"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\PrepareForOld" -Target "L:\Git\View-by-Distance\PrepareForOld"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Property" "L:\Git\View-by-Distance\Property"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Property" -Target "L:\Git\View-by-Distance\Property"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Property-Compare" "L:\Git\View-by-Distance\Property-Compare"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Property-Compare" -Target "L:\Git\View-by-Distance\Property-Compare"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Resize" "L:\Git\View-by-Distance\Resize"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Resize" -Target "L:\Git\View-by-Distance\Resize"
|
||||||
mklink /J "L:\Git\View-by-Distance-MKLink-Console\Shared" "L:\Git\View-by-Distance\Shared"
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Shared" -Target "L:\Git\View-by-Distance\Shared"
|
||||||
|
New-Item -ItemType "junction" -Path "L:\Git\View-by-Distance-MKLink-Console\Rename" -Target "L:\Git\View-by-Distance\Rename"
|
||||||
|
52
.vscode/launch.json
vendored
52
.vscode/launch.json
vendored
@ -10,12 +10,12 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"programC": "${workspaceFolder}/Compare/bin/Debug/net6.0/win-x64/Compare.dll",
|
"programC": "${workspaceFolder}/Compare/bin/Debug/net7.0/win-x64/Compare.dll",
|
||||||
"programD": "${workspaceFolder}/Date-Group/bin/Debug/net6.0/win-x64/Date-Group.dll",
|
"programD": "${workspaceFolder}/Date-Group/bin/Debug/net7.0/win-x64/Date-Group.dll",
|
||||||
"programDD": "${workspaceFolder}/Drag-Drop/bin/Debug/net6.0-windows/win-x64/Drag-Drop.dll",
|
"programDD": "${workspaceFolder}/Drag-Drop/bin/Debug/net7.0-windows/win-x64/Drag-Drop.dll",
|
||||||
"program": "${workspaceFolder}/Instance/bin/Debug/net6.0/win-x64/Instance.dll",
|
"program": "${workspaceFolder}/Instance/bin/Debug/net7.0/win-x64/Instance.dll",
|
||||||
"programN": "${workspaceFolder}/Not-Copy-Copy/bin/Debug/net6.0/win-x64/Not-Copy-Copy.dll",
|
"programN": "${workspaceFolder}/Not-Copy-Copy/bin/Debug/net7.0/win-x64/Not-Copy-Copy.dll",
|
||||||
"programP": "${workspaceFolder}/PrepareForOld/bin/Debug/net6.0/win-x64/PrepareForOld.dll",
|
"programP": "${workspaceFolder}/PrepareForOld/bin/Debug/net7.0/win-x64/PrepareForOld.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
@ -146,4 +146,42 @@
|
|||||||
// https://scontent-lax3-2.xx.fbcdn.net/v/t39.30808-6/280689051_10209840036394561_8737214584492733274_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=8bfeb9&_nc_ohc=iMAAHqNekCgAX8fvEAm&_nc_ht=scontent-lax3-2.xx&oh=00_AT8b7_ODsDN7lNgTKr7JZiUE65R7WWYxENl1vOUGeobpBw&oe=6336E678
|
// https://scontent-lax3-2.xx.fbcdn.net/v/t39.30808-6/280689051_10209840036394561_8737214584492733274_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=8bfeb9&_nc_ohc=iMAAHqNekCgAX8fvEAm&_nc_ht=scontent-lax3-2.xx&oh=00_AT8b7_ODsDN7lNgTKr7JZiUE65R7WWYxENl1vOUGeobpBw&oe=6336E678
|
||||||
// https://scontent-lax3-1.xx.fbcdn.net/v/t1.18169-9/25110_107749419250772_1842086_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=09cbfe&_nc_ohc=xPyRCvImlaoAX9Z_UTs&_nc_ht=scontent-lax3-1.xx&oh=00_AT85xffhHDJlhzyFTBvWs8j3Gd4GyDCte_Pnd7hNM006sw&oe=635880C2
|
// https://scontent-lax3-1.xx.fbcdn.net/v/t1.18169-9/25110_107749419250772_1842086_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=09cbfe&_nc_ohc=xPyRCvImlaoAX9Z_UTs&_nc_ht=scontent-lax3-1.xx&oh=00_AT85xffhHDJlhzyFTBvWs8j3Gd4GyDCte_Pnd7hNM006sw&oe=635880C2
|
||||||
// https://scontent-lax3-2.xx.fbcdn.net/v/t1.18169-9/10259940_10153561109653458_6837681277740526675_n.jpg?_nc_cat=100&ccb=1-7&_nc_sid=8bfeb9&_nc_ohc=T1v9Wfqz8rUAX8y6bxq&tn=D0unuoVdv--xjhpM&_nc_ht=scontent-lax3-2.xx&oh=00_AT9Y9j5s19n0EzgO_dZMom8tAweFYIrJLOEsrsr4HAWHkQ&oe=63588CAE
|
// https://scontent-lax3-2.xx.fbcdn.net/v/t1.18169-9/10259940_10153561109653458_6837681277740526675_n.jpg?_nc_cat=100&ccb=1-7&_nc_sid=8bfeb9&_nc_ohc=T1v9Wfqz8rUAX8y6bxq&tn=D0unuoVdv--xjhpM&_nc_ht=scontent-lax3-2.xx&oh=00_AT9Y9j5s19n0EzgO_dZMom8tAweFYIrJLOEsrsr4HAWHkQ&oe=63588CAE
|
||||||
// https://scontent-lax3-1.xx.fbcdn.net/v/t31.18172-8/17621858_10154253751886426_3939148233753829194_o.jpg?_nc_cat=104&ccb=1-7&_nc_sid=ad2b24&_nc_ohc=yMOqJQQBV80AX8Xlzr-&_nc_ht=scontent-lax3-1.xx&oh=00_AT_z0oeHJ0fqKhVA4WdgGE2cZSgL0bIKNXzPsY0zeLipAg&oe=6356AF4C
|
// https://scontent-lax3-1.xx.fbcdn.net/v/t31.18172-8/17621858_10154253751886426_3939148233753829194_o.jpg?_nc_cat=104&ccb=1-7&_nc_sid=ad2b24&_nc_ohc=yMOqJQQBV80AX8Xlzr-&_nc_ht=scontent-lax3-1.xx&oh=00_AT_z0oeHJ0fqKhVA4WdgGE2cZSgL0bIKNXzPsY0zeLipAg&oe=6356AF4C
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-19 12.00.31.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-20 15.41.37.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-23 09.57.51.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-25 13.46.09.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-30 21.47.53.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-10-31 11.33.13.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-11-05 10.28.25.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-11-11 19.57.27.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-11-12 14.15.39.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-11-13 09.49.09.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-11-15 08.55.19.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-12-01 18.03.13.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-12-04 08.44.23.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-12-10 21.20.31.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2012\2012-12-16 18.17.53.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130317_113053.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130324_133916.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130330_114757.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130418_175845.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130418_175934.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130424_202523.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130424_202634.jpg>
|
||||||
|
// FileSizeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130514_190936.jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130516_104450.jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Kristy Google Photos from 2013\IMG_20130522_193539.jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (160).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (213).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (215).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (218).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (225).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (226).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (231).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (232).jpg>
|
||||||
|
// LastWriteTimeChanged <F:\Tmp\Phares\Compare\Images 2022-11-12 - c6aa7e8 - III\Herman Family Reunion 2008\Herman Family Reunion (234).jpg>
|
||||||
|
// - Device Videos 2_0_0_3 - Current - Kristy Google
|
||||||
|
// - Device Videos 2_0_0_3 - Current - Mike Google
|
||||||
|
// - Device Videos 2_0_0_3 - Current - Tracy
|
||||||
|
// Chester & Linores ?Pearson?
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Compare</PackageId>
|
<PackageId>Phares.View.by.Distance.Compare</PackageId>
|
||||||
@ -34,22 +34,18 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="WindowsShortcutFactory" Version="1.0.1" />
|
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Map\Map.csproj" />
|
<ProjectReference Include="..\Map\Map.csproj" />
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public abstract class Configuration
|
|||||||
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
||||||
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
||||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||||
Binder.Configuration configuration = configurationSection.Get<Binder.Configuration>();
|
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
||||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
||||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
||||||
if (result is null)
|
if (result is null)
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
"/zzz Phares Slides/Slides 2015-06-10/Magazine 01"
|
"/zzz Phares Slides/Slides 2015-06-10/Magazine 01"
|
||||||
],
|
],
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"DiffPropertyDirectory": "",
|
"DiffPropertyDirectory": "",
|
||||||
"FileNameDirectorySeparator": ".Z.",
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
@ -87,20 +87,20 @@
|
|||||||
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
||||||
"PopulatePropertyId": true,
|
"PopulatePropertyId": true,
|
||||||
"PropertiesChangedForProperty": false,
|
"PropertiesChangedForProperty": false,
|
||||||
"RootDirectory": "C:/Tmp/Phares/Compare/Images 2022-10-23 - 239acf2 - III",
|
"RootDirectory": "C:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III",
|
||||||
"WriteBitmapDataBytes": false,
|
"WriteBitmapDataBytes": false,
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
".gif",
|
".gif",
|
||||||
".GIF"
|
".GIF"
|
||||||
],
|
],
|
||||||
"PropertyContentCollectionFiles": [
|
"PropertyContentCollectionFiles": [
|
||||||
"/Images 2022-10-23 - 239acf2 - III - Results/A) Property/2022-10-23/[()]/637869381676042455.json",
|
"/Images 2022-11-12 - c6aa7e8 - III - Results/A) Property/2022-11-12/[()]/637869381676042455.json",
|
||||||
"/Not-Copy-Copy/Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869733124119330.json",
|
"/Not-Copy-Copy/Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869733124119330.json",
|
||||||
"/Not-Copy-Copy/Images 2018-12-25 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869734240700328.json",
|
"/Not-Copy-Copy/Images 2018-12-25 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869734240700328.json",
|
||||||
"/Not-Copy-Copy/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869734970730630.json",
|
"/Not-Copy-Copy/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869734970730630.json",
|
||||||
"/Not-Copy-Copy/Images 2013-12-15 - d02c8791fa0b130c0bce2d39ee684e50f7ee7a97 - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869743752078399.json",
|
"/Not-Copy-Copy/Images 2013-12-15 - d02c8791fa0b130c0bce2d39ee684e50f7ee7a97 - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869743752078399.json",
|
||||||
"/Not-Copy-Copy - Delta/Amazon Drive - Results/A) Property/2022-10-23/[()]/637869744751177715.json",
|
"/Not-Copy-Copy - Delta/Amazon Drive - Results/A) Property/2022-11-12/[()]/637869744751177715.json",
|
||||||
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-10-23/[()]/637869745134124462.json"
|
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-11-12/[()]/637869745134124462.json"
|
||||||
],
|
],
|
||||||
"ValidImageFormatExtensions": [
|
"ValidImageFormatExtensions": [
|
||||||
".bmp",
|
".bmp",
|
||||||
@ -119,8 +119,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"WorkingDirectoryName": "PharesApps",
|
"WorkingDirectoryName": "PharesApps",
|
||||||
"Windows": {
|
"Windows": {
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"DiffPropertyDirectory": "",
|
"DiffPropertyDirectory": "",
|
||||||
"FileNameDirectorySeparator": ".Z.",
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
@ -94,13 +94,13 @@
|
|||||||
".GIF"
|
".GIF"
|
||||||
],
|
],
|
||||||
"PropertyContentCollectionFiles": [
|
"PropertyContentCollectionFiles": [
|
||||||
"/Images 2022-10-23 - 239acf2 - III - Results/A) Property/2022-10-23/[()]/637869381676042455.json",
|
"/Images 2022-11-12 - c6aa7e8 - III - Results/A) Property/2022-11-12/[()]/637869381676042455.json",
|
||||||
"/Not-Copy-Copy/Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869733124119330.json",
|
"/Not-Copy-Copy/Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869733124119330.json",
|
||||||
"/Not-Copy-Copy/Images 2018-12-25 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869734240700328.json",
|
"/Not-Copy-Copy/Images 2018-12-25 - 34a9240ac28b52da97428d7725153a80a757ee6b - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869734240700328.json",
|
||||||
"/Not-Copy-Copy/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869734970730630.json",
|
"/Not-Copy-Copy/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869734970730630.json",
|
||||||
"/Not-Copy-Copy/Images 2013-12-15 - d02c8791fa0b130c0bce2d39ee684e50f7ee7a97 - Not-Copy-Copy - Results/A) Property/2022-10-23/[()]/637869743752078399.json",
|
"/Not-Copy-Copy/Images 2013-12-15 - d02c8791fa0b130c0bce2d39ee684e50f7ee7a97 - Not-Copy-Copy - Results/A) Property/2022-11-12/[()]/637869743752078399.json",
|
||||||
"/Not-Copy-Copy - Delta/Amazon Drive - Results/A) Property/2022-10-23/[()]/637869744751177715.json",
|
"/Not-Copy-Copy - Delta/Amazon Drive - Results/A) Property/2022-11-12/[()]/637869744751177715.json",
|
||||||
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-10-23/[()]/637869745134124462.json"
|
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-11-12/[()]/637869745134124462.json"
|
||||||
],
|
],
|
||||||
"ValidImageFormatExtensions": [
|
"ValidImageFormatExtensions": [
|
||||||
".bmp",
|
".bmp",
|
||||||
@ -119,8 +119,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Date.Group</PackageId>
|
<PackageId>Phares.View.by.Distance.Date.Group</PackageId>
|
||||||
@ -34,23 +34,19 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<ItemGroup>
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="WindowsShortcutFactory" Version="1.0.1" />
|
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -37,15 +37,11 @@ public class DateGroup
|
|||||||
_FilePropertiesKeyValuePairs = new Dictionary<string, List<Tuple<string, Shared.Models.Property>>>();
|
_FilePropertiesKeyValuePairs = new Dictionary<string, List<Tuple<string, Shared.Models.Property>>>();
|
||||||
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
||||||
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: true);
|
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: true);
|
||||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
Models.Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
|
||||||
Verify(configuration);
|
Verify(configuration);
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
_Configuration = configuration;
|
_Configuration = configuration;
|
||||||
string outputExtension = ".jpg";
|
string outputExtension = ".jpg";
|
||||||
if (configuration.ByHash is null)
|
|
||||||
throw new NullReferenceException(nameof(configuration.ByHash));
|
|
||||||
if (configuration.ByCreateDateShortcut is null)
|
|
||||||
throw new NullReferenceException(nameof(configuration.ByCreateDateShortcut));
|
|
||||||
if (!_IsEnvironment.Development)
|
if (!_IsEnvironment.Development)
|
||||||
throw new Exception("This program only allows development environments!");
|
throw new Exception("This program only allows development environments!");
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
@ -59,10 +55,70 @@ public class DateGroup
|
|||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
|
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
|
||||||
if (true || appSettings.MaxDegreeOfParallelism < 2)
|
if (true || appSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories));
|
ticks = LogDelta(ticks, nameof(Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories));
|
||||||
|
string destinationRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(propertyConfiguration, "Z) Moved");
|
||||||
|
// string[] moveBackFileNames = Directory.GetFiles(destinationRoot, "*", SearchOption.AllDirectories);
|
||||||
|
// if (moveBackFileNames is not null)
|
||||||
|
// {
|
||||||
|
// string checkFile;
|
||||||
|
// string? directory;
|
||||||
|
// bool check = false;
|
||||||
|
// string directoryName;
|
||||||
|
// string checkDirectory;
|
||||||
|
// string moveBackFileNameWithExtension;
|
||||||
|
// foreach (string moveBackFileName in moveBackFileNames)
|
||||||
|
// {
|
||||||
|
// moveBackFileNameWithExtension = Path.GetFileName(moveBackFileName);
|
||||||
|
// foreach ((int g, string sourceDirectory, string[] sourceDirectoryFiles) in jsonCollection)
|
||||||
|
// {
|
||||||
|
// foreach (string sourceDirectoryFile in sourceDirectoryFiles)
|
||||||
|
// {
|
||||||
|
// check = false;
|
||||||
|
// if (!sourceDirectoryFile.Contains(moveBackFileNameWithExtension))
|
||||||
|
// continue;
|
||||||
|
// directory = Path.GetDirectoryName(sourceDirectoryFile);
|
||||||
|
// if (directory is null)
|
||||||
|
// continue;
|
||||||
|
// directoryName = Path.GetFileName(directory);
|
||||||
|
// checkDirectory = Path.Combine(configuration.RootDirectory, directoryName);
|
||||||
|
// if (!Directory.Exists(checkDirectory))
|
||||||
|
// continue;
|
||||||
|
// checkFile = Path.Combine(checkDirectory, moveBackFileNameWithExtension);
|
||||||
|
// if (File.Exists(checkFile))
|
||||||
|
// continue;
|
||||||
|
// File.Move(moveBackFileName, checkFile);
|
||||||
|
// check = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if (check)
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if (!check)
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// // string destinationRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(propertyConfiguration, "Z) Moved");
|
||||||
|
// // for (int i = 1; i < 10; i++)
|
||||||
|
// // _ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(destinationRoot);
|
||||||
|
// }
|
||||||
|
// string[] moveBackFileNames = Directory.GetFiles(aPropertySingletonDirectory, "*.jpg", SearchOption.AllDirectories);
|
||||||
|
// foreach (string moveBackFileName in moveBackFileNames)
|
||||||
|
// {
|
||||||
|
// string? directory = Path.GetDirectoryName(moveBackFileName);
|
||||||
|
// if (directory is null)
|
||||||
|
// continue;
|
||||||
|
// string directoryName = Path.GetFileName(directory);
|
||||||
|
// string moveBackFileNameWithExtension = Path.GetFileName(moveBackFileName);
|
||||||
|
// string checkDirectory = Path.Combine(configuration.RootDirectory, directoryName);
|
||||||
|
// if (!Directory.Exists(checkDirectory))
|
||||||
|
// continue;
|
||||||
|
// string checkFile = Path.Combine(checkDirectory, moveBackFileNameWithExtension);
|
||||||
|
// if (File.Exists(checkFile))
|
||||||
|
// continue;
|
||||||
|
// File.Move(moveBackFileName, checkFile);
|
||||||
|
// }
|
||||||
(int j, int f, int t, Container[] containers) = Property.Models.Stateless.Container.GetContainers(propertyConfiguration, propertyLogic);
|
(int j, int f, int t, Container[] containers) = Property.Models.Stateless.Container.GetContainers(propertyConfiguration, propertyLogic);
|
||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (propertyConfiguration.PopulatePropertyId && (configuration.ByCreateDateShortcut.Value || configuration.ByHash.Value) && Shared.Models.Stateless.Methods.IProperty.Any(containers))
|
if (propertyConfiguration.PopulatePropertyId && (configuration.ByCreateDateShortcut || configuration.ByHash) && Shared.Models.Stateless.Methods.IProperty.Any(containers))
|
||||||
{
|
{
|
||||||
propertyLogic.SavePropertyParallelWork(ticks, containers);
|
propertyLogic.SavePropertyParallelWork(ticks, containers);
|
||||||
if (appSettings.MaxDegreeOfParallelism < 2)
|
if (appSettings.MaxDegreeOfParallelism < 2)
|
||||||
@ -70,35 +126,34 @@ public class DateGroup
|
|||||||
if (propertyLogic.ExceptionsDirectories.Any())
|
if (propertyLogic.ExceptionsDirectories.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
if (configuration.ByCreateDateShortcut.HasValue && configuration.ByCreateDateShortcut.Value)
|
if (configuration.ByCreateDateShortcut)
|
||||||
CreateDateShortcut(propertyConfiguration, containers);
|
CreateDateShortcut(propertyConfiguration, containers);
|
||||||
else
|
else
|
||||||
MoveFiles(propertyConfiguration, containers);
|
MoveFiles(propertyConfiguration, destinationRoot, containers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Verify(Models.Configuration configuration)
|
private static void Verify(Models.Configuration configuration)
|
||||||
{
|
{
|
||||||
if (configuration.ByCreateDateShortcut is null)
|
int check = 0;
|
||||||
throw new NullReferenceException(nameof(configuration.ByCreateDateShortcut));
|
if (configuration.ByCreateDateShortcut)
|
||||||
if (configuration.ByDay is null)
|
check += 1;
|
||||||
throw new NullReferenceException(nameof(configuration.ByDay));
|
if (configuration.ByDay)
|
||||||
if (configuration.ByHash is null)
|
check += 1;
|
||||||
throw new NullReferenceException(nameof(configuration.ByHash));
|
if (configuration.ByHash)
|
||||||
if (configuration.BySeason is null)
|
check += 1;
|
||||||
throw new NullReferenceException(nameof(configuration.BySeason));
|
if (configuration.ByNone)
|
||||||
if (configuration.ByWeek is null)
|
check += 1;
|
||||||
throw new NullReferenceException(nameof(configuration.ByWeek));
|
if (configuration.BySeason)
|
||||||
if (!configuration.ByCreateDateShortcut.Value && !configuration.ByDay.Value && !configuration.ByWeek.Value && !configuration.BySeason.Value && !configuration.ByHash.Value)
|
check += 1;
|
||||||
|
if (configuration.ByWeek)
|
||||||
|
check += 1;
|
||||||
|
if (check != 1)
|
||||||
throw new Exception("Change configuration!");
|
throw new Exception("Change configuration!");
|
||||||
if (configuration.KeepFullPath is null)
|
|
||||||
throw new NullReferenceException(nameof(configuration.KeepFullPath));
|
|
||||||
if (configuration?.PropertyConfiguration?.PopulatePropertyId is null)
|
if (configuration?.PropertyConfiguration?.PopulatePropertyId is null)
|
||||||
throw new NullReferenceException(nameof(configuration.PropertyConfiguration.PopulatePropertyId));
|
throw new NullReferenceException(nameof(configuration.PropertyConfiguration.PopulatePropertyId));
|
||||||
if (configuration.PropertyConfiguration.PopulatePropertyId && !configuration.ByCreateDateShortcut.Value && !configuration.ByHash.Value)
|
if (configuration.PropertyConfiguration.PopulatePropertyId && !configuration.ByCreateDateShortcut && !configuration.ByHash)
|
||||||
throw new Exception("Change configuration!");
|
throw new Exception("Change configuration!");
|
||||||
if (!configuration.PropertyConfiguration.PopulatePropertyId && configuration.ByHash.Value)
|
if (!configuration.PropertyConfiguration.PopulatePropertyId && configuration.ByHash)
|
||||||
throw new Exception("Change configuration!");
|
|
||||||
if (configuration.ByCreateDateShortcut.Value && configuration.ByDay.Value && configuration.ByWeek.Value && configuration.BySeason.Value && configuration.ByHash.Value)
|
|
||||||
throw new Exception("Change configuration!");
|
throw new Exception("Change configuration!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,18 +203,6 @@ public class DateGroup
|
|||||||
private List<(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)> GetMoveFileCollection(string destinationDirectory, string topDirectory, Item[] filteredItems)
|
private List<(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)> GetMoveFileCollection(string destinationDirectory, string topDirectory, Item[] filteredItems)
|
||||||
{
|
{
|
||||||
List<(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)> results = new();
|
List<(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)> results = new();
|
||||||
if (_Configuration.ByCreateDateShortcut is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.ByCreateDateShortcut));
|
|
||||||
if (_Configuration.ByDay is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.ByDay));
|
|
||||||
if (_Configuration.ByHash is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.ByHash));
|
|
||||||
if (_Configuration.BySeason is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.BySeason));
|
|
||||||
if (_Configuration.ByWeek is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.ByWeek));
|
|
||||||
if (_Configuration.KeepFullPath is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.KeepFullPath));
|
|
||||||
char flag;
|
char flag;
|
||||||
string day;
|
string day;
|
||||||
int season;
|
int season;
|
||||||
@ -213,11 +256,10 @@ public class DateGroup
|
|||||||
if (matches is not null && matches.Any())
|
if (matches is not null && matches.Any())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (matches is null)
|
matches ??= Array.Empty<string>();
|
||||||
matches = Array.Empty<string>();
|
|
||||||
foreach (Item item in filteredItems)
|
foreach (Item item in filteredItems)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null || item.Property is null || (_Configuration.PropertyConfiguration.PopulatePropertyId && item.Property.Id is null))
|
if (item.Property is null || (_Configuration.PropertyConfiguration.PopulatePropertyId && item.Property.Id is null))
|
||||||
continue;
|
continue;
|
||||||
directoryNames.Clear();
|
directoryNames.Clear();
|
||||||
destinationCollection = new();
|
destinationCollection = new();
|
||||||
@ -261,20 +303,23 @@ public class DateGroup
|
|||||||
}
|
}
|
||||||
topDirectoryName = Path.GetFileName(topDirectory);
|
topDirectoryName = Path.GetFileName(topDirectory);
|
||||||
weekOfYear = calendar.GetWeekOfYear(minimumDateTime.Value, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
weekOfYear = calendar.GetWeekOfYear(minimumDateTime.Value, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
if (_Configuration.ByHash.Value)
|
if (_Configuration.ByNone)
|
||||||
|
directoryNames.Clear();
|
||||||
|
else if (_Configuration.ByHash)
|
||||||
directoryNames.Add($"{year} {seasonName}");
|
directoryNames.Add($"{year} {seasonName}");
|
||||||
else if (_Configuration.BySeason.Value && topDirectoryName.Length == 1 && topDirectoryName[0] == '_')
|
else if (_Configuration.BySeason && topDirectoryName.Length == 1 && topDirectoryName[0] == '_')
|
||||||
directoryNames.Add($"{year} {seasonName}");
|
directoryNames.Add($"{year} {seasonName}");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!_Configuration.KeepFullPath.Value)
|
if (!_Configuration.KeepFullPath)
|
||||||
{
|
{
|
||||||
_ = destinationDirectoryName.Append(topDirectoryName);
|
if (topDirectoryName.Length > 1)
|
||||||
if (_Configuration.BySeason.Value)
|
_ = destinationDirectoryName.Append(topDirectoryName);
|
||||||
|
if (_Configuration.BySeason)
|
||||||
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year} {seasonName}" });
|
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year} {seasonName}" });
|
||||||
else if (_Configuration.ByDay.Value)
|
else if (_Configuration.ByDay)
|
||||||
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year}", $"{weekOfYear}) {year}-{day}" });
|
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year}", $"{weekOfYear}) {year}-{day}" });
|
||||||
else if (_Configuration.ByWeek.Value)
|
else if (_Configuration.ByWeek)
|
||||||
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year}", $"{weekOfYear}) {year} {month}" });
|
directoryNames.AddRange(new string[] { $"{destinationDirectoryName} {year}", $"{weekOfYear}) {year} {month}" });
|
||||||
else
|
else
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
@ -288,17 +333,17 @@ public class DateGroup
|
|||||||
else
|
else
|
||||||
_ = destinationDirectoryName.Append(sourceDirectoryNameSegment);
|
_ = destinationDirectoryName.Append(sourceDirectoryNameSegment);
|
||||||
}
|
}
|
||||||
if (_Configuration.BySeason.Value)
|
if (_Configuration.BySeason)
|
||||||
directoryNames.Add($"{year} {seasonName}");
|
directoryNames.Add($"{year} {seasonName}");
|
||||||
else if (_Configuration.ByDay.Value)
|
else if (_Configuration.ByDay)
|
||||||
directoryNames.Add($"{weekOfYear}) {year} {day}");
|
directoryNames.Add($"{weekOfYear}) {year} {day}");
|
||||||
else if (_Configuration.ByWeek.Value)
|
else if (_Configuration.ByWeek)
|
||||||
directoryNames.Add($"{weekOfYear}) {month} {year}");
|
directoryNames.Add($"{weekOfYear}) {month} {year}");
|
||||||
else
|
else
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_Configuration.ByHash.Value || item.Property.Id is null)
|
if (!_Configuration.ByHash || item.Property.Id is null)
|
||||||
fileName = item.ImageFileHolder.Name;
|
fileName = item.ImageFileHolder.Name;
|
||||||
else
|
else
|
||||||
fileName = $"{item.Property.Id.Value}{item.ImageFileHolder.ExtensionLowered}";
|
fileName = $"{item.Property.Id.Value}{item.ImageFileHolder.ExtensionLowered}";
|
||||||
@ -325,18 +370,15 @@ public class DateGroup
|
|||||||
foreach (Item item in container.Items)
|
foreach (Item item in container.Items)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is not null
|
if (item.ImageFileHolder is not null
|
||||||
&& (item.Abandoned is null || !item.Abandoned.Value)
|
&& (item.Abandoned is null || !item.Abandoned.Value))
|
||||||
&& item.ValidImageFormatExtension)
|
|
||||||
results.Add(item);
|
results.Add(item);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private (Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] GetFileMoveCollectionAll(Property.Models.Configuration configuration, Container[] containers, string destinationRoot)
|
private (Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] GetFileMoveCollectionAll(Property.Models.Configuration configuration, string destinationRoot, Container[] containers)
|
||||||
{
|
{
|
||||||
(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] results;
|
(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] results;
|
||||||
if (_Configuration.KeepFullPath is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.KeepFullPath));
|
|
||||||
string? topDirectory;
|
string? topDirectory;
|
||||||
string? checkDirectory;
|
string? checkDirectory;
|
||||||
string destinationDirectory;
|
string destinationDirectory;
|
||||||
@ -347,7 +389,7 @@ public class DateGroup
|
|||||||
{
|
{
|
||||||
if (!container.Items.Any())
|
if (!container.Items.Any())
|
||||||
continue;
|
continue;
|
||||||
if (!_Configuration.KeepFullPath.Value)
|
if (!_Configuration.KeepFullPath)
|
||||||
destinationDirectory = destinationRoot;
|
destinationDirectory = destinationRoot;
|
||||||
else
|
else
|
||||||
destinationDirectory = string.Concat(destinationRoot, container.SourceDirectory[configuration.RootDirectory.Length..]);
|
destinationDirectory = string.Concat(destinationRoot, container.SourceDirectory[configuration.RootDirectory.Length..]);
|
||||||
@ -373,12 +415,10 @@ public class DateGroup
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveFiles(Property.Models.Configuration configuration, Container[] containers)
|
private void MoveFiles(Property.Models.Configuration configuration, string destinationRoot, Container[] containers)
|
||||||
{
|
{
|
||||||
if (_Log is null)
|
if (_Log is null)
|
||||||
throw new NullReferenceException(nameof(_Log));
|
throw new NullReferenceException(nameof(_Log));
|
||||||
if (_Configuration.ByHash is null)
|
|
||||||
throw new NullReferenceException(nameof(_Configuration.ByHash));
|
|
||||||
bool hasDuplicate;
|
bool hasDuplicate;
|
||||||
string fullFileName;
|
string fullFileName;
|
||||||
string directoryName;
|
string directoryName;
|
||||||
@ -387,12 +427,9 @@ public class DateGroup
|
|||||||
List<string> filesDistinct = new();
|
List<string> filesDistinct = new();
|
||||||
List<string> filesDuplicate = new();
|
List<string> filesDuplicate = new();
|
||||||
List<string> directoriesDistinct = new();
|
List<string> directoriesDistinct = new();
|
||||||
string destinationRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(configuration, "Z) Moved");
|
(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] fileMoveCollectionAll = GetFileMoveCollectionAll(configuration, destinationRoot, containers);
|
||||||
(Item Item, long LastWriteTimeTicks, long MinimumDateTimeTicks, string[] Destination)[] fileMoveCollectionAll = GetFileMoveCollectionAll(configuration, containers, destinationRoot);
|
|
||||||
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
fullFileName = Path.Combine(destination);
|
fullFileName = Path.Combine(destination);
|
||||||
if (filesDistinct.Contains(fullFileName))
|
if (filesDistinct.Contains(fullFileName))
|
||||||
filesDuplicate.Add(fullFileName);
|
filesDuplicate.Add(fullFileName);
|
||||||
@ -403,13 +440,10 @@ public class DateGroup
|
|||||||
directoriesDistinct.Add(directoryName);
|
directoriesDistinct.Add(directoryName);
|
||||||
if (!Directory.Exists(directoryName))
|
if (!Directory.Exists(directoryName))
|
||||||
_ = Directory.CreateDirectory(directoryName);
|
_ = Directory.CreateDirectory(directoryName);
|
||||||
if (_Configuration.ByHash.Value)
|
if (!Directory.Exists(string.Concat(directoryName, duplicate, " I")))
|
||||||
{
|
_ = Directory.CreateDirectory(string.Concat(directoryName, duplicate, " I"));
|
||||||
if (!Directory.Exists(string.Concat(directoryName, duplicate, " I")))
|
if (!Directory.Exists(string.Concat(directoryName, duplicate, " II")))
|
||||||
_ = Directory.CreateDirectory(string.Concat(directoryName, duplicate, " I"));
|
_ = Directory.CreateDirectory(string.Concat(directoryName, duplicate, " II"));
|
||||||
if (!Directory.Exists(string.Concat(directoryName, duplicate, " II")))
|
|
||||||
_ = Directory.CreateDirectory(string.Concat(directoryName, duplicate, " II"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_Log.Information("Ready to move files?");
|
_Log.Information("Ready to move files?");
|
||||||
for (int y = 0; y < int.MaxValue; y++)
|
for (int y = 0; y < int.MaxValue; y++)
|
||||||
@ -422,8 +456,6 @@ public class DateGroup
|
|||||||
int moved = 0;
|
int moved = 0;
|
||||||
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
fullFileName = Path.Combine(destination);
|
fullFileName = Path.Combine(destination);
|
||||||
hasDuplicate = filesDuplicate.Contains(fullFileName);
|
hasDuplicate = filesDuplicate.Contains(fullFileName);
|
||||||
if (hasDuplicate)
|
if (hasDuplicate)
|
||||||
@ -431,10 +463,10 @@ public class DateGroup
|
|||||||
destination[1] = string.Concat(destination[1], duplicate, " I");
|
destination[1] = string.Concat(destination[1], duplicate, " I");
|
||||||
fullFileName = Path.Combine(destination);
|
fullFileName = Path.Combine(destination);
|
||||||
}
|
}
|
||||||
if (File.Exists(fullFileName))
|
for (int i = 0; i < 256 - destination[1].Length; i++)
|
||||||
{
|
{
|
||||||
if (!_Configuration.ByHash.Value)
|
if (!File.Exists(fullFileName))
|
||||||
continue;
|
break;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
destination[1] = string.Concat(destination[1], "I");
|
destination[1] = string.Concat(destination[1], "I");
|
||||||
@ -456,8 +488,7 @@ public class DateGroup
|
|||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_Configuration.ByHash.Value)
|
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(destinationRoot);
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(destinationRoot);
|
|
||||||
_Log.Information($"{moved} file(s) moved");
|
_Log.Information($"{moved} file(s) moved");
|
||||||
for (int y = 0; y < int.MaxValue; y++)
|
for (int y = 0; y < int.MaxValue; y++)
|
||||||
{
|
{
|
||||||
@ -468,8 +499,6 @@ public class DateGroup
|
|||||||
_Log.Information(". . .");
|
_Log.Information(". . .");
|
||||||
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
foreach ((Item item, long lastWriteTimeTicks, long minimumDateTimeTicks, string[] destination) in fileMoveCollectionAll)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
fullFileName = Path.Combine(destination);
|
fullFileName = Path.Combine(destination);
|
||||||
if (File.Exists(item.ImageFileHolder.FullName))
|
if (File.Exists(item.ImageFileHolder.FullName))
|
||||||
continue;
|
continue;
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Phares.Shared;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -11,6 +13,7 @@ public class Configuration
|
|||||||
[Display(Name = "By Create Date Shortcut"), Required] public bool? ByCreateDateShortcut { get; set; }
|
[Display(Name = "By Create Date Shortcut"), Required] public bool? ByCreateDateShortcut { get; set; }
|
||||||
[Display(Name = "By Date"), Required] public bool? ByDay { get; set; }
|
[Display(Name = "By Date"), Required] public bool? ByDay { get; set; }
|
||||||
[Display(Name = "By Hash"), Required] public bool? ByHash { get; set; }
|
[Display(Name = "By Hash"), Required] public bool? ByHash { get; set; }
|
||||||
|
[Display(Name = "By None"), Required] public bool? ByNone { get; set; }
|
||||||
[Display(Name = "By Season"), Required] public bool? BySeason { get; set; }
|
[Display(Name = "By Season"), Required] public bool? BySeason { get; set; }
|
||||||
[Display(Name = "By Week"), Required] public bool? ByWeek { get; set; }
|
[Display(Name = "By Week"), Required] public bool? ByWeek { get; set; }
|
||||||
[Display(Name = "Ignore Subdirectories for Rename"), Required] public bool? KeepFullPath { get; set; }
|
[Display(Name = "Ignore Subdirectories for Rename"), Required] public bool? KeepFullPath { get; set; }
|
||||||
@ -24,4 +27,47 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
|
{
|
||||||
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
|
if (configuration.ByCreateDateShortcut is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.ByCreateDateShortcut));
|
||||||
|
if (configuration.ByDay is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.ByDay));
|
||||||
|
if (configuration.ByHash is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.ByHash));
|
||||||
|
if (configuration.ByNone is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.ByNone));
|
||||||
|
if (configuration.BySeason is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.BySeason));
|
||||||
|
if (configuration.ByWeek is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.ByWeek));
|
||||||
|
if (configuration.KeepFullPath is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration.KeepFullPath));
|
||||||
|
result = new(configuration.PropertyConfiguration, configuration.ByCreateDateShortcut.Value, configuration.ByDay.Value, configuration.ByHash.Value, configuration.ByNone.Value, configuration.BySeason.Value, configuration.ByWeek.Value, configuration.KeepFullPath.Value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
||||||
|
{
|
||||||
|
Models.Configuration result;
|
||||||
|
Configuration? configuration;
|
||||||
|
if (isEnvironment is null)
|
||||||
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
||||||
|
string section = string.Concat(environmentName, ":", nameof(Configuration));
|
||||||
|
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||||
|
configuration = configurationSection.Get<Configuration>();
|
||||||
|
}
|
||||||
|
result = Get(configuration);
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
|
result.SetAndUpdate(propertyConfiguration, numberOfJitters: null, numberOfTimesToUpsample: null, modelName: null, predictorModelName: null);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,30 +6,27 @@ namespace View_by_Distance.Date.Group.Models;
|
|||||||
public class Configuration
|
public class Configuration
|
||||||
{
|
{
|
||||||
|
|
||||||
protected readonly bool? _ByCreateDateShortcut;
|
|
||||||
protected readonly bool? _ByDay;
|
|
||||||
protected readonly bool? _ByHash;
|
|
||||||
protected readonly bool? _BySeason;
|
|
||||||
protected readonly bool? _ByWeek;
|
|
||||||
protected readonly bool? _KeepFullPath;
|
|
||||||
protected Property.Models.Configuration _PropertyConfiguration;
|
protected Property.Models.Configuration _PropertyConfiguration;
|
||||||
public bool? ByCreateDateShortcut => _ByCreateDateShortcut;
|
|
||||||
public bool? ByDay => _ByDay;
|
|
||||||
public bool? ByHash => _ByHash;
|
|
||||||
public bool? BySeason => _BySeason;
|
|
||||||
public bool? ByWeek => _ByWeek;
|
|
||||||
public bool? KeepFullPath => _KeepFullPath;
|
|
||||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||||
|
|
||||||
|
public bool ByCreateDateShortcut { init; get; }
|
||||||
|
public bool ByDay { init; get; }
|
||||||
|
public bool ByHash { init; get; }
|
||||||
|
public bool ByNone { init; get; }
|
||||||
|
public bool BySeason { init; get; }
|
||||||
|
public bool ByWeek { init; get; }
|
||||||
|
public bool KeepFullPath { init; get; }
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Configuration(bool? byCreateDateShortcut, bool? byDay, bool? byHash, bool? bySeason, bool? byWeek, bool? keepFullPath, Property.Models.Configuration propertyConfiguration)
|
public Configuration(Property.Models.Configuration propertyConfiguration, bool byCreateDateShortcut, bool byDay, bool byHash, bool byNone, bool bySeason, bool byWeek, bool keepFullPath)
|
||||||
{
|
{
|
||||||
_ByCreateDateShortcut = byCreateDateShortcut;
|
ByDay = byDay;
|
||||||
_ByDay = byDay;
|
ByHash = byHash;
|
||||||
_ByHash = byHash;
|
ByNone = byNone;
|
||||||
_BySeason = bySeason;
|
ByWeek = byWeek;
|
||||||
_ByWeek = byWeek;
|
BySeason = bySeason;
|
||||||
_KeepFullPath = keepFullPath;
|
KeepFullPath = keepFullPath;
|
||||||
|
ByCreateDateShortcut = byCreateDateShortcut;
|
||||||
_PropertyConfiguration = propertyConfiguration;
|
_PropertyConfiguration = propertyConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Phares.Shared;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace View_by_Distance.Date.Group.Models.Stateless;
|
|
||||||
|
|
||||||
public abstract class Configuration
|
|
||||||
{
|
|
||||||
|
|
||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, string workingDirectory, Property.Models.Configuration propertyConfiguration)
|
|
||||||
{
|
|
||||||
Models.Configuration? result;
|
|
||||||
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
|
||||||
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
|
||||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
|
||||||
Binder.Configuration configuration = configurationSection.Get<Binder.Configuration>();
|
|
||||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
|
||||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
|
||||||
if (result is null)
|
|
||||||
throw new Exception(json);
|
|
||||||
string jsonThis = result.ToString();
|
|
||||||
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
|
|
||||||
if (jsonThis != json)
|
|
||||||
{
|
|
||||||
int? check = null;
|
|
||||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
|
||||||
for (int i = 0; i < min; i++)
|
|
||||||
{
|
|
||||||
if (json[i] == jsonThis[i])
|
|
||||||
continue;
|
|
||||||
check = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (check is null)
|
|
||||||
throw new Exception();
|
|
||||||
string a = json[..check.Value].Split(',')[^1];
|
|
||||||
string b = json[check.Value..].Split(',')[0];
|
|
||||||
throw new Exception($"{a}{b}");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -50,20 +50,29 @@
|
|||||||
"WorkingDirectoryName": "PharesApps",
|
"WorkingDirectoryName": "PharesApps",
|
||||||
"Windows": {
|
"Windows": {
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"ByCreateDateShortcut": true,
|
"ByCreateDateShortcut": false,
|
||||||
"ByDay": false,
|
"ByDay": false,
|
||||||
"ByHash": false,
|
"ByHash": false,
|
||||||
"BySeason": false,
|
"ByNone": false,
|
||||||
|
"BySeason": true,
|
||||||
"ByWeek": false,
|
"ByWeek": false,
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"FileNameDirectorySeparator": ".Z.",
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
"KeepFullPath": false,
|
"KeepFullPath": false,
|
||||||
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
||||||
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
||||||
"PopulatePropertyId": true,
|
"PopulatePropertyId": false,
|
||||||
"PropertiesChangedForProperty": false,
|
"PropertiesChangedForProperty": false,
|
||||||
"RootDirectory": "C:/Tmp/Phares/Compare/Images 2022-10-23 - 239acf2 - III",
|
"ResultAllInOne": "_ _ _",
|
||||||
|
"ResultCollection": "[]",
|
||||||
|
"ResultContent": "()",
|
||||||
|
"ResultSingleton": "{}",
|
||||||
|
"xRootDirectory": "C:/Tmp/phares/Pictures",
|
||||||
|
"xxRootDirectory": "C:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III",
|
||||||
|
"xxxRootDirectory": "F:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III",
|
||||||
|
"xxxxRootDirectory": "F:/Tmp/Phares/2022-11-03-DCIM/DCIM/100D3400 2022",
|
||||||
|
"RootDirectory": "F:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III/D",
|
||||||
"WriteBitmapDataBytes": false,
|
"WriteBitmapDataBytes": false,
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
".gif",
|
".gif",
|
||||||
@ -87,8 +96,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Distance</PackageId>
|
<PackageId>Phares.View.by.Distance.Distance</PackageId>
|
||||||
@ -34,14 +34,12 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.13.14" />
|
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="WindowsShortcutFactory" Version="1.0.1" />
|
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
||||||
|
@ -4,6 +4,7 @@ using View_by_Distance.FaceRecognitionDotNet;
|
|||||||
using View_by_Distance.Map.Models;
|
using View_by_Distance.Map.Models;
|
||||||
using View_by_Distance.Shared.Models;
|
using View_by_Distance.Shared.Models;
|
||||||
using View_by_Distance.Shared.Models.Properties;
|
using View_by_Distance.Shared.Models.Properties;
|
||||||
|
using WindowsShortcutFactory;
|
||||||
|
|
||||||
namespace View_by_Distance.Distance.Models;
|
namespace View_by_Distance.Distance.Models;
|
||||||
|
|
||||||
@ -354,4 +355,55 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool TryToFind(string a2PeopleSingletonDirectory, string file, string path)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
string? pathName = Path.GetFileName(path);
|
||||||
|
string? group = Path.GetDirectoryName(path);
|
||||||
|
string? groupName = Path.GetFileName(group);
|
||||||
|
if (pathName is not null && group is not null && groupName is not null)
|
||||||
|
{
|
||||||
|
WindowsShortcut windowsShortcut;
|
||||||
|
string checkDirectory = Path.Combine(a2PeopleSingletonDirectory, groupName, pathName);
|
||||||
|
if (Directory.Exists(checkDirectory))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
windowsShortcut = new() { Path = checkDirectory };
|
||||||
|
windowsShortcut.Save(file);
|
||||||
|
windowsShortcut.Dispose();
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void BeforeSaveResizedImagesByPersonKeyFormatted(string[] jLinks, string a2PeopleSingletonDirectory)
|
||||||
|
{
|
||||||
|
string[] files;
|
||||||
|
string checkDirectory;
|
||||||
|
WindowsShortcut windowsShortcut;
|
||||||
|
foreach (string directoryName in jLinks)
|
||||||
|
{
|
||||||
|
checkDirectory = Path.Combine(a2PeopleSingletonDirectory, directoryName);
|
||||||
|
if (!Directory.Exists(checkDirectory))
|
||||||
|
continue;
|
||||||
|
files = Directory.GetFiles(checkDirectory, "*.lnk", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
windowsShortcut = WindowsShortcut.Load(file);
|
||||||
|
if (windowsShortcut.Path is null)
|
||||||
|
continue;
|
||||||
|
if (!Directory.Exists(windowsShortcut.Path))
|
||||||
|
{
|
||||||
|
if (!TryToFind(a2PeopleSingletonDirectory, file, windowsShortcut.Path))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -26,14 +26,16 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.13.14" />
|
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
<PackageReference Include="Microsoft-WindowsAPICodePack-Core" Version="1.1.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.WindowsAPICodePack.Shell;
|
||||||
using Phares.Shared;
|
using Phares.Shared;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -15,7 +16,9 @@ public partial class Form : System.Windows.Forms.Form
|
|||||||
|
|
||||||
private readonly ILogger _Logger;
|
private readonly ILogger _Logger;
|
||||||
private readonly TextBox _TextBox;
|
private readonly TextBox _TextBox;
|
||||||
|
private readonly List<string> _Lines;
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings;
|
||||||
|
private readonly ProgressBar _ProgressBar;
|
||||||
private readonly string _WorkingDirectory;
|
private readonly string _WorkingDirectory;
|
||||||
private readonly Configuration _Configuration;
|
private readonly Configuration _Configuration;
|
||||||
private readonly IsEnvironment _IsEnvironment;
|
private readonly IsEnvironment _IsEnvironment;
|
||||||
@ -27,6 +30,7 @@ public partial class Form : System.Windows.Forms.Form
|
|||||||
public Form()
|
public Form()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_Lines = new();
|
||||||
ILogger logger;
|
ILogger logger;
|
||||||
AppSettings appSettings;
|
AppSettings appSettings;
|
||||||
string workingDirectory;
|
string workingDirectory;
|
||||||
@ -62,7 +66,9 @@ public partial class Form : System.Windows.Forms.Form
|
|||||||
_PropertyConfiguration = propertyConfiguration;
|
_PropertyConfiguration = propertyConfiguration;
|
||||||
_ResizeFileNameExtension = resizeFileNameExtension;
|
_ResizeFileNameExtension = resizeFileNameExtension;
|
||||||
_TextBox = new() { Location = new(5, 5), Dock = DockStyle.Top };
|
_TextBox = new() { Location = new(5, 5), Dock = DockStyle.Top };
|
||||||
|
_ProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false };
|
||||||
Load += new EventHandler(Form1_Load);
|
Load += new EventHandler(Form1_Load);
|
||||||
|
Controls.Add(_ProgressBar);
|
||||||
Controls.Add(_TextBox);
|
Controls.Add(_TextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,30 +76,23 @@ public partial class Form : System.Windows.Forms.Form
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int j;
|
|
||||||
int f;
|
|
||||||
int t;
|
|
||||||
AllowDrop = true;
|
AllowDrop = true;
|
||||||
Container[] containers;
|
|
||||||
DragDrop += new DragEventHandler(Form1_DragDrop);
|
DragDrop += new DragEventHandler(Form1_DragDrop);
|
||||||
DragEnter += new DragEventHandler(Form1_DragEnter);
|
DragEnter += new DragEventHandler(Form1_DragEnter);
|
||||||
Property.Models.A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _ResizeFileNameExtension, _Configuration.Reverse);
|
_TextBox.LostFocus += new EventHandler(TextBox_LostFocus);
|
||||||
(j, f, t, containers) = Property.Models.Stateless.Container.GetContainers(_Configuration.PropertyConfiguration, propertyLogic);
|
}
|
||||||
List<MappingFromItem> collection = Program.GetMappingFromItemCollection(_Configuration, containers);
|
catch (Exception)
|
||||||
foreach (MappingFromItem mappingFromItem in collection)
|
{
|
||||||
{
|
throw;
|
||||||
if (_IdToMappingFromItem.ContainsKey(mappingFromItem.Id))
|
}
|
||||||
continue;
|
}
|
||||||
_IdToMappingFromItem.Add(mappingFromItem.Id, mappingFromItem);
|
|
||||||
}
|
void TextBox_LostFocus(object? sender, EventArgs e)
|
||||||
if (_Logger is null)
|
{
|
||||||
throw new NullReferenceException(nameof(_Logger));
|
try
|
||||||
_Logger.Debug((_AppSettings is null).ToString());
|
{
|
||||||
_Logger.Debug((_Configuration is null).ToString());
|
if (_TextBox.Text == "ps")
|
||||||
_Logger.Debug((_IsEnvironment is null).ToString());
|
throw new NotImplementedException();
|
||||||
_Logger.Debug((_WorkingDirectory is null).ToString());
|
|
||||||
_Logger.Debug((_ConfigurationRoot is null).ToString());
|
|
||||||
_Logger.Debug((_PropertyConfiguration is null).ToString());
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -114,29 +113,166 @@ public partial class Form : System.Windows.Forms.Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadData()
|
||||||
|
{
|
||||||
|
Container[] containers;
|
||||||
|
Property.Models.A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _ResizeFileNameExtension, _Configuration.Reverse);
|
||||||
|
(_, _, _, containers) = Property.Models.Stateless.Container.GetContainers(_Configuration.PropertyConfiguration, propertyLogic);
|
||||||
|
List<MappingFromItem> collection = Program.GetMappingFromItemCollection(_Configuration, containers);
|
||||||
|
foreach (MappingFromItem mappingFromItem in collection)
|
||||||
|
{
|
||||||
|
if (_IdToMappingFromItem.ContainsKey(mappingFromItem.Id))
|
||||||
|
continue;
|
||||||
|
_IdToMappingFromItem.Add(mappingFromItem.Id, mappingFromItem);
|
||||||
|
}
|
||||||
|
if (_Logger is null)
|
||||||
|
throw new NullReferenceException(nameof(_Logger));
|
||||||
|
_Logger.Debug((_AppSettings is null).ToString());
|
||||||
|
_Logger.Debug((_Configuration is null).ToString());
|
||||||
|
_Logger.Debug((_IsEnvironment is null).ToString());
|
||||||
|
_Logger.Debug((_WorkingDirectory is null).ToString());
|
||||||
|
_Logger.Debug((_ConfigurationRoot is null).ToString());
|
||||||
|
_Logger.Debug((_PropertyConfiguration is null).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenameDirectory(string path, string searchPattern)
|
||||||
|
{
|
||||||
|
string[] directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string directory in directories)
|
||||||
|
RenameDirectory(directory, searchPattern);
|
||||||
|
int? id;
|
||||||
|
string? message;
|
||||||
|
string checkFile;
|
||||||
|
DateTime? dateTime;
|
||||||
|
FileHolder fileHolder;
|
||||||
|
_ProgressBar.Step = 1;
|
||||||
|
bool isIgnoreExtension;
|
||||||
|
_ProgressBar.Value = 0;
|
||||||
|
DateTime? minimumDateTime;
|
||||||
|
_ProgressBar.Visible = true;
|
||||||
|
bool isValidImageFormatExtension;
|
||||||
|
string? extraLargeBitmapThumbnail;
|
||||||
|
string[] files = Directory.GetFiles(path, searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
_ProgressBar.Maximum = files.Length;
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
fileHolder = new(file);
|
||||||
|
_Lines.Add(fileHolder.NameWithoutExtension);
|
||||||
|
isValidImageFormatExtension = _Configuration.PropertyConfiguration.ValidImageFormatExtensions.Contains(fileHolder.ExtensionLowered);
|
||||||
|
isIgnoreExtension = isValidImageFormatExtension && _Configuration.IgnoreExtensions.Contains(fileHolder.ExtensionLowered);
|
||||||
|
if (fileHolder.CreationTime is null || fileHolder.Name.Contains(fileHolder.CreationTime.Value.ToString("yy")))
|
||||||
|
continue;
|
||||||
|
if (fileHolder.LastWriteTime is null || fileHolder.Name.Contains(fileHolder.LastWriteTime.Value.ToString("yy")))
|
||||||
|
continue;
|
||||||
|
if (fileHolder.NameWithoutExtension.Length == 1 || fileHolder.NameWithoutExtension[1..].All(l => char.IsNumber(l)))
|
||||||
|
continue;
|
||||||
|
if (fileHolder.NameWithoutExtension.Length == 1 || fileHolder.NameWithoutExtension[1..].All(l => char.IsNumber(l)))
|
||||||
|
continue;
|
||||||
|
if (!isIgnoreExtension && isValidImageFormatExtension)
|
||||||
|
extraLargeBitmapThumbnail = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extraLargeBitmapThumbnail = SaveExtraLargeBitmapThumbnail(fileHolder);
|
||||||
|
if (extraLargeBitmapThumbnail is null)
|
||||||
|
continue;
|
||||||
|
fileHolder = new(extraLargeBitmapThumbnail);
|
||||||
|
isValidImageFormatExtension = _Configuration.PropertyConfiguration.ValidImageFormatExtensions.Contains(fileHolder.ExtensionLowered);
|
||||||
|
isIgnoreExtension = isValidImageFormatExtension && _Configuration.IgnoreExtensions.Contains(fileHolder.ExtensionLowered);
|
||||||
|
if (isIgnoreExtension || !isValidImageFormatExtension)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (fileHolder.DirectoryName is null)
|
||||||
|
continue;
|
||||||
|
dateTime = IProperty.GetDateTimeFromName(fileHolder);
|
||||||
|
if (dateTime is not null && fileHolder.Name.Contains(dateTime.Value.ToString("yy")))
|
||||||
|
continue;
|
||||||
|
(minimumDateTime, id, message) = IProperty.Get(fileHolder);
|
||||||
|
if (id is null)
|
||||||
|
continue;
|
||||||
|
if (minimumDateTime is not null && fileHolder.Name.Contains(minimumDateTime.Value.ToString("yy")))
|
||||||
|
continue;
|
||||||
|
if (dateTime is not null && minimumDateTime is not null && minimumDateTime.Value != dateTime.Value)
|
||||||
|
continue;
|
||||||
|
if (extraLargeBitmapThumbnail is not null)
|
||||||
|
{
|
||||||
|
File.Delete(fileHolder.FullName);
|
||||||
|
fileHolder = new(file);
|
||||||
|
if (fileHolder.DirectoryName is null)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
checkFile = Path.Combine(fileHolder.DirectoryName, $"{id}{fileHolder.ExtensionLowered}");
|
||||||
|
if (File.Exists(checkFile))
|
||||||
|
continue;
|
||||||
|
File.Move(fileHolder.FullName, checkFile);
|
||||||
|
_ProgressBar.PerformStep();
|
||||||
|
}
|
||||||
|
_ProgressBar.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? SaveExtraLargeBitmapThumbnail(FileHolder fileHolder)
|
||||||
|
{
|
||||||
|
string? result;
|
||||||
|
ShellFile shellFile = ShellFile.FromFilePath(fileHolder.FullName);
|
||||||
|
if (shellFile is null || shellFile.Thumbnail is null || shellFile.Thumbnail.ExtraLargeBitmap.Clone() is not Bitmap bitmap || bitmap.Width == 0)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = $"{fileHolder.FullName}{_ResizeFileNameExtension}";
|
||||||
|
bitmap.Save(result);
|
||||||
|
bitmap.Dispose();
|
||||||
|
shellFile.Dispose();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void Form1_DragDrop(object? sender, DragEventArgs e)
|
void Form1_DragDrop(object? sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (e.Data is not null)
|
if (e.Data is null)
|
||||||
|
_TextBox.Text = string.Empty;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
string fileName;
|
string name;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
for (int i = 1; i < 3; i++)
|
||||||
foreach (string file in files)
|
|
||||||
{
|
{
|
||||||
fileName = Path.GetFileNameWithoutExtension(file);
|
if (e.Data.GetData(DataFormats.FileDrop) is not string[] paths)
|
||||||
Text = fileName;
|
continue;
|
||||||
segments = fileName.Split('.');
|
foreach (string path in paths)
|
||||||
if (int.TryParse(segments[0], out int id) && _IdToMappingFromItem.ContainsKey(id))
|
|
||||||
{
|
{
|
||||||
MappingFromItem mappingFromItem = _IdToMappingFromItem[id];
|
name = Path.GetFileNameWithoutExtension(path);
|
||||||
Text = mappingFromItem.ImageFileHolder.Name;
|
Text = name;
|
||||||
_TextBox.Text = mappingFromItem.ImageFileHolder.FullName;
|
segments = name.Split('.');
|
||||||
_Logger.Information(mappingFromItem.ImageFileHolder.DirectoryName);
|
if (Directory.Exists(path))
|
||||||
if (!string.IsNullOrEmpty(mappingFromItem.ImageFileHolder.DirectoryName))
|
{
|
||||||
_ = Process.Start("explorer.exe", string.Concat("\"", mappingFromItem.ImageFileHolder.DirectoryName, "\""));
|
if (i == 1)
|
||||||
|
RenameDirectory(path, "*Rename*");
|
||||||
|
else if (i == 2)
|
||||||
|
RenameDirectory(path, "*");
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (i != 1)
|
||||||
|
continue;
|
||||||
|
if (!_IdToMappingFromItem.Any())
|
||||||
|
LoadData();
|
||||||
|
if (int.TryParse(segments[0], out int id) && _IdToMappingFromItem.TryGetValue(id, out MappingFromItem? value))
|
||||||
|
{
|
||||||
|
MappingFromItem mappingFromItem = value;
|
||||||
|
Text = mappingFromItem.ImageFileHolder.Name;
|
||||||
|
_TextBox.Text = mappingFromItem.ImageFileHolder.FullName;
|
||||||
|
if (mappingFromItem.ImageFileHolder.DirectoryName is not null)
|
||||||
|
_Logger.Information(mappingFromItem.ImageFileHolder.DirectoryName);
|
||||||
|
if (!string.IsNullOrEmpty(mappingFromItem.ImageFileHolder.DirectoryName))
|
||||||
|
_ = Process.Start("explorer.exe", string.Concat("\"", mappingFromItem.ImageFileHolder.DirectoryName, "\""));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", _Lines);
|
||||||
|
_Lines.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,11 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.Configuration Get(Configuration configuration)
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.CheckDFaceAndUpWriteDates is null)
|
if (configuration.CheckDFaceAndUpWriteDates is null)
|
||||||
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
||||||
if (configuration.CheckJsonForDistanceResults is null)
|
if (configuration.CheckJsonForDistanceResults is null)
|
||||||
@ -81,10 +83,8 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
if (configuration.IgnoreRelativePaths is null)
|
if (configuration.IgnoreRelativePaths is null)
|
||||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||||
if (configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions is null)
|
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions = Array.Empty<string>();
|
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions is null)
|
|
||||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||||
if (configuration.MixedYearRelativePaths is null)
|
if (configuration.MixedYearRelativePaths is null)
|
||||||
@ -115,16 +115,13 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.PropertiesChangedForResize));
|
throw new NullReferenceException(nameof(configuration.PropertiesChangedForResize));
|
||||||
if (configuration.Reverse is null)
|
if (configuration.Reverse is null)
|
||||||
throw new NullReferenceException(nameof(configuration.Reverse));
|
throw new NullReferenceException(nameof(configuration.Reverse));
|
||||||
if (configuration.SaveFaceLandmarkForOutputResolutions is null)
|
configuration.SaveFaceLandmarkForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveFaceLandmarkForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveFullYearOfRandomFiles is null)
|
if (configuration.SaveFullYearOfRandomFiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
||||||
if (configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions is null)
|
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveResizedSubfiles is null)
|
if (configuration.SaveResizedSubfiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
||||||
if (configuration.SaveShortcutsForOutputResolutions is null)
|
configuration.SaveShortcutsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveShortcutsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SkipSearch is null)
|
if (configuration.SkipSearch is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
||||||
if (configuration.TestDistanceResults is null)
|
if (configuration.TestDistanceResults is null)
|
||||||
@ -178,7 +175,7 @@ public class Configuration
|
|||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
Configuration configuration;
|
Configuration? configuration;
|
||||||
if (isEnvironment is null)
|
if (isEnvironment is null)
|
||||||
configuration = configurationRoot.Get<Configuration>();
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
else
|
else
|
||||||
|
@ -50,9 +50,7 @@ static class Program
|
|||||||
public static List<MappingFromItem> GetMappingFromItemCollection(Models.Configuration configuration, Container[] containers)
|
public static List<MappingFromItem> GetMappingFromItemCollection(Models.Configuration configuration, Container[] containers)
|
||||||
{
|
{
|
||||||
List<MappingFromItem> results = new();
|
List<MappingFromItem> results = new();
|
||||||
bool? isWrongYear;
|
|
||||||
Item[] filteredItems;
|
Item[] filteredItems;
|
||||||
DateTime minimumDateTime;
|
|
||||||
MappingFromItem mappingFromItem;
|
MappingFromItem mappingFromItem;
|
||||||
foreach (Container container in containers)
|
foreach (Container container in containers)
|
||||||
{
|
{
|
||||||
@ -65,11 +63,9 @@ static class Program
|
|||||||
continue;
|
continue;
|
||||||
foreach (Item item in filteredItems)
|
foreach (Item item in filteredItems)
|
||||||
{
|
{
|
||||||
if (item.Property?.Id is null || item.ImageFileHolder is null)
|
if (item.Property?.Id is null)
|
||||||
continue;
|
continue;
|
||||||
minimumDateTime = IProperty.GetMinimumDateTime(item.Property);
|
mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
|
||||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
|
||||||
mappingFromItem = new(item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, item.ImageFileHolder);
|
|
||||||
results.Add(mappingFromItem);
|
results.Add(mappingFromItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Face</PackageId>
|
<PackageId>Phares.View.by.Distance.Face</PackageId>
|
||||||
@ -34,10 +34,8 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
||||||
|
@ -8,6 +8,7 @@ using View_by_Distance.Face.Models.Stateless;
|
|||||||
using View_by_Distance.FaceRecognitionDotNet;
|
using View_by_Distance.FaceRecognitionDotNet;
|
||||||
using View_by_Distance.Metadata.Models;
|
using View_by_Distance.Metadata.Models;
|
||||||
using View_by_Distance.Property.Models;
|
using View_by_Distance.Property.Models;
|
||||||
|
using View_by_Distance.Property.Models.Stateless;
|
||||||
using View_by_Distance.Resize.Models;
|
using View_by_Distance.Resize.Models;
|
||||||
using View_by_Distance.Shared.Models;
|
using View_by_Distance.Shared.Models;
|
||||||
using View_by_Distance.Shared.Models.Stateless;
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
@ -248,14 +249,14 @@ public class D_Face
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unknownImage is null)
|
if (unknownImage is null)
|
||||||
results.Add(new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, mappingFromItem.RelativePath, location: null));
|
results.Add(new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, location: null));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<(Location Location, FaceRecognitionDotNet.FaceEncoding? FaceEncoding, Dictionary<FacePart, FacePoint[]>? FaceParts)> collection;
|
List<(Location Location, FaceRecognitionDotNet.FaceEncoding? FaceEncoding, Dictionary<FacePart, FacePoint[]>? FaceParts)> collection;
|
||||||
FaceRecognition faceRecognition = new(_NumberOfTimesToUpsample, _NumberOfJitters, _PredictorModel, _Model, _ModelParameter);
|
FaceRecognition faceRecognition = new(_NumberOfTimesToUpsample, _NumberOfJitters, _PredictorModel, _Model, _ModelParameter);
|
||||||
collection = faceRecognition.GetCollection(unknownImage, includeFaceEncoding: true, includeFaceParts: true);
|
collection = faceRecognition.GetCollection(unknownImage, includeFaceEncoding: true, includeFaceParts: true);
|
||||||
if (!collection.Any())
|
if (!collection.Any())
|
||||||
results.Add(new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, mappingFromItem.RelativePath, location: null));
|
results.Add(new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, location: null));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double[] rawEncoding;
|
double[] rawEncoding;
|
||||||
@ -263,7 +264,7 @@ public class D_Face
|
|||||||
Shared.Models.FaceEncoding convertedFaceEncoding;
|
Shared.Models.FaceEncoding convertedFaceEncoding;
|
||||||
foreach ((Location location, FaceRecognitionDotNet.FaceEncoding? faceEncoding, Dictionary<FacePart, FacePoint[]>? faceParts) in collection)
|
foreach ((Location location, FaceRecognitionDotNet.FaceEncoding? faceEncoding, Dictionary<FacePart, FacePoint[]>? faceParts) in collection)
|
||||||
{
|
{
|
||||||
face = new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, mappingFromItem.RelativePath, location);
|
face = new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, location);
|
||||||
if (faceEncoding is not null)
|
if (faceEncoding is not null)
|
||||||
{
|
{
|
||||||
rawEncoding = faceEncoding.GetRawEncoding();
|
rawEncoding = faceEncoding.GetRawEncoding();
|
||||||
@ -283,6 +284,34 @@ public class D_Face
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAngleBracketCollection(string dResultsFullGroupDirectory, string sourceDirectory)
|
||||||
|
{
|
||||||
|
AngleBracketCollection.Clear();
|
||||||
|
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(_Configuration,
|
||||||
|
sourceDirectory,
|
||||||
|
dResultsFullGroupDirectory,
|
||||||
|
contentDescription: "n png file(s) for each face found",
|
||||||
|
singletonDescription: string.Empty,
|
||||||
|
collectionDescription: "For each image a json file with all faces found",
|
||||||
|
converted: true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetFacesDirectory(string dResultsFullGroupDirectory, Item item)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
bool angleBracketCollectionAny = AngleBracketCollection.Any();
|
||||||
|
if (!angleBracketCollectionAny)
|
||||||
|
{
|
||||||
|
if (item.ImageFileHolder.DirectoryName is null)
|
||||||
|
throw new NullReferenceException(nameof(item.ImageFileHolder.DirectoryName));
|
||||||
|
SetAngleBracketCollection(dResultsFullGroupDirectory, item.ImageFileHolder.DirectoryName);
|
||||||
|
}
|
||||||
|
if (!angleBracketCollectionAny)
|
||||||
|
AngleBracketCollection.Clear();
|
||||||
|
result = Path.Combine(AngleBracketCollection[0].Replace("<>", "()"), item.ImageFileHolder.NameWithoutExtension);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma warning restore CA1416
|
#pragma warning restore CA1416
|
||||||
|
|
||||||
public List<Shared.Models.Face> GetFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.Property property, MappingFromItem mappingFromItem, int outputResolutionWidth, int outputResolutionHeight, int outputResolutionOrientation)
|
public List<Shared.Models.Face> GetFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.Property property, MappingFromItem mappingFromItem, int outputResolutionWidth, int outputResolutionHeight, int outputResolutionOrientation)
|
||||||
@ -293,27 +322,18 @@ public class D_Face
|
|||||||
string json;
|
string json;
|
||||||
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize) };
|
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize) };
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
string usingRelativePath = Path.Combine(AngleBracketCollection[0].Replace("<>", "[]"), $"{mappingFromItem.ImageFileHolder.NameWithoutExtension}.json");
|
|
||||||
string dCollectionFile = Path.Combine(dResultsFullGroupDirectory, "[]", _Configuration.ResultAllInOne, $"{mappingFromItem.Id}{mappingFromItem.ImageFileHolder.ExtensionLowered}.json");
|
string dCollectionFile = Path.Combine(dResultsFullGroupDirectory, "[]", _Configuration.ResultAllInOne, $"{mappingFromItem.Id}{mappingFromItem.ImageFileHolder.ExtensionLowered}.json");
|
||||||
FileInfo fileInfo = new(dCollectionFile);
|
FileInfo fileInfo = new(dCollectionFile);
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(_Configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (File.Exists(usingRelativePath))
|
if (fileInfo.Directory?.Parent is null)
|
||||||
|
throw new Exception();
|
||||||
|
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
||||||
|
if (File.Exists(parentCheck))
|
||||||
{
|
{
|
||||||
File.Move(usingRelativePath, fileInfo.FullName);
|
File.Move(parentCheck, fileInfo.FullName);
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
}
|
}
|
||||||
if (!fileInfo.Exists)
|
|
||||||
{
|
|
||||||
if (fileInfo.Directory?.Parent is null)
|
|
||||||
throw new Exception();
|
|
||||||
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
|
||||||
if (File.Exists(parentCheck))
|
|
||||||
{
|
|
||||||
File.Move(parentCheck, fileInfo.FullName);
|
|
||||||
fileInfo.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (_ForceFaceLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
if (_ForceFaceLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
||||||
{
|
{
|
||||||
@ -376,7 +396,7 @@ public class D_Face
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, MappingFromItem mappingFromItem, List<Shared.Models.Face> faces)
|
public bool SaveFaces(string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, MappingFromItem mappingFromItem, string facesDirectory, List<Shared.Models.Face> faces)
|
||||||
{
|
{
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@ -384,7 +404,6 @@ public class D_Face
|
|||||||
string deterministicHashCodeKey;
|
string deterministicHashCodeKey;
|
||||||
List<(Shared.Models.Face, FileInfo?, string)> collection = new();
|
List<(Shared.Models.Face, FileInfo?, string)> collection = new();
|
||||||
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize) };
|
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize) };
|
||||||
string facesDirectory = Path.Combine(AngleBracketCollection[0].Replace("<>", "()"), mappingFromItem.ImageFileHolder.NameWithoutExtension);
|
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
if (!Directory.Exists(facesDirectory))
|
if (!Directory.Exists(facesDirectory))
|
||||||
_ = Directory.CreateDirectory(facesDirectory);
|
_ = Directory.CreateDirectory(facesDirectory);
|
||||||
@ -397,7 +416,7 @@ public class D_Face
|
|||||||
}
|
}
|
||||||
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(mappingFromItem.Id, face.Location, ILocation.Digits, ILocation.Factor, face.OutputResolution);
|
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(mappingFromItem.Id, face.Location, ILocation.Digits, ILocation.Factor, face.OutputResolution);
|
||||||
fileInfo = new FileInfo(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{mappingFromItem.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
fileInfo = new FileInfo(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{mappingFromItem.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(_Configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (fileInfo.Directory?.Parent is null)
|
if (fileInfo.Directory?.Parent is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.FaceParts</PackageId>
|
<PackageId>Phares.View.by.Distance.FaceParts</PackageId>
|
||||||
@ -34,10 +34,8 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
||||||
|
@ -129,8 +129,7 @@ public class D2_FaceParts
|
|||||||
Bitmap result;
|
Bitmap result;
|
||||||
Bitmap bitmap = new(image);
|
Bitmap bitmap = new(image);
|
||||||
result = RotateBitmap(bitmap, angle);
|
result = RotateBitmap(bitmap, angle);
|
||||||
if (bitmap is not null)
|
bitmap?.Dispose();
|
||||||
bitmap.Dispose();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,12 +201,8 @@ public class D2_FaceParts
|
|||||||
|
|
||||||
#pragma warning restore CA1416
|
#pragma warning restore CA1416
|
||||||
|
|
||||||
public void SaveFaceLandmarkImages(string facesDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Item item, List<Shared.Models.Face> faceCollection, bool saveRotated)
|
public void SaveFaceLandmarkImages(Property.Models.Configuration configuration, string facesDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, MappingFromItem mappingFromItem, List<Shared.Models.Face> faceCollection, bool saveRotated)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
if (item.ResizedFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ResizedFileHolder));
|
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
bool check = false;
|
bool check = false;
|
||||||
string parentCheck;
|
string parentCheck;
|
||||||
@ -224,14 +219,14 @@ public class D2_FaceParts
|
|||||||
_ = Directory.CreateDirectory(facesDirectory);
|
_ = Directory.CreateDirectory(facesDirectory);
|
||||||
foreach (Shared.Models.Face face in faceCollection)
|
foreach (Shared.Models.Face face in faceCollection)
|
||||||
{
|
{
|
||||||
if (item.Property?.Id is null || face.FaceEncoding is null || face.Location is null || face.OutputResolution is null)
|
if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null)
|
||||||
{
|
{
|
||||||
collection.Add(new(face, string.Empty, string.Empty));
|
collection.Add(new(face, string.Empty, string.Empty));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(item.Property.Id.Value, face.Location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, face.OutputResolution);
|
deterministicHashCodeKey = Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(mappingFromItem.Id, face.Location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, face.OutputResolution);
|
||||||
fileInfo = new FileInfo(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{item.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
fileInfo = new FileInfo(Path.Combine(facesDirectory, $"{deterministicHashCodeKey}{mappingFromItem.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (fileInfo.Directory?.Parent is null)
|
if (fileInfo.Directory?.Parent is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
@ -241,7 +236,7 @@ public class D2_FaceParts
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(fileInfo.DirectoryName))
|
if (string.IsNullOrEmpty(fileInfo.DirectoryName))
|
||||||
continue;
|
continue;
|
||||||
rotatedFileInfo = new FileInfo(Path.Combine(fileInfo.DirectoryName, $"{deterministicHashCodeKey} - R{item.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
rotatedFileInfo = new FileInfo(Path.Combine(fileInfo.DirectoryName, $"{deterministicHashCodeKey} - R{mappingFromItem.ImageFileHolder.ExtensionLowered}{_FileNameExtension}"));
|
||||||
collection.Add(new(face, fileInfo.FullName, rotatedFileInfo.FullName));
|
collection.Add(new(face, fileInfo.FullName, rotatedFileInfo.FullName));
|
||||||
if (check)
|
if (check)
|
||||||
continue;
|
continue;
|
||||||
@ -260,7 +255,7 @@ public class D2_FaceParts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (check)
|
if (check)
|
||||||
SaveFaceParts(pointSize, item.ResizedFileHolder, saveRotated, collection);
|
SaveFaceParts(pointSize, mappingFromItem.ResizedFileHolder, saveRotated, collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.FaceRecognitionDotNet</PackageId>
|
<PackageId>Phares.View.by.Distance.FaceRecognitionDotNet</PackageId>
|
||||||
|
@ -63,9 +63,9 @@ public struct Point : IEquatable<Point>
|
|||||||
#region overrides
|
#region overrides
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether the specified <see cref="Object"/> is a <see cref="Point"/> and whether it contains the same coordinates as this <see cref="Point"/>.
|
/// Determines whether the specified <see cref="object"/> is a <see cref="Point"/> and whether it contains the same coordinates as this <see cref="Point"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The <see cref="Object"/> to compare.</param>
|
/// <param name="obj">The <see cref="object"/> to compare.</param>
|
||||||
/// <returns><code>true</code> if <paramref name="obj"/> is a <see cref="Point"/> and contains the same <see cref="X"/> and <see cref="Y"/> values as this <see cref="Point"/>; otherwise, <code>false</code>.</returns>
|
/// <returns><code>true</code> if <paramref name="obj"/> is a <see cref="Point"/> and contains the same <see cref="X"/> and <see cref="Y"/> values as this <see cref="Point"/>; otherwise, <code>false</code>.</returns>
|
||||||
public override bool Equals(object? obj) => obj is Point point && Equals(point);
|
public override bool Equals(object? obj) => obj is Point point && Equals(point);
|
||||||
|
|
||||||
|
@ -278,42 +278,20 @@ public partial class DlibDotNet
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MappingFromItem GetMappingFromItem(Item item)
|
private void FullParallelForWork(A_Property propertyLogic, Dictionary<int, List<(string, int)>> idToMappedFaceFilesCollection, string outputResolution, string bResultsFullGroupDirectory, string cResultsFullGroupDirectory, string dResultsFullGroupDirectory, string? eDistanceContentDirectory, List<Tuple<string, DateTime>> sourceDirectoryChanges, List<FileHolder?> propertyFileHolderCollection, List<Shared.Models.Property?> propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollections, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<Shared.Models.Face>> imageFaceCollections, Container container, int index, Item item)
|
||||||
{
|
{
|
||||||
MappingFromItem result;
|
if (_Log is null)
|
||||||
bool? isWrongYear;
|
throw new NullReferenceException(nameof(_Log));
|
||||||
DateTime minimumDateTime;
|
|
||||||
if (item.Property?.Id is null)
|
|
||||||
throw new NotSupportedException();
|
|
||||||
if (item.Property?.Id is null || item.ImageFileHolder is null || item.ResizedFileHolder is null)
|
|
||||||
throw new NotSupportedException();
|
|
||||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
|
||||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
|
||||||
result = new(item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, item.ResizedFileHolder);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FullParallelForWork(A_Property propertyLogic, Dictionary<int, List<(string, int)>> idToMappedFaceFilesCollection, string outputResolution, string bResultsFullGroupDirectory, string cResultsFullGroupDirectory, string dResultsFullGroupDirectory, string? eDistanceContentDirectory, List<Tuple<string, DateTime>> sourceDirectoryChanges, List<FileHolder?> propertyFileHolderCollection, List<Shared.Models.Property?> propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollections, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<Shared.Models.Face>?> imageFaceCollections, Container container, int index, Item item)
|
|
||||||
{
|
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
string original = "Original";
|
string original = "Original";
|
||||||
FileHolder? resizedFileHolder;
|
List<Shared.Models.Face> faces;
|
||||||
Shared.Models.Property property;
|
Shared.Models.Property property;
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
List<Shared.Models.Face>? faces;
|
|
||||||
List<string> parseExceptions = new();
|
List<string> parseExceptions = new();
|
||||||
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
Dictionary<string, int[]> imageResizeKeyValuePairs;
|
||||||
List<Tuple<string, DateTime>> subFileTuples = new();
|
List<Tuple<string, DateTime>> subFileTuples = new();
|
||||||
List<KeyValuePair<string, string>> metadataCollection;
|
List<KeyValuePair<string, string>> metadataCollection;
|
||||||
if (item.Property is not null)
|
if (item.Property is null || item.Property.Id is null)
|
||||||
{
|
|
||||||
property = item.Property;
|
|
||||||
if ((item.Changed.HasValue && item.Changed.Value) || (item.Moved.HasValue && item.Moved.Value) || (item.Abandoned.HasValue && item.Abandoned.Value))
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||||
item.Update(property);
|
item.Update(property);
|
||||||
@ -323,31 +301,48 @@ public partial class DlibDotNet
|
|||||||
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), (from l in subFileTuples select l.Item2).Max()));
|
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), (from l in subFileTuples select l.Item2).Max()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(int metadataGroups, metadataCollection) = _Metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, item);
|
else
|
||||||
|
{
|
||||||
|
property = item.Property;
|
||||||
|
if (item.Abandoned.HasValue && item.Abandoned.Value)
|
||||||
|
_Log.Information(string.Concat("Abandoned <", item.ImageFileHolder.FullName, '>'));
|
||||||
|
else if (item.FileSizeChanged.HasValue && item.FileSizeChanged.Value)
|
||||||
|
_Log.Information(string.Concat("FileSizeChanged <", item.ImageFileHolder.FullName, '>'));
|
||||||
|
else if (item.LastWriteTimeChanged.HasValue && item.LastWriteTimeChanged.Value)
|
||||||
|
_Log.Information(string.Concat("LastWriteTimeChanged <", item.ImageFileHolder.FullName, '>'));
|
||||||
|
else if (item.Moved.HasValue && item.Moved.Value)
|
||||||
|
_Log.Information(string.Concat("Moved <", item.ImageFileHolder.FullName, '>'));
|
||||||
|
}
|
||||||
|
if (property is null || item.Property is null)
|
||||||
|
throw new NullReferenceException(nameof(property));
|
||||||
|
FileHolder resizedFileHolder = _Resize.GetResizedFileHolder(item);
|
||||||
|
item.SetResizedFileHolder(_Resize.FileNameExtension, resizedFileHolder);
|
||||||
|
string facesDirectory = _Faces.GetFacesDirectory(dResultsFullGroupDirectory, item);
|
||||||
|
MappingFromItem mappingFromItem = Shared.Models.Stateless.Methods.IMappingFromItem.GetMappingFromItem(item, resizedFileHolder);
|
||||||
|
(int metadataGroups, metadataCollection) = _Metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(B_Metadata.GetMetadataCollection));
|
ticks = LogDelta(ticks, nameof(B_Metadata.GetMetadataCollection));
|
||||||
imageResizeKeyValuePairs = _Resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item);
|
imageResizeKeyValuePairs = _Resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item.Property, mappingFromItem);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(C_Resize.GetResizeKeyValuePairs));
|
ticks = LogDelta(ticks, nameof(C_Resize.GetResizeKeyValuePairs));
|
||||||
if (_Configuration.SaveResizedSubfiles)
|
if (_Configuration.SaveResizedSubfiles)
|
||||||
{
|
{
|
||||||
_Resize.SaveResizedSubfile(outputResolution, cResultsFullGroupDirectory, subFileTuples, item, original, imageResizeKeyValuePairs);
|
_Resize.SaveResizedSubfile(_Configuration.PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, original, imageResizeKeyValuePairs);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(C_Resize.SaveResizedSubfile));
|
ticks = LogDelta(ticks, nameof(C_Resize.SaveResizedSubfile));
|
||||||
}
|
}
|
||||||
else if (outputResolution == _Configuration.OutputResolutions[0] && false)
|
else if (outputResolution == _Configuration.OutputResolutions[0] && false)
|
||||||
{
|
{
|
||||||
byte[] bytes = _Resize.GetResizedBytes(outputResolution, cResultsFullGroupDirectory, subFileTuples, item, imageResizeKeyValuePairs);
|
byte[] bytes = _Resize.GetResizedBytes(outputResolution, cResultsFullGroupDirectory, subFileTuples, item.Property, mappingFromItem, imageResizeKeyValuePairs);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(C_Resize.GetResizedBytes));
|
ticks = LogDelta(ticks, nameof(C_Resize.GetResizedBytes));
|
||||||
string path = Path.Combine(resizedFileHolder.DirectoryName, resizedFileHolder.NameWithoutExtension);
|
string path = Path.Combine(resizedFileHolder.DirectoryName, resizedFileHolder.NameWithoutExtension);
|
||||||
File.WriteAllBytes(path, bytes);
|
File.WriteAllBytes(path, bytes);
|
||||||
}
|
}
|
||||||
if (!_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
if (!_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
||||||
faces = null;
|
faces = new();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MappingFromItem mappingFromItem = GetMappingFromItem(item);
|
|
||||||
int[] outputResolutionCollection = imageResizeKeyValuePairs[outputResolution];
|
int[] outputResolutionCollection = imageResizeKeyValuePairs[outputResolution];
|
||||||
int outputResolutionWidth = outputResolutionCollection[0];
|
int outputResolutionWidth = outputResolutionCollection[0];
|
||||||
int outputResolutionHeight = outputResolutionCollection[1];
|
int outputResolutionHeight = outputResolutionCollection[1];
|
||||||
@ -355,7 +350,7 @@ public partial class DlibDotNet
|
|||||||
faces = _Faces.GetFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, property, mappingFromItem, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation);
|
faces = _Faces.GetFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, property, mappingFromItem, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(D_Face.GetFaces));
|
ticks = LogDelta(ticks, nameof(D_Face.GetFaces));
|
||||||
bool anyFacesSaved = _Faces.SaveFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem, faces);
|
bool anyFacesSaved = _Faces.SaveFaces(dResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem, facesDirectory, faces);
|
||||||
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
ticks = LogDelta(ticks, nameof(D_Face.SaveFaces));
|
ticks = LogDelta(ticks, nameof(D_Face.SaveFaces));
|
||||||
if (!anyFacesSaved && item.Property?.Id is not null
|
if (!anyFacesSaved && item.Property?.Id is not null
|
||||||
@ -366,7 +361,7 @@ public partial class DlibDotNet
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
// bool saveRotated = _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution);
|
// bool saveRotated = _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution);
|
||||||
// string sourceDirectorySegment = Property.Models.Stateless.IResult.GetRelativePath(_Configuration.PropertyConfiguration, container.SourceDirectory);
|
// string sourceDirectorySegment = Property.Models.Stateless.IResult.GetRelativePath(_Configuration.PropertyConfiguration, container.SourceDirectory);
|
||||||
// string facesDirectory = Path.GetFullPath(Path.Combine($"{Path.Combine(d2FacePartsContentDirectory, "()")}{sourceDirectorySegment}", item.ImageFileHolder.NameWithoutExtension));
|
// string facePartsDirectoryX = Path.GetFullPath(Path.Combine($"{Path.Combine(d2FacePartsContentDirectory, "()")}{sourceDirectorySegment}", item.ImageFileHolder.NameWithoutExtension));
|
||||||
// _FaceParts.SaveFaceLandmarkImages(facesDirectory, subFileTuples, parseExceptions, item, faceCollection, saveRotated);
|
// _FaceParts.SaveFaceLandmarkImages(facesDirectory, subFileTuples, parseExceptions, item, faceCollection, saveRotated);
|
||||||
// if (_AppSettings.MaxDegreeOfParallelism < 2)
|
// if (_AppSettings.MaxDegreeOfParallelism < 2)
|
||||||
// ticks = LogDelta(ticks, nameof(D2_FaceParts.SaveFaceLandmarkImages));
|
// ticks = LogDelta(ticks, nameof(D2_FaceParts.SaveFaceLandmarkImages));
|
||||||
@ -396,7 +391,7 @@ public partial class DlibDotNet
|
|||||||
List<Shared.Models.Property?> propertyCollection,
|
List<Shared.Models.Property?> propertyCollection,
|
||||||
List<List<KeyValuePair<string, string>>> metadataCollection,
|
List<List<KeyValuePair<string, string>>> metadataCollection,
|
||||||
List<Dictionary<string, int[]>> resizeKeyValuePairs,
|
List<Dictionary<string, int[]>> resizeKeyValuePairs,
|
||||||
List<List<Shared.Models.Face>?> imageFaceCollections,
|
List<List<Shared.Models.Face>> imageFaceCollections,
|
||||||
Container container,
|
Container container,
|
||||||
Item[] filteredItems,
|
Item[] filteredItems,
|
||||||
string message)
|
string message)
|
||||||
@ -415,7 +410,7 @@ public partial class DlibDotNet
|
|||||||
{
|
{
|
||||||
propertyCollection.Add(null);
|
propertyCollection.Add(null);
|
||||||
metadataCollection.Add(new());
|
metadataCollection.Add(new());
|
||||||
imageFaceCollections.Add(null);
|
imageFaceCollections.Add(new());
|
||||||
resizeKeyValuePairs.Add(new());
|
resizeKeyValuePairs.Add(new());
|
||||||
propertyFileHolderCollection.Add(null);
|
propertyFileHolderCollection.Add(null);
|
||||||
}
|
}
|
||||||
@ -491,7 +486,7 @@ public partial class DlibDotNet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteGroup(A_Property propertyLogic, Shared.Models.Property[] propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollection, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<Shared.Models.Face>?> imageFaceCollections, string outputResolution, Container container, Item[] filteredItems)
|
private void WriteGroup(A_Property propertyLogic, Shared.Models.Property[] propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollection, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<Shared.Models.Face>> imageFaceCollections, string outputResolution, Container container, Item[] filteredItems)
|
||||||
{
|
{
|
||||||
Item item;
|
Item item;
|
||||||
string key;
|
string key;
|
||||||
@ -504,7 +499,7 @@ public partial class DlibDotNet
|
|||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
List<KeyValuePair<string, Shared.Models.Property>> propertyCollectionKeyValuePairs = new();
|
List<KeyValuePair<string, Shared.Models.Property>> propertyCollectionKeyValuePairs = new();
|
||||||
List<KeyValuePair<string, Dictionary<string, int[]>>> resizeKeyValuePairsCollections = new();
|
List<KeyValuePair<string, Dictionary<string, int[]>>> resizeKeyValuePairsCollections = new();
|
||||||
List<KeyValuePair<string, List<Shared.Models.Face>?>> imageFaceCollectionsKeyValuePairs = new();
|
List<KeyValuePair<string, List<Shared.Models.Face>>> imageFaceCollectionsKeyValuePairs = new();
|
||||||
List<KeyValuePair<string, List<KeyValuePair<string, string>>>> metadataCollectionKeyValuePairs = new();
|
List<KeyValuePair<string, List<KeyValuePair<string, string>>>> metadataCollectionKeyValuePairs = new();
|
||||||
(int level, List<string> directories) = Shared.Models.Stateless.Methods.IPath.Get(
|
(int level, List<string> directories) = Shared.Models.Stateless.Methods.IPath.Get(
|
||||||
_Configuration.PropertyConfiguration.RootDirectory,
|
_Configuration.PropertyConfiguration.RootDirectory,
|
||||||
@ -515,12 +510,10 @@ public partial class DlibDotNet
|
|||||||
item = filteredItems[i];
|
item = filteredItems[i];
|
||||||
if (item.Property is null)
|
if (item.Property is null)
|
||||||
continue;
|
continue;
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
key = Shared.Models.Stateless.Methods.IPath.GetRelativePath(item.ImageFileHolder.FullName, sourceDirectoryLength);
|
key = Shared.Models.Stateless.Methods.IPath.GetRelativePath(item.ImageFileHolder.FullName, sourceDirectoryLength);
|
||||||
propertyCollectionKeyValuePairs.Add(new KeyValuePair<string, Shared.Models.Property>(key, propertyCollection[i]));
|
propertyCollectionKeyValuePairs.Add(new KeyValuePair<string, Shared.Models.Property>(key, propertyCollection[i]));
|
||||||
resizeKeyValuePairsCollections.Add(new KeyValuePair<string, Dictionary<string, int[]>>(key, resizeKeyValuePairs[i]));
|
resizeKeyValuePairsCollections.Add(new KeyValuePair<string, Dictionary<string, int[]>>(key, resizeKeyValuePairs[i]));
|
||||||
imageFaceCollectionsKeyValuePairs.Add(new KeyValuePair<string, List<Shared.Models.Face>?>(key, imageFaceCollections[i]));
|
imageFaceCollectionsKeyValuePairs.Add(new KeyValuePair<string, List<Shared.Models.Face>>(key, imageFaceCollections[i]));
|
||||||
metadataCollectionKeyValuePairs.Add(new KeyValuePair<string, List<KeyValuePair<string, string>>>(key, metadataCollection[i]));
|
metadataCollectionKeyValuePairs.Add(new KeyValuePair<string, List<KeyValuePair<string, string>>>(key, metadataCollection[i]));
|
||||||
}
|
}
|
||||||
if (propertyLogic.AngleBracketCollection.Any())
|
if (propertyLogic.AngleBracketCollection.Any())
|
||||||
@ -599,45 +592,11 @@ public partial class DlibDotNet
|
|||||||
return new(aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory);
|
return new(aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAngleBracketCollections(A_Property propertyLogic, string outputResolution, Container container, string aResultsFullGroupDirectory, string bResultsFullGroupDirectory, string cResultsFullGroupDirectory, string dResultsFullGroupDirectory)
|
private void SetAngleBracketCollections(A_Property propertyLogic, Container container, string aResultsFullGroupDirectory, string bResultsFullGroupDirectory, string cResultsFullGroupDirectory)
|
||||||
{
|
{
|
||||||
_Faces.AngleBracketCollection.Clear();
|
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, container.SourceDirectory);
|
||||||
_Resize.AngleBracketCollection.Clear();
|
_Resize.SetAngleBracketCollection(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, container.SourceDirectory);
|
||||||
_Metadata.AngleBracketCollection.Clear();
|
_Metadata.SetAngleBracketCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, container.SourceDirectory);
|
||||||
propertyLogic.AngleBracketCollection.Clear();
|
|
||||||
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_Configuration.PropertyConfiguration,
|
|
||||||
container.SourceDirectory,
|
|
||||||
aResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Properties for each image",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: false));
|
|
||||||
_Metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_Configuration.PropertyConfiguration,
|
|
||||||
container.SourceDirectory,
|
|
||||||
bResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Metadata as key value pairs",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
_Resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_Configuration.PropertyConfiguration,
|
|
||||||
container.SourceDirectory,
|
|
||||||
cResultsFullGroupDirectory,
|
|
||||||
contentDescription: "Resized image",
|
|
||||||
singletonDescription: "Resize dimensions for each resolution",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
|
||||||
_Faces.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_Configuration.PropertyConfiguration,
|
|
||||||
container.SourceDirectory,
|
|
||||||
dResultsFullGroupDirectory,
|
|
||||||
contentDescription: "n png file(s) for each face found",
|
|
||||||
singletonDescription: string.Empty,
|
|
||||||
collectionDescription: "For each image a json file with all faces found",
|
|
||||||
converted: true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Item[] GetFilterItems(Container container)
|
private Item[] GetFilterItems(Container container)
|
||||||
@ -672,10 +631,10 @@ public partial class DlibDotNet
|
|||||||
Shared.Models.Property[] propertyCollection;
|
Shared.Models.Property[] propertyCollection;
|
||||||
List<FileHolder?> propertyFileHolderCollection = new();
|
List<FileHolder?> propertyFileHolderCollection = new();
|
||||||
List<Dictionary<string, int[]>> resizeKeyValuePairs = new();
|
List<Dictionary<string, int[]>> resizeKeyValuePairs = new();
|
||||||
|
List<List<Shared.Models.Face>> imageFaceCollections = new();
|
||||||
List<Tuple<string, DateTime>> sourceDirectoryChanges = new();
|
List<Tuple<string, DateTime>> sourceDirectoryChanges = new();
|
||||||
List<List<Shared.Models.Face>?> imageFaceCollections = new();
|
|
||||||
List<Shared.Models.Property?> nullablePropertyCollection = new();
|
|
||||||
int maxDegreeOfParallelism = _AppSettings.MaxDegreeOfParallelism;
|
int maxDegreeOfParallelism = _AppSettings.MaxDegreeOfParallelism;
|
||||||
|
List<Shared.Models.Property?> nullablePropertyCollection = new();
|
||||||
List<List<KeyValuePair<string, string>>> metadataCollection = new();
|
List<List<KeyValuePair<string, string>>> metadataCollection = new();
|
||||||
foreach (string outputResolution in _Configuration.OutputResolutions)
|
foreach (string outputResolution in _Configuration.OutputResolutions)
|
||||||
{
|
{
|
||||||
@ -699,7 +658,9 @@ public partial class DlibDotNet
|
|||||||
propertyFileHolderCollection.Clear();
|
propertyFileHolderCollection.Clear();
|
||||||
totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||||
message = $"{i + 1:000}.{container.G} [{filteredItems.Length:000} files] / {containersLength:000} - {total} / {t} total files - {totalSeconds} total second(s) - {outputResolution} - {container.SourceDirectory}";
|
message = $"{i + 1:000}.{container.G} [{filteredItems.Length:000} files] / {containersLength:000} - {total} / {t} total files - {totalSeconds} total second(s) - {outputResolution} - {container.SourceDirectory}";
|
||||||
SetAngleBracketCollections(propertyLogic, outputResolution, container, aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory);
|
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
||||||
|
_Faces.SetAngleBracketCollection(dResultsFullGroupDirectory, container.SourceDirectory);
|
||||||
|
SetAngleBracketCollections(propertyLogic, container, aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory);
|
||||||
exceptionCount = FullParallelWork(
|
exceptionCount = FullParallelWork(
|
||||||
maxDegreeOfParallelism,
|
maxDegreeOfParallelism,
|
||||||
propertyLogic,
|
propertyLogic,
|
||||||
@ -781,10 +742,9 @@ public partial class DlibDotNet
|
|||||||
Shared.Models.Face[] faces;
|
Shared.Models.Face[] faces;
|
||||||
Mapping mapping;
|
Mapping mapping;
|
||||||
int faceAreaPermille;
|
int faceAreaPermille;
|
||||||
bool? isWrongYear;
|
|
||||||
Item[] filteredItems;
|
Item[] filteredItems;
|
||||||
int confidencePercent;
|
int confidencePercent;
|
||||||
DateTime minimumDateTime;
|
List<int> distinct = new();
|
||||||
int normalizedPixelPercentage;
|
int normalizedPixelPercentage;
|
||||||
string deterministicHashCodeKey;
|
string deterministicHashCodeKey;
|
||||||
MappingFromItem mappingFromItem;
|
MappingFromItem mappingFromItem;
|
||||||
@ -803,20 +763,19 @@ public partial class DlibDotNet
|
|||||||
continue;
|
continue;
|
||||||
foreach (Item item in filteredItems)
|
foreach (Item item in filteredItems)
|
||||||
{
|
{
|
||||||
if (item.Property?.Id is null || item.ImageFileHolder is null || item.ResizedFileHolder is null)
|
if (item.Property?.Id is null || item.ResizedFileHolder is null)
|
||||||
continue;
|
continue;
|
||||||
|
if (distinct.Contains(item.Property.Id.Value))
|
||||||
|
continue;
|
||||||
|
distinct.Add(item.Property.Id.Value);
|
||||||
if (!item.Faces.Any(l => l.FaceEncoding is not null && l.Location is not null && l.OutputResolution is not null))
|
if (!item.Faces.Any(l => l.FaceEncoding is not null && l.Location is not null && l.OutputResolution is not null))
|
||||||
{
|
{
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
mappingFromItem = Shared.Models.Stateless.Methods.IMappingFromItem.GetMappingFromItem(item);
|
||||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
|
||||||
mappingFromItem = new(item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, item.ResizedFileHolder);
|
|
||||||
foreach (Shared.Models.Face face in item.Faces)
|
foreach (Shared.Models.Face face in item.Faces)
|
||||||
{
|
{
|
||||||
if (face.RelativePath != item.RelativePath)
|
|
||||||
break;
|
|
||||||
if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null)
|
if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null)
|
||||||
continue;
|
continue;
|
||||||
confidencePercent = Shared.Models.Stateless.Methods.ILocation.GetConfidencePercent(_Configuration.FaceConfidencePercent, _Configuration.RangeFaceConfidence, face.Location.Confidence);
|
confidencePercent = Shared.Models.Stateless.Methods.ILocation.GetConfidencePercent(_Configuration.FaceConfidencePercent, _Configuration.RangeFaceConfidence, face.Location.Confidence);
|
||||||
@ -958,9 +917,7 @@ public partial class DlibDotNet
|
|||||||
private List<MappingFromItem> GetMappingFromItemCollection(Container[] containers)
|
private List<MappingFromItem> GetMappingFromItemCollection(Container[] containers)
|
||||||
{
|
{
|
||||||
List<MappingFromItem> results = new();
|
List<MappingFromItem> results = new();
|
||||||
bool? isWrongYear;
|
|
||||||
Item[] filteredItems;
|
Item[] filteredItems;
|
||||||
DateTime minimumDateTime;
|
|
||||||
MappingFromItem mappingFromItem;
|
MappingFromItem mappingFromItem;
|
||||||
foreach (Container container in containers)
|
foreach (Container container in containers)
|
||||||
{
|
{
|
||||||
@ -973,11 +930,9 @@ public partial class DlibDotNet
|
|||||||
continue;
|
continue;
|
||||||
foreach (Item item in filteredItems)
|
foreach (Item item in filteredItems)
|
||||||
{
|
{
|
||||||
if (item.Property?.Id is null || item.ImageFileHolder is null)
|
if (item.Property?.Id is null)
|
||||||
continue;
|
continue;
|
||||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
mappingFromItem = Shared.Models.Stateless.Methods.IMappingFromItem.GetMappingFromItem(item);
|
||||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
|
||||||
mappingFromItem = new(item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, item.ImageFileHolder);
|
|
||||||
results.Add(mappingFromItem);
|
results.Add(mappingFromItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1033,6 +988,8 @@ public partial class DlibDotNet
|
|||||||
if (_PropertyRootExistedBefore || container is not null)
|
if (_PropertyRootExistedBefore || container is not null)
|
||||||
break;
|
break;
|
||||||
(aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
|
(aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
|
||||||
|
if (_Configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions.Contains(outputResolution))
|
||||||
|
MapLogicSupport.BeforeSaveResizedImagesByPersonKeyFormatted(_Configuration.JLinks, a2PeopleSingletonDirectory);
|
||||||
if (_ArgZeroIsConfigurationRootDirectory
|
if (_ArgZeroIsConfigurationRootDirectory
|
||||||
&& _Configuration.SaveResizedSubfiles
|
&& _Configuration.SaveResizedSubfiles
|
||||||
&& outputResolution == _Configuration.OutputResolutions[0]
|
&& outputResolution == _Configuration.OutputResolutions[0]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Instance</PackageId>
|
<PackageId>Phares.View.by.Distance.Instance</PackageId>
|
||||||
@ -34,23 +34,19 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="WindowsShortcutFactory" Version="1.0.1" />
|
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,11 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.Configuration Get(Configuration configuration)
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.CheckDFaceAndUpWriteDates is null)
|
if (configuration.CheckDFaceAndUpWriteDates is null)
|
||||||
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
||||||
if (configuration.CheckJsonForDistanceResults is null)
|
if (configuration.CheckJsonForDistanceResults is null)
|
||||||
@ -121,10 +123,8 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
if (configuration.IgnoreRelativePaths is null)
|
if (configuration.IgnoreRelativePaths is null)
|
||||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||||
if (configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions is null)
|
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions = Array.Empty<string>();
|
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions is null)
|
|
||||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||||
if (configuration.LocationDigits is null)
|
if (configuration.LocationDigits is null)
|
||||||
@ -181,24 +181,17 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.RetryImagesWithoutAFace));
|
throw new NullReferenceException(nameof(configuration.RetryImagesWithoutAFace));
|
||||||
if (configuration.Reverse is null)
|
if (configuration.Reverse is null)
|
||||||
throw new NullReferenceException(nameof(configuration.Reverse));
|
throw new NullReferenceException(nameof(configuration.Reverse));
|
||||||
if (configuration.SaveFaceDistancesForOutputResolutions is null)
|
configuration.SaveFaceDistancesForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveFaceDistancesForOutputResolutions = Array.Empty<string>();
|
configuration.SaveFaceLandmarkForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.SaveFaceLandmarkForOutputResolutions is null)
|
|
||||||
configuration.SaveFaceLandmarkForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveFullYearOfRandomFiles is null)
|
if (configuration.SaveFullYearOfRandomFiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
||||||
if (configuration.SaveMappedForOutputResolutions is null)
|
configuration.SaveMappedForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveMappedForOutputResolutions = Array.Empty<string>();
|
configuration.SaveNotMappedForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.SaveNotMappedForOutputResolutions is null)
|
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveNotMappedForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions is null)
|
|
||||||
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveResizedSubfiles is null)
|
if (configuration.SaveResizedSubfiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
||||||
if (configuration.SaveShortcutsForOutputResolutions is null)
|
configuration.SaveShortcutsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveShortcutsForOutputResolutions = Array.Empty<string>();
|
configuration.SaveShortcutsForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.SaveShortcutsForOutputResolutions is null)
|
|
||||||
configuration.SaveShortcutsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SkipSearch is null)
|
if (configuration.SkipSearch is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
||||||
if (configuration.SortingMaximumPerFaceShouldBeHigh is null)
|
if (configuration.SortingMaximumPerFaceShouldBeHigh is null)
|
||||||
@ -285,7 +278,7 @@ public class Configuration
|
|||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
Configuration configuration;
|
Configuration? configuration;
|
||||||
if (isEnvironment is null)
|
if (isEnvironment is null)
|
||||||
configuration = configurationRoot.Get<Configuration>();
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
else
|
else
|
||||||
@ -296,6 +289,8 @@ public class Configuration
|
|||||||
configuration = configurationSection.Get<Configuration>();
|
configuration = configurationSection.Get<Configuration>();
|
||||||
}
|
}
|
||||||
result = Get(configuration);
|
result = Get(configuration);
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
result.SetAndUpdate(propertyConfiguration, configuration.NumberOfJitters, configuration.NumberOfTimesToUpsample, configuration.ModelName, configuration.PredictorModelName);
|
result.SetAndUpdate(propertyConfiguration, configuration.NumberOfJitters, configuration.NumberOfTimesToUpsample, configuration.ModelName, configuration.PredictorModelName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
|||||||
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
|
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
|
||||||
{
|
{
|
||||||
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (fileInfo.Directory?.Parent is null)
|
if (fileInfo.Directory?.Parent is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"CheckDFaceAndUpWriteDates": true,
|
"CheckDFaceAndUpWriteDates": true,
|
||||||
"CheckJsonForDistanceResults": false,
|
"CheckJsonForDistanceResults": false,
|
||||||
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"DistanceFactor": 8,
|
"DistanceFactor": 8,
|
||||||
"DistanceMoveUnableToMatch": false,
|
"DistanceMoveUnableToMatch": false,
|
||||||
"DistancePixelDistanceTolerance": 1,
|
"DistancePixelDistanceTolerance": 1,
|
||||||
@ -104,8 +104,8 @@
|
|||||||
"RetryImagesWithoutAFace": false,
|
"RetryImagesWithoutAFace": false,
|
||||||
"Reverse": false,
|
"Reverse": false,
|
||||||
"xRootDirectory": "C:/Tmp/phares/Pictures",
|
"xRootDirectory": "C:/Tmp/phares/Pictures",
|
||||||
"RootDirectory": "F:/Tmp/Phares/Compare/Images 2022-10-23 - 239acf2 - III",
|
"RootDirectory": "F:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III",
|
||||||
"xxRootDirectory": "F:/Tmp/Phares/Compare/Images 2022-10-23 - 239acf2 - III/Facebook/=2022.3 Facebook",
|
"xxRootDirectory": "F:/Tmp/Phares/Compare/Images 2022-11-12 - c6aa7e8 - III/Facebook/=2022.3 Facebook",
|
||||||
"SaveFullYearOfRandomFiles": true,
|
"SaveFullYearOfRandomFiles": true,
|
||||||
"SaveResizedSubFiles": true,
|
"SaveResizedSubFiles": true,
|
||||||
"SkipSearch": false,
|
"SkipSearch": false,
|
||||||
@ -182,8 +182,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"CheckDFaceAndUpWriteDates": true,
|
"CheckDFaceAndUpWriteDates": true,
|
||||||
"CheckJsonForDistanceResults": false,
|
"CheckJsonForDistanceResults": false,
|
||||||
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"DistanceFactor": 8,
|
"DistanceFactor": 8,
|
||||||
"DistanceMoveUnableToMatch": false,
|
"DistanceMoveUnableToMatch": false,
|
||||||
"DistancePixelDistanceTolerance": 1,
|
"DistancePixelDistanceTolerance": 1,
|
||||||
@ -174,8 +174,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"CheckDFaceAndUpWriteDates": true,
|
"CheckDFaceAndUpWriteDates": true,
|
||||||
"CheckJsonForDistanceResults": false,
|
"CheckJsonForDistanceResults": false,
|
||||||
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
"CrossDirectoryMaxItemsInDistanceCollection": 7,
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"DistanceFactor": 8,
|
"DistanceFactor": 8,
|
||||||
"DistanceMoveUnableToMatch": false,
|
"DistanceMoveUnableToMatch": false,
|
||||||
"DistancePixelDistanceTolerance": 1,
|
"DistancePixelDistanceTolerance": 1,
|
||||||
@ -183,8 +183,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Map</PackageId>
|
<PackageId>Phares.View.by.Distance.Map</PackageId>
|
||||||
@ -34,14 +34,12 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.13.14" />
|
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="WindowsShortcutFactory" Version="1.0.1" />
|
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -246,24 +246,55 @@ public class MapLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? GetFacesDirectory(string dFacesContentDirectory, MappingFromItem mappingFromItem)
|
||||||
|
{
|
||||||
|
string? result;
|
||||||
|
string? directoryName = Path.GetDirectoryName(mappingFromItem.RelativePath);
|
||||||
|
if (directoryName is null)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
result = Path.Combine($"{dFacesContentDirectory}{directoryName}", mappingFromItem.ImageFileHolder.NameWithoutExtension);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? GetFacePartsDirectory(string d2FacePartsContentDirectory, MappingFromItem mappingFromItem)
|
||||||
|
{
|
||||||
|
string? result;
|
||||||
|
string? directoryName = Path.GetDirectoryName(mappingFromItem.RelativePath);
|
||||||
|
if (directoryName is null)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
result = Path.Combine($"{d2FacePartsContentDirectory}{directoryName}", mappingFromItem.ImageFileHolder.NameWithoutExtension);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private SaveContainer? GetMatchSaveContainer(string dFacesContentDirectory, string d2FacePartsContentDirectory, string directory, Mapping mapping)
|
private SaveContainer? GetMatchSaveContainer(string dFacesContentDirectory, string d2FacePartsContentDirectory, string directory, Mapping mapping)
|
||||||
{
|
{
|
||||||
if (_Configuration is null)
|
if (_Configuration is null)
|
||||||
throw new NullReferenceException(nameof(_Configuration));
|
throw new NullReferenceException(nameof(_Configuration));
|
||||||
SaveContainer? result;
|
SaveContainer? result;
|
||||||
string shortcutFile = string.Empty;
|
string shortcutFile = string.Empty;
|
||||||
string? directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath);
|
string? facesDirectory = GetFacesDirectory(dFacesContentDirectory, mapping.MappingFromItem);
|
||||||
string facesDirectory = Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
if (facesDirectory is null)
|
||||||
FileHolder faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
|
||||||
if (directoryName is null || !faceFileHolder.Exists)
|
|
||||||
result = null;
|
result = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string facePartsDirectory = Path.Combine($"{d2FacePartsContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
FileHolder faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
||||||
string checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
|
if (!faceFileHolder.Exists)
|
||||||
FileHolder hiddenFaceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesHiddenFileNameExtension}"));
|
result = null;
|
||||||
FileHolder facePartsFileHolder = new(Path.Combine(facePartsDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacePartsFileNameExtension}"));
|
else
|
||||||
result = new(checkFile, directory, faceFileHolder, hiddenFaceFileHolder, facePartsFileHolder, mapping.MappingFromItem.ResizedFileHolder, shortcutFile);
|
{
|
||||||
|
string? facePartsDirectory = GetFacePartsDirectory(d2FacePartsContentDirectory, mapping.MappingFromItem);
|
||||||
|
if (facePartsDirectory is null)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
|
||||||
|
FileHolder hiddenFaceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesHiddenFileNameExtension}"));
|
||||||
|
FileHolder facePartsFileHolder = new(Path.Combine(facePartsDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacePartsFileNameExtension}"));
|
||||||
|
result = new(checkFile, directory, faceFileHolder, hiddenFaceFileHolder, facePartsFileHolder, mapping.MappingFromItem.ResizedFileHolder, shortcutFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -339,12 +370,12 @@ public class MapLogic
|
|||||||
string checkFile;
|
string checkFile;
|
||||||
string directory;
|
string directory;
|
||||||
string shortcutFile;
|
string shortcutFile;
|
||||||
string facesDirectory;
|
|
||||||
string? directoryName;
|
string? directoryName;
|
||||||
string personDirectory;
|
string personDirectory;
|
||||||
|
string? facesDirectory;
|
||||||
FileHolder faceFileHolder;
|
FileHolder faceFileHolder;
|
||||||
string facePartsDirectory;
|
|
||||||
string personKeyFormatted;
|
string personKeyFormatted;
|
||||||
|
string? facePartsDirectory;
|
||||||
SaveContainer? saveContainer;
|
SaveContainer? saveContainer;
|
||||||
FileHolder facePartsFileHolder;
|
FileHolder facePartsFileHolder;
|
||||||
FileHolder hiddenFaceFileHolder;
|
FileHolder hiddenFaceFileHolder;
|
||||||
@ -380,15 +411,17 @@ public class MapLogic
|
|||||||
personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName, "lnk");
|
personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName, "lnk");
|
||||||
else
|
else
|
||||||
personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName[..1], "lnk");
|
personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName[..1], "lnk");
|
||||||
if (isByMapping && personKeyToCount.ContainsKey(personKey))
|
if (isByMapping && personKeyToCount.TryGetValue(personKey, out int count))
|
||||||
{
|
{
|
||||||
saveContainer = new(Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName, $"{personKeyToCount[personKey]} Face(s)"));
|
saveContainer = new(Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName, $"{count} Face(s)"));
|
||||||
results.Add(saveContainer);
|
results.Add(saveContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveContainer = new(personDirectory);
|
saveContainer = new(personDirectory);
|
||||||
results.Add(saveContainer);
|
results.Add(saveContainer);
|
||||||
facesDirectory = Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
facesDirectory = GetFacesDirectory(dFacesContentDirectory, mapping.MappingFromItem);
|
||||||
|
if (facesDirectory is null)
|
||||||
|
continue;
|
||||||
faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
||||||
if (!faceFileHolder.Exists)
|
if (!faceFileHolder.Exists)
|
||||||
continue;
|
continue;
|
||||||
@ -399,7 +432,9 @@ public class MapLogic
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
facePartsDirectory = Path.Combine($"{d2FacePartsContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
facePartsDirectory = GetFacePartsDirectory(d2FacePartsContentDirectory, mapping.MappingFromItem);
|
||||||
|
if (facePartsDirectory is null)
|
||||||
|
continue;
|
||||||
checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
|
checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
|
||||||
shortcutFile = Path.Combine(personDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}.lnk");
|
shortcutFile = Path.Combine(personDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}.lnk");
|
||||||
hiddenFaceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesHiddenFileNameExtension}"));
|
hiddenFaceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesHiddenFileNameExtension}"));
|
||||||
@ -633,9 +668,9 @@ public class MapLogic
|
|||||||
string faceFileName;
|
string faceFileName;
|
||||||
string shortcutFile;
|
string shortcutFile;
|
||||||
string? directoryName;
|
string? directoryName;
|
||||||
string facesDirectory;
|
|
||||||
string mappingSegmentB;
|
string mappingSegmentB;
|
||||||
string personDirectory;
|
string personDirectory;
|
||||||
|
string? facesDirectory;
|
||||||
string personKeyFormatted;
|
string personKeyFormatted;
|
||||||
string personDisplayFileName;
|
string personDisplayFileName;
|
||||||
PersonBirthday personBirthday;
|
PersonBirthday personBirthday;
|
||||||
@ -653,6 +688,8 @@ public class MapLogic
|
|||||||
personBirthday = keyValuePair.Value.Birthdays[zero];
|
personBirthday = keyValuePair.Value.Birthdays[zero];
|
||||||
foreach (string personDisplayDirectoryAllFile in keyValuePair.Value.DisplayDirectoryAllFiles)
|
foreach (string personDisplayDirectoryAllFile in keyValuePair.Value.DisplayDirectoryAllFiles)
|
||||||
{
|
{
|
||||||
|
if (personDisplayDirectoryAllFile.Contains("-2318605"))
|
||||||
|
continue;
|
||||||
if (!personDisplayDirectoryAllFile.EndsWith(_Configuration.FacesFileNameExtension))
|
if (!personDisplayDirectoryAllFile.EndsWith(_Configuration.FacesFileNameExtension))
|
||||||
continue;
|
continue;
|
||||||
(id, normalizedPixelPercentage, _) = IMapping.GetReversedDeterministicHashCodeKey(_Configuration.FacesFileNameExtension, personDisplayDirectoryAllFile);
|
(id, normalizedPixelPercentage, _) = IMapping.GetReversedDeterministicHashCodeKey(_Configuration.FacesFileNameExtension, personDisplayDirectoryAllFile);
|
||||||
@ -678,7 +715,9 @@ public class MapLogic
|
|||||||
if (string.IsNullOrEmpty(directoryName))
|
if (string.IsNullOrEmpty(directoryName))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
shortcutFile = Path.Combine(personDisplayDirectory, $"{personDisplayFileName}.lnk");
|
shortcutFile = Path.Combine(personDisplayDirectory, $"{personDisplayFileName}.lnk");
|
||||||
facesDirectory = Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
facesDirectory = GetFacesDirectory(dFacesContentDirectory, mapping.MappingFromItem); // Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
||||||
|
if (facesDirectory is null)
|
||||||
|
continue;
|
||||||
faceFileName = $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}";
|
faceFileName = $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}";
|
||||||
checkFile = Path.Combine(directory, fileInfo.Name);
|
checkFile = Path.Combine(directory, fileInfo.Name);
|
||||||
if (!_IdThenNormalizedPixelPercentageToPersonContainers.TryGetValue(id.Value, out normalizedPixelPercentageToPeronContainerCollection) || !normalizedPixelPercentageToPeronContainerCollection.ContainsKey(normalizedPixelPercentage.Value))
|
if (!_IdThenNormalizedPixelPercentageToPersonContainers.TryGetValue(id.Value, out normalizedPixelPercentageToPeronContainerCollection) || !normalizedPixelPercentageToPeronContainerCollection.ContainsKey(normalizedPixelPercentage.Value))
|
||||||
@ -762,6 +801,8 @@ public class MapLogic
|
|||||||
{
|
{
|
||||||
if (_Configuration is null)
|
if (_Configuration is null)
|
||||||
throw new NullReferenceException(nameof(_Configuration));
|
throw new NullReferenceException(nameof(_Configuration));
|
||||||
|
if (_MapLogicSupport is null)
|
||||||
|
throw new NullReferenceException(nameof(_MapLogicSupport));
|
||||||
List<(string, PersonContainer)> results = new();
|
List<(string, PersonContainer)> results = new();
|
||||||
string[] files;
|
string[] files;
|
||||||
const int zero = 0;
|
const int zero = 0;
|
||||||
@ -788,8 +829,12 @@ public class MapLogic
|
|||||||
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
||||||
if (windowsShortcut.Path is null)
|
if (windowsShortcut.Path is null)
|
||||||
continue;
|
continue;
|
||||||
if (!Directory.Exists(windowsShortcut.Path) && files.Length != checkDirectories.Length)
|
if (!Directory.Exists(windowsShortcut.Path))
|
||||||
throw new NotSupportedException(fileNameWithoutExtension);
|
{
|
||||||
|
if (files.Length != checkDirectories.Length)
|
||||||
|
throw new NotSupportedException(fileNameWithoutExtension);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
(personKeyFormatted, personBirthday) = GetPersonBirthday(windowsShortcut.Path);
|
(personKeyFormatted, personBirthday) = GetPersonBirthday(windowsShortcut.Path);
|
||||||
if (personBirthday is not null)
|
if (personBirthday is not null)
|
||||||
{
|
{
|
||||||
@ -819,9 +864,10 @@ public class MapLogic
|
|||||||
{
|
{
|
||||||
matches = (from l in personContainers where l.Key == personKey && l.ApproximateYears.HasValue select l).ToArray();
|
matches = (from l in personContainers where l.Key == personKey && l.ApproximateYears.HasValue select l).ToArray();
|
||||||
if (!matches.Any())
|
if (!matches.Any())
|
||||||
throw new NotSupportedException(fileNameWithoutExtension);
|
continue;
|
||||||
if (!Directory.Exists(displayDirectoryName))
|
if (!Directory.Exists(displayDirectoryName))
|
||||||
_ = Directory.CreateDirectory(displayDirectoryName);
|
_ = Directory.CreateDirectory(displayDirectoryName);
|
||||||
|
personKeyFormatted = IPersonBirthday.GetFormatted(_Configuration.PersonBirthdayFormat, personKey);
|
||||||
results.Add(new(personKeyFormatted, matches[zero]));
|
results.Add(new(personKeyFormatted, matches[zero]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -995,8 +1041,8 @@ public class MapLogic
|
|||||||
Mapping mapping;
|
Mapping mapping;
|
||||||
string checkFile;
|
string checkFile;
|
||||||
string directory;
|
string directory;
|
||||||
string facesDirectory;
|
|
||||||
string? directoryName;
|
string? directoryName;
|
||||||
|
string? facesDirectory;
|
||||||
FileHolder faceFileHolder;
|
FileHolder faceFileHolder;
|
||||||
List<int>? normalizedPixelPercentages;
|
List<int>? normalizedPixelPercentages;
|
||||||
string by = nameof(IMapLogic.CopyNotMappedFaces);
|
string by = nameof(IMapLogic.CopyNotMappedFaces);
|
||||||
@ -1013,7 +1059,9 @@ public class MapLogic
|
|||||||
if (normalizedPixelPercentages is not null && normalizedPixelPercentages.Contains(mapping.MappingFromLocation.NormalizedPixelPercentage))
|
if (normalizedPixelPercentages is not null && normalizedPixelPercentages.Contains(mapping.MappingFromLocation.NormalizedPixelPercentage))
|
||||||
continue;
|
continue;
|
||||||
directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath);
|
directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath);
|
||||||
facesDirectory = Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
facesDirectory = GetFacesDirectory(dFacesContentDirectory, mapping.MappingFromItem); // Path.Combine($"{dFacesContentDirectory}{directoryName}", mapping.MappingFromItem.ImageFileHolder.NameWithoutExtension);
|
||||||
|
if (facesDirectory is null)
|
||||||
|
continue;
|
||||||
faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
faceFileHolder = new(Path.Combine(facesDirectory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}"));
|
||||||
if (directoryName is null || !faceFileHolder.Exists)
|
if (directoryName is null || !faceFileHolder.Exists)
|
||||||
continue;
|
continue;
|
||||||
|
@ -208,7 +208,10 @@ internal abstract class MapLogic
|
|||||||
ticksDirectories = Array.Empty<string>();
|
ticksDirectories = Array.Empty<string>();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = IPath.DeleteEmptyDirectories(eDistanceContentDirectory);
|
if (!Directory.Exists(eDistanceContentDirectory))
|
||||||
|
_ = Directory.CreateDirectory(eDistanceContentDirectory);
|
||||||
|
else
|
||||||
|
_ = IPath.DeleteEmptyDirectories(eDistanceContentDirectory);
|
||||||
ticksDirectories = Directory.GetDirectories(eDistanceContentDirectory, "*", SearchOption.TopDirectoryOnly);
|
ticksDirectories = Directory.GetDirectories(eDistanceContentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
}
|
}
|
||||||
string message = $") {ticksDirectories.Length:000} collect from and clean ticks Director(ies) - A - {totalSeconds} total second(s)";
|
string message = $") {ticksDirectories.Length:000} collect from and clean ticks Director(ies) - A - {totalSeconds} total second(s)";
|
||||||
@ -556,22 +559,28 @@ internal abstract class MapLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? GetDisplayDirectoryName(Dictionary<long, PersonContainer> personKeyToPersonContainer, long key)
|
||||||
|
{
|
||||||
|
string? result = null;
|
||||||
|
if (personKeyToPersonContainer.TryGetValue(key, out PersonContainer? personContainer))
|
||||||
|
{
|
||||||
|
result = personContainer.DisplayDirectoryName;
|
||||||
|
if (string.IsNullOrEmpty(result))
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private static void SetPersonKeyToPersonContainer(Configuration configuration, List<PersonContainer> personContainers, long[] personKeyCollection, Dictionary<long, PersonContainer> personKeyToPersonContainer)
|
private static void SetPersonKeyToPersonContainer(Configuration configuration, List<PersonContainer> personContainers, long[] personKeyCollection, Dictionary<long, PersonContainer> personKeyToPersonContainer)
|
||||||
{
|
{
|
||||||
string personDisplayDirectoryName;
|
string? displayDirectoryName;
|
||||||
foreach (PersonContainer personContainer in personContainers)
|
foreach (PersonContainer personContainer in personContainers)
|
||||||
{
|
{
|
||||||
if (personContainer.Key is null || !personKeyCollection.Contains(personContainer.Key.Value))
|
if (personContainer.Key is null || !personKeyCollection.Contains(personContainer.Key.Value))
|
||||||
continue;
|
continue;
|
||||||
if (personKeyToPersonContainer.ContainsKey(personContainer.Key.Value))
|
displayDirectoryName = GetDisplayDirectoryName(personKeyToPersonContainer, personContainer.Key.Value);
|
||||||
{
|
if (displayDirectoryName is not null && (displayDirectoryName == personContainer.DisplayDirectoryName || (displayDirectoryName[0] == personContainer.DisplayDirectoryName[0] && (displayDirectoryName.Length == 1 || personContainer.DisplayDirectoryName.Length == 1))))
|
||||||
personDisplayDirectoryName = personKeyToPersonContainer[personContainer.Key.Value].DisplayDirectoryName;
|
continue;
|
||||||
if (string.IsNullOrEmpty(personDisplayDirectoryName))
|
|
||||||
throw new NotSupportedException();
|
|
||||||
if (personDisplayDirectoryName == personContainer.DisplayDirectoryName || (personDisplayDirectoryName[0] == personContainer.DisplayDirectoryName[0] && (personDisplayDirectoryName.Length == 1 || personContainer.DisplayDirectoryName.Length == 1)))
|
|
||||||
continue;
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
personKeyToPersonContainer.Add(personContainer.Key.Value, personContainer);
|
personKeyToPersonContainer.Add(personContainer.Key.Value, personContainer);
|
||||||
}
|
}
|
||||||
if (personKeyCollection.Any())
|
if (personKeyCollection.Any())
|
||||||
@ -579,7 +588,7 @@ internal abstract class MapLogic
|
|||||||
int? approximateYears = null;
|
int? approximateYears = null;
|
||||||
PersonBirthday? personBirthday;
|
PersonBirthday? personBirthday;
|
||||||
PersonContainer? personContainer;
|
PersonContainer? personContainer;
|
||||||
string displayDirectoryName = configuration.MappingDefaultName;
|
displayDirectoryName = configuration.MappingDefaultName;
|
||||||
foreach (long personKey in personKeyCollection)
|
foreach (long personKey in personKeyCollection)
|
||||||
{
|
{
|
||||||
if (personKeyToPersonContainer.ContainsKey(personKey))
|
if (personKeyToPersonContainer.ContainsKey(personKey))
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Metadata</PackageId>
|
<PackageId>Phares.View.by.Distance.Metadata</PackageId>
|
||||||
@ -34,11 +34,9 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using View_by_Distance.Metadata.Models.Stateless;
|
using View_by_Distance.Metadata.Models.Stateless;
|
||||||
|
using View_by_Distance.Property.Models.Stateless;
|
||||||
using View_by_Distance.Shared.Models.Stateless;
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Metadata.Models;
|
namespace View_by_Distance.Metadata.Models;
|
||||||
@ -35,6 +36,18 @@ public class B_Metadata
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAngleBracketCollection(Property.Models.Configuration configuration, string bResultsFullGroupDirectory, string sourceDirectory)
|
||||||
|
{
|
||||||
|
AngleBracketCollection.Clear();
|
||||||
|
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(configuration,
|
||||||
|
sourceDirectory,
|
||||||
|
bResultsFullGroupDirectory,
|
||||||
|
contentDescription: string.Empty,
|
||||||
|
singletonDescription: "Metadata as key value pairs",
|
||||||
|
collectionDescription: string.Empty,
|
||||||
|
converted: true));
|
||||||
|
}
|
||||||
|
|
||||||
private Dictionary<string, List<KeyValuePair<string, string>>> GetMetadataCollection(string subFile)
|
private Dictionary<string, List<KeyValuePair<string, string>>> GetMetadataCollection(string subFile)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<KeyValuePair<string, string>>> results = new();
|
Dictionary<string, List<KeyValuePair<string, string>>> results = new();
|
||||||
@ -78,38 +91,25 @@ public class B_Metadata
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (int, List<KeyValuePair<string, string>>) GetMetadataCollection(Property.Models.Configuration propertyConfiguration, string bResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.Item item)
|
public (int, List<KeyValuePair<string, string>>) GetMetadataCollection(Property.Models.Configuration configuration, string bResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.MappingFromItem mappingFromItem)
|
||||||
{
|
{
|
||||||
List<KeyValuePair<string, string>> results = new();
|
List<KeyValuePair<string, string>> results = new();
|
||||||
if (item.Property?.Id is null)
|
|
||||||
throw new NullReferenceException(nameof(item.Property.Id));
|
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
string json = string.Empty;
|
string json = string.Empty;
|
||||||
string[] changesFrom = Array.Empty<string>();
|
string[] changesFrom = Array.Empty<string>();
|
||||||
Dictionary<string, List<KeyValuePair<string, string>>>? dictionary;
|
Dictionary<string, List<KeyValuePair<string, string>>>? dictionary;
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
string usingRelativePath = Path.Combine(AngleBracketCollection[0].Replace("<>", "{}"), string.Concat(item.ImageFileHolder.NameWithoutExtension, ".json"));
|
string bMetadataSingletonFile = Path.Combine(bResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, $"{mappingFromItem.Id}{mappingFromItem.ImageFileHolder.ExtensionLowered}.json");
|
||||||
string bMetadataSingletonFile = Path.Combine(bResultsFullGroupDirectory, "{}", propertyConfiguration.ResultAllInOne, $"{item.Property.Id.Value}{item.ImageFileHolder.ExtensionLowered}.json");
|
|
||||||
FileInfo fileInfo = new(bMetadataSingletonFile);
|
FileInfo fileInfo = new(bMetadataSingletonFile);
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (File.Exists(usingRelativePath))
|
if (fileInfo.Directory?.Parent is null)
|
||||||
|
throw new Exception();
|
||||||
|
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
||||||
|
if (File.Exists(parentCheck))
|
||||||
{
|
{
|
||||||
File.Move(usingRelativePath, fileInfo.FullName);
|
File.Move(parentCheck, fileInfo.FullName);
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
}
|
}
|
||||||
if (!fileInfo.Exists)
|
|
||||||
{
|
|
||||||
if (fileInfo.Directory?.Parent is null)
|
|
||||||
throw new Exception();
|
|
||||||
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
|
||||||
if (File.Exists(parentCheck))
|
|
||||||
{
|
|
||||||
File.Move(parentCheck, fileInfo.FullName);
|
|
||||||
fileInfo.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (_ForceMetadataLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
if (_ForceMetadataLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public class B_Metadata
|
|||||||
}
|
}
|
||||||
if (dictionary is null || !dictionary.Any())
|
if (dictionary is null || !dictionary.Any())
|
||||||
{
|
{
|
||||||
dictionary = GetMetadataCollection(item.ImageFileHolder.FullName);
|
dictionary = GetMetadataCollection(mappingFromItem.ImageFileHolder.FullName);
|
||||||
json = JsonSerializer.Serialize(dictionary, _WriteIndentedJsonSerializerOptions);
|
json = JsonSerializer.Serialize(dictionary, _WriteIndentedJsonSerializerOptions);
|
||||||
bool updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
bool updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
||||||
DateTime? dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
DateTime? dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public abstract class Configuration
|
|||||||
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
||||||
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
||||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||||
Binder.Configuration configuration = configurationSection.Get<Binder.Configuration>();
|
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
||||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
||||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
||||||
if (result is null)
|
if (result is null)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Not.Copy.Copy</PackageId>
|
<PackageId>Phares.View.by.Distance.Not.Copy.Copy</PackageId>
|
||||||
@ -34,22 +34,18 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"WorkingDirectoryName": "PharesApps",
|
"WorkingDirectoryName": "PharesApps",
|
||||||
"Windows": {
|
"Windows": {
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"FileNameDirectorySeparator": ".Z.",
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
||||||
@ -83,8 +83,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public abstract class Configuration
|
|||||||
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
||||||
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
||||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||||
Binder.Configuration configuration = configurationSection.Get<Binder.Configuration>();
|
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
||||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
||||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
||||||
if (result is null)
|
if (result is null)
|
||||||
|
@ -148,6 +148,7 @@ public class PrepareForOld
|
|||||||
List<DateTime> dateTimes;
|
List<DateTime> dateTimes;
|
||||||
string fileNameWithoutExtension;
|
string fileNameWithoutExtension;
|
||||||
string firstFileSegmentCollection;
|
string firstFileSegmentCollection;
|
||||||
|
DateTime? dateTimeFromName = null;
|
||||||
Dictionary<int, long> keyValuePairs = new();
|
Dictionary<int, long> keyValuePairs = new();
|
||||||
Models.SaveTabSeparatedValues.IndexInfo[]? indexCollection;
|
Models.SaveTabSeparatedValues.IndexInfo[]? indexCollection;
|
||||||
List<Models.SaveTabSeparatedValues.ImageExifInfo> exifCollection = GetExifCollection(infoDirectory, infoDirectoryExtra, checkDistinct);
|
List<Models.SaveTabSeparatedValues.ImageExifInfo> exifCollection = GetExifCollection(infoDirectory, infoDirectoryExtra, checkDistinct);
|
||||||
@ -156,7 +157,7 @@ public class PrepareForOld
|
|||||||
indexInfoFiles.AddRange(Directory.GetFiles(infoDirectoryExtra, "IndexInfo.json", SearchOption.AllDirectories));
|
indexInfoFiles.AddRange(Directory.GetFiles(infoDirectoryExtra, "IndexInfo.json", SearchOption.AllDirectories));
|
||||||
foreach (Models.SaveTabSeparatedValues.ImageExifInfo exifInfo in exifCollection)
|
foreach (Models.SaveTabSeparatedValues.ImageExifInfo exifInfo in exifCollection)
|
||||||
{
|
{
|
||||||
dateTimes = Shared.Models.Stateless.Methods.IProperty.GetDateTimes(exifInfo.CreationTime, exifInfo.LastWriteTime, exifInfo.DateTime, exifInfo.DateTimeDigitized, exifInfo.DateTimeOriginal, exifInfo.GPSDateStamp);
|
dateTimes = Shared.Models.Stateless.Methods.IProperty.GetDateTimes(exifInfo.CreationTime, exifInfo.LastWriteTime, exifInfo.DateTime, dateTimeFromName, exifInfo.DateTimeDigitized, exifInfo.DateTimeOriginal, exifInfo.GPSDateStamp);
|
||||||
if (!checkDistinct && keyValuePairs.ContainsKey(exifInfo.Index))
|
if (!checkDistinct && keyValuePairs.ContainsKey(exifInfo.Index))
|
||||||
continue;
|
continue;
|
||||||
keyValuePairs.Add(exifInfo.Index, dateTimes.Min().Ticks);
|
keyValuePairs.Add(exifInfo.Index, dateTimes.Min().Ticks);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.PrepareForOld</PackageId>
|
<PackageId>Phares.View.by.Distance.PrepareForOld</PackageId>
|
||||||
@ -34,18 +34,18 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"WorkingDirectoryName": "PharesApps",
|
"WorkingDirectoryName": "PharesApps",
|
||||||
"Windows": {
|
"Windows": {
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"DateGroup": "2022-10-23",
|
"DateGroup": "2022-11-12",
|
||||||
"FileNameDirectorySeparator": ".Z.",
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
"KeepFullPath": false,
|
"KeepFullPath": false,
|
||||||
@ -108,8 +108,6 @@
|
|||||||
"ValidMetadataExtensions": [
|
"ValidMetadataExtensions": [
|
||||||
".3gp",
|
".3gp",
|
||||||
".3GP",
|
".3GP",
|
||||||
".amr",
|
|
||||||
".AMR",
|
|
||||||
".avi",
|
".avi",
|
||||||
".AVI",
|
".AVI",
|
||||||
".bmp",
|
".bmp",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Property.Compare</PackageId>
|
<PackageId>Phares.View.by.Distance.Property.Compare</PackageId>
|
||||||
@ -34,12 +34,10 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -8,7 +8,6 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using View_by_Distance.Property.Models.Stateless;
|
using View_by_Distance.Property.Models.Stateless;
|
||||||
using View_by_Distance.Shared.Models;
|
using View_by_Distance.Shared.Models;
|
||||||
using View_by_Distance.Shared.Models.Properties;
|
|
||||||
using View_by_Distance.Shared.Models.Stateless;
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Property.Models;
|
namespace View_by_Distance.Property.Models;
|
||||||
@ -63,41 +62,9 @@ public class A_Property
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<DateTime> GetMetadataDateTimesByPattern(string dateTimeFormat, string filteredSourceDirectoryFile)
|
|
||||||
{
|
|
||||||
List<DateTime> results = new();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DateTime checkDateTime;
|
|
||||||
DateTime kristy = new(1976, 3, 8);
|
|
||||||
IReadOnlyList<MetadataExtractor.Directory> directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(filteredSourceDirectoryFile);
|
|
||||||
foreach (MetadataExtractor.Directory directory in directories)
|
|
||||||
{
|
|
||||||
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(tag.Description) || tag.Description.Length != dateTimeFormat.Length)
|
|
||||||
continue;
|
|
||||||
if (!DateTime.TryParseExact(tag.Description, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
|
||||||
continue;
|
|
||||||
if (checkDateTime < kristy)
|
|
||||||
continue;
|
|
||||||
results.Add(checkDateTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception) { }
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<DateTime> GetMetadataDateTimesByPattern(string dateTimeFormat, IFileHolder filteredSourceDirectoryFileHolder)
|
|
||||||
{
|
|
||||||
List<DateTime> results = GetMetadataDateTimesByPattern(dateTimeFormat, filteredSourceDirectoryFileHolder.FullName);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable CA1416
|
#pragma warning disable CA1416
|
||||||
|
|
||||||
private Shared.Models.Property GetImageProperty(IFileHolder fileHolder, Shared.Models.Property? property, bool populateId, bool isIgnoreExtension, bool isValidImageFormatExtension, bool isValidMetadataExtensions, int? id, List<int> indices)
|
private Shared.Models.Property GetImageProperty(FileHolder fileHolder, Shared.Models.Property? property, bool populateId, bool isIgnoreExtension, bool isValidImageFormatExtension, bool isValidMetadataExtensions, int? id, List<int> indices)
|
||||||
{
|
{
|
||||||
Shared.Models.Property result;
|
Shared.Models.Property result;
|
||||||
if (_Log is null)
|
if (_Log is null)
|
||||||
@ -119,10 +86,11 @@ public class A_Property
|
|||||||
DateTime? dateTimeOriginal = null;
|
DateTime? dateTimeOriginal = null;
|
||||||
string orientation = string.Empty;
|
string orientation = string.Empty;
|
||||||
DateTime? dateTimeDigitized = null;
|
DateTime? dateTimeDigitized = null;
|
||||||
|
DateTime? dateTimeFromName = Shared.Models.Stateless.Methods.IProperty.GetDateTimeFromName(fileHolder);
|
||||||
if (!isValidImageFormatExtension && isValidMetadataExtensions && fileHolder.Exists)
|
if (!isValidImageFormatExtension && isValidMetadataExtensions && fileHolder.Exists)
|
||||||
{
|
{
|
||||||
dateTimeFormat = "ddd MMM dd HH:mm:ss yyyy";
|
dateTimeFormat = "ddd MMM dd HH:mm:ss yyyy";
|
||||||
List<DateTime> dateTimes = GetMetadataDateTimesByPattern(dateTimeFormat, fileHolder);
|
List<DateTime> dateTimes = Shared.Models.Stateless.Methods.IProperty.GetMetadataDateTimesByPattern(dateTimeFormat, fileHolder);
|
||||||
if (dateTimes.Any())
|
if (dateTimes.Any())
|
||||||
dateTimeOriginal = dateTimes.Min();
|
dateTimeOriginal = dateTimes.Min();
|
||||||
}
|
}
|
||||||
@ -257,9 +225,9 @@ public class A_Property
|
|||||||
if (fileHolder.LastWriteTime is null && property?.LastWriteTime is null)
|
if (fileHolder.LastWriteTime is null && property?.LastWriteTime is null)
|
||||||
throw new NullReferenceException(nameof(fileHolder.LastWriteTime));
|
throw new NullReferenceException(nameof(fileHolder.LastWriteTime));
|
||||||
if (fileHolder.CreationTime is not null && fileHolder.LastWriteTime is not null)
|
if (fileHolder.CreationTime is not null && fileHolder.LastWriteTime is not null)
|
||||||
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeOriginal, fileLength, gpsDateStamp, height, id, indices.ToArray(), fileHolder.LastWriteTime.Value, make, model, orientation, width);
|
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginal, fileLength, gpsDateStamp, height, id, indices.ToArray(), fileHolder.LastWriteTime.Value, make, model, orientation, width);
|
||||||
else if (property is not null)
|
else if (property is not null)
|
||||||
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeOriginal, fileLength, gpsDateStamp, height, id, indices.ToArray(), property.LastWriteTime, make, model, orientation, width);
|
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginal, fileLength, gpsDateStamp, height, id, indices.ToArray(), property.LastWriteTime, make, model, orientation, width);
|
||||||
else
|
else
|
||||||
throw new NullReferenceException(nameof(property));
|
throw new NullReferenceException(nameof(property));
|
||||||
return result;
|
return result;
|
||||||
@ -270,8 +238,6 @@ public class A_Property
|
|||||||
private Shared.Models.Property GetPropertyOfPrivate(Item item, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<string> parseExceptions, bool isIgnoreExtension, bool isValidMetadataExtensions)
|
private Shared.Models.Property GetPropertyOfPrivate(Item item, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<string> parseExceptions, bool isIgnoreExtension, bool isValidMetadataExtensions)
|
||||||
{
|
{
|
||||||
Shared.Models.Property? result;
|
Shared.Models.Property? result;
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
string json;
|
string json;
|
||||||
int? id = null;
|
int? id = null;
|
||||||
List<int> indices = new();
|
List<int> indices = new();
|
||||||
@ -288,7 +254,7 @@ public class A_Property
|
|||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
}
|
}
|
||||||
List<DateTime> dateTimes = (from l in sourceDirectoryFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in sourceDirectoryFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(_Configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (fileInfo.Directory?.Parent is null)
|
if (fileInfo.Directory?.Parent is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
@ -322,8 +288,6 @@ public class A_Property
|
|||||||
json = File.ReadAllText(fileInfo.FullName);
|
json = File.ReadAllText(fileInfo.FullName);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
bool check = true;
|
bool check = true;
|
||||||
property = JsonSerializer.Deserialize<Shared.Models.Property>(json);
|
property = JsonSerializer.Deserialize<Shared.Models.Property>(json);
|
||||||
if (!isIgnoreExtension && item.ValidImageFormatExtension && ((populateId && property?.Id is null) || property?.Width is null || property?.Height is null))
|
if (!isIgnoreExtension && item.ValidImageFormatExtension && ((populateId && property?.Id is null) || property?.Width is null || property?.Height is null))
|
||||||
@ -389,8 +353,6 @@ public class A_Property
|
|||||||
}
|
}
|
||||||
if (result is null)
|
if (result is null)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
result = GetImageProperty(item.ImageFileHolder, property, populateId, isIgnoreExtension, item.ValidImageFormatExtension, isValidMetadataExtensions, id, indices);
|
result = GetImageProperty(item.ImageFileHolder, property, populateId, isIgnoreExtension, item.ValidImageFormatExtension, isValidMetadataExtensions, id, indices);
|
||||||
json = JsonSerializer.Serialize(result, _WriteIndentedJsonSerializerOptions);
|
json = JsonSerializer.Serialize(result, _WriteIndentedJsonSerializerOptions);
|
||||||
if (populateId && Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
if (populateId && Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||||
@ -436,7 +398,7 @@ public class A_Property
|
|||||||
DateTime directoryMaximumOfMinimumDateTime = DateTime.MinValue;
|
DateTime directoryMaximumOfMinimumDateTime = DateTime.MinValue;
|
||||||
foreach (Item item in items)
|
foreach (Item item in items)
|
||||||
{
|
{
|
||||||
if (!item.ValidImageFormatExtension || item.Property is null || item.ImageFileHolder is null || !item.ImageFileHolder.Exists)
|
if (!item.ValidImageFormatExtension || item.Property is null || !item.ImageFileHolder.Exists)
|
||||||
continue;
|
continue;
|
||||||
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||||
if (minimumDateTime > directoryMaximumOfMinimumDateTime)
|
if (minimumDateTime > directoryMaximumOfMinimumDateTime)
|
||||||
@ -520,8 +482,6 @@ public class A_Property
|
|||||||
|
|
||||||
private void SavePropertyParallelForWork(string sourceDirectory, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<Tuple<string, DateTime>> sourceDirectoryChanges, Item item)
|
private void SavePropertyParallelForWork(string sourceDirectory, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<Tuple<string, DateTime>> sourceDirectoryChanges, Item item)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
Shared.Models.Property property;
|
Shared.Models.Property property;
|
||||||
List<string> parseExceptions = new();
|
List<string> parseExceptions = new();
|
||||||
bool isValidMetadataExtensions = _Configuration.ValidMetadataExtensions.Contains(item.ImageFileHolder.ExtensionLowered);
|
bool isValidMetadataExtensions = _Configuration.ValidMetadataExtensions.Contains(item.ImageFileHolder.ExtensionLowered);
|
||||||
@ -529,7 +489,7 @@ public class A_Property
|
|||||||
string filteredSourceDirectoryFileExtensionLowered = Path.Combine(sourceDirectory, $"{item.ImageFileHolder.NameWithoutExtension}{item.ImageFileHolder.ExtensionLowered}");
|
string filteredSourceDirectoryFileExtensionLowered = Path.Combine(sourceDirectory, $"{item.ImageFileHolder.NameWithoutExtension}{item.ImageFileHolder.ExtensionLowered}");
|
||||||
if (item.ValidImageFormatExtension && item.ImageFileHolder.FullName.Length == filteredSourceDirectoryFileExtensionLowered.Length && item.ImageFileHolder.FullName != filteredSourceDirectoryFileExtensionLowered)
|
if (item.ValidImageFormatExtension && item.ImageFileHolder.FullName.Length == filteredSourceDirectoryFileExtensionLowered.Length && item.ImageFileHolder.FullName != filteredSourceDirectoryFileExtensionLowered)
|
||||||
File.Move(item.ImageFileHolder.FullName, filteredSourceDirectoryFileExtensionLowered);
|
File.Move(item.ImageFileHolder.FullName, filteredSourceDirectoryFileExtensionLowered);
|
||||||
if (item.Changed is null || item.Changed.Value || item.Property is null)
|
if (item.FileSizeChanged is null || item.FileSizeChanged.Value || item.LastWriteTimeChanged is null || item.LastWriteTimeChanged.Value || item.Property is null)
|
||||||
{
|
{
|
||||||
property = GetPropertyOfPrivate(item, sourceDirectoryFileTuples, parseExceptions, isIgnoreExtension, isValidMetadataExtensions);
|
property = GetPropertyOfPrivate(item, sourceDirectoryFileTuples, parseExceptions, isIgnoreExtension, isValidMetadataExtensions);
|
||||||
lock (sourceDirectoryChanges)
|
lock (sourceDirectoryChanges)
|
||||||
@ -568,19 +528,28 @@ public class A_Property
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAngleBracketCollection(string sourceDirectory)
|
public void SetAngleBracketCollection(string aResultsFullGroupDirectory, string sourceDirectory)
|
||||||
{
|
{
|
||||||
AngleBracketCollection.Clear();
|
AngleBracketCollection.Clear();
|
||||||
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(_Configuration,
|
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(_Configuration,
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
nameof(A_Property),
|
aResultsFullGroupDirectory,
|
||||||
string.Empty,
|
|
||||||
includeResizeGroup: false,
|
|
||||||
includeModel: false,
|
|
||||||
includePredictorModel: false,
|
|
||||||
contentDescription: string.Empty,
|
contentDescription: string.Empty,
|
||||||
singletonDescription: "Properties for each image",
|
singletonDescription: "Properties for each image",
|
||||||
collectionDescription: string.Empty));
|
collectionDescription: string.Empty,
|
||||||
|
converted: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAngleBracketCollection(string sourceDirectory)
|
||||||
|
{
|
||||||
|
AngleBracketCollection.Clear();
|
||||||
|
string aResultsFullGroupDirectory = IResult.GetResultsFullGroupDirectory(_Configuration,
|
||||||
|
nameof(A_Property),
|
||||||
|
string.Empty,
|
||||||
|
includeResizeGroup: false,
|
||||||
|
includeModel: false,
|
||||||
|
includePredictorModel: false);
|
||||||
|
SetAngleBracketCollection(aResultsFullGroupDirectory, sourceDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePropertyParallelWork(long ticks, Shared.Models.Container[] containers)
|
public void SavePropertyParallelWork(long ticks, Shared.Models.Container[] containers)
|
||||||
@ -633,8 +602,6 @@ public class A_Property
|
|||||||
public Shared.Models.Property GetProperty(Item item, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<string> parseExceptions)
|
public Shared.Models.Property GetProperty(Item item, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<string> parseExceptions)
|
||||||
{
|
{
|
||||||
Shared.Models.Property result;
|
Shared.Models.Property result;
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
bool angleBracketCollectionAny = AngleBracketCollection.Any();
|
bool angleBracketCollectionAny = AngleBracketCollection.Any();
|
||||||
if (!angleBracketCollectionAny)
|
if (!angleBracketCollectionAny)
|
||||||
{
|
{
|
||||||
|
@ -37,9 +37,11 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.Configuration Get(Configuration configuration)
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.ForcePropertyLastWriteTimeToCreationTime is null)
|
if (configuration.ForcePropertyLastWriteTimeToCreationTime is null)
|
||||||
throw new NullReferenceException(nameof(configuration.ForcePropertyLastWriteTimeToCreationTime));
|
throw new NullReferenceException(nameof(configuration.ForcePropertyLastWriteTimeToCreationTime));
|
||||||
if (configuration.MaxImagesInDirectoryForTopLevelFirstPass is null)
|
if (configuration.MaxImagesInDirectoryForTopLevelFirstPass is null)
|
||||||
@ -58,16 +60,11 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.ResultSingleton));
|
throw new NullReferenceException(nameof(configuration.ResultSingleton));
|
||||||
if (configuration.WriteBitmapDataBytes is null)
|
if (configuration.WriteBitmapDataBytes is null)
|
||||||
throw new NullReferenceException(nameof(configuration.WriteBitmapDataBytes));
|
throw new NullReferenceException(nameof(configuration.WriteBitmapDataBytes));
|
||||||
if (configuration.IgnoreExtensions is null)
|
configuration.IgnoreExtensions ??= Array.Empty<string>();
|
||||||
configuration.IgnoreExtensions = Array.Empty<string>();
|
configuration.PropertyContentCollectionFiles ??= Array.Empty<string>();
|
||||||
if (configuration.PropertyContentCollectionFiles is null)
|
configuration.ValidImageFormatExtensions ??= Array.Empty<string>();
|
||||||
configuration.PropertyContentCollectionFiles = Array.Empty<string>();
|
configuration.ValidMetadataExtensions ??= Array.Empty<string>();
|
||||||
if (configuration.ValidImageFormatExtensions is null)
|
configuration.VerifyToSeason ??= Array.Empty<string>();
|
||||||
configuration.ValidImageFormatExtensions = Array.Empty<string>();
|
|
||||||
if (configuration.ValidMetadataExtensions is null)
|
|
||||||
configuration.ValidMetadataExtensions = Array.Empty<string>();
|
|
||||||
if (configuration.VerifyToSeason is null)
|
|
||||||
configuration.VerifyToSeason = Array.Empty<string>();
|
|
||||||
result = new(configuration.DateGroup,
|
result = new(configuration.DateGroup,
|
||||||
configuration.FileNameDirectorySeparator,
|
configuration.FileNameDirectorySeparator,
|
||||||
configuration.ForcePropertyLastWriteTimeToCreationTime.Value,
|
configuration.ForcePropertyLastWriteTimeToCreationTime.Value,
|
||||||
@ -92,7 +89,7 @@ public class Configuration
|
|||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot)
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
Configuration configuration;
|
Configuration? configuration;
|
||||||
if (isEnvironment is null)
|
if (isEnvironment is null)
|
||||||
configuration = configurationRoot.Get<Configuration>();
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
else
|
else
|
||||||
|
@ -150,13 +150,18 @@ public class Container
|
|||||||
private static Item GetNewItem(Configuration configuration, A_Property propertyLogic, string relativePath, FileHolder sourceDirectoryFileHolder)
|
private static Item GetNewItem(Configuration configuration, A_Property propertyLogic, string relativePath, FileHolder sourceDirectoryFileHolder)
|
||||||
{
|
{
|
||||||
Item result;
|
Item result;
|
||||||
List<string> parseExceptions = new();
|
|
||||||
Shared.Models.Property? property = null;
|
Shared.Models.Property? property = null;
|
||||||
List<Tuple<string, DateTime>> subFileTuples = new();
|
|
||||||
bool isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(sourceDirectoryFileHolder.ExtensionLowered);
|
bool isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(sourceDirectoryFileHolder.ExtensionLowered);
|
||||||
Item item = new(sourceDirectoryFileHolder.FullName, relativePath, sourceDirectoryFileHolder, isValidImageFormatExtension, property, null, null);
|
if (configuration.PopulatePropertyId)
|
||||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
result = new(sourceDirectoryFileHolder.FullName, relativePath, sourceDirectoryFileHolder, isValidImageFormatExtension, property, null, null, null);
|
||||||
result = new(sourceDirectoryFileHolder.FullName, relativePath, sourceDirectoryFileHolder, isValidImageFormatExtension, property, null, null);
|
else
|
||||||
|
{
|
||||||
|
List<string> parseExceptions = new();
|
||||||
|
List<Tuple<string, DateTime>> subFileTuples = new();
|
||||||
|
Item item = new(sourceDirectoryFileHolder.FullName, relativePath, sourceDirectoryFileHolder, isValidImageFormatExtension, property, null, null, null);
|
||||||
|
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||||
|
result = new(sourceDirectoryFileHolder.FullName, relativePath, sourceDirectoryFileHolder, isValidImageFormatExtension, property, null, null, null);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,10 +176,12 @@ public class Container
|
|||||||
List<Item> items;
|
List<Item> items;
|
||||||
string keyWithJson;
|
string keyWithJson;
|
||||||
string relativePath;
|
string relativePath;
|
||||||
|
bool fileSizeChanged;
|
||||||
FileHolder keyFileHolder;
|
FileHolder keyFileHolder;
|
||||||
|
bool lastWriteTimeChanged;
|
||||||
bool isValidImageFormatExtension;
|
bool isValidImageFormatExtension;
|
||||||
Shared.Models.Container container;
|
|
||||||
List<string> keySourceDirectories;
|
List<string> keySourceDirectories;
|
||||||
|
Shared.Models.Container container;
|
||||||
Dictionary<string, Shared.Models.Container> keyValuePairs = new();
|
Dictionary<string, Shared.Models.Container> keyValuePairs = new();
|
||||||
Dictionary<string, (string SourceDirectory, FileHolder FileHolder)> fileHolderKeyValuePairs = new();
|
Dictionary<string, (string SourceDirectory, FileHolder FileHolder)> fileHolderKeyValuePairs = new();
|
||||||
length = configuration.RootDirectory.Length;
|
length = configuration.RootDirectory.Length;
|
||||||
@ -205,7 +212,7 @@ public class Container
|
|||||||
continue;
|
continue;
|
||||||
keySourceDirectories.Add(string.Concat(keyFileHolder.DirectoryName));
|
keySourceDirectories.Add(string.Concat(keyFileHolder.DirectoryName));
|
||||||
isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(keyFileHolder.ExtensionLowered);
|
isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(keyFileHolder.ExtensionLowered);
|
||||||
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, true, null);
|
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, true, null, null);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -218,11 +225,13 @@ public class Container
|
|||||||
continue;
|
continue;
|
||||||
isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(keyFileHolder.ExtensionLowered);
|
isValidImageFormatExtension = configuration.ValidImageFormatExtensions.Contains(keyFileHolder.ExtensionLowered);
|
||||||
if (property?.Id is null || property?.Width is null || property?.Height is null)
|
if (property?.Id is null || property?.Width is null || property?.Height is null)
|
||||||
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, false, null);
|
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, false, null, null);
|
||||||
else if (configuration.PropertiesChangedForProperty || property.LastWriteTime != keyFileHolder.LastWriteTime || property.FileSize != keyFileHolder.Length)
|
|
||||||
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, false, true);
|
|
||||||
else
|
else
|
||||||
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, false, false);
|
{
|
||||||
|
fileSizeChanged = property.FileSize != keyFileHolder.Length;
|
||||||
|
lastWriteTimeChanged = configuration.PropertiesChangedForProperty || property.LastWriteTime != keyFileHolder.LastWriteTime;
|
||||||
|
item = new(sourceDirectoryFile, relativePath, keyFileHolder, isValidImageFormatExtension, property, false, fileSizeChanged, lastWriteTimeChanged);
|
||||||
|
}
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,6 +248,7 @@ public class Container
|
|||||||
foreach ((int g, string sourceDirectory, FileHolder[] sourceDirectoryFileHolderCollection) in fileHolderGroupCollection)
|
foreach ((int g, string sourceDirectory, FileHolder[] sourceDirectoryFileHolderCollection) in fileHolderGroupCollection)
|
||||||
{
|
{
|
||||||
items = new();
|
items = new();
|
||||||
|
propertyLogic.SetAngleBracketCollection(sourceDirectory);
|
||||||
foreach (FileHolder sourceDirectoryFileHolder in sourceDirectoryFileHolderCollection)
|
foreach (FileHolder sourceDirectoryFileHolder in sourceDirectoryFileHolderCollection)
|
||||||
{
|
{
|
||||||
relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(sourceDirectoryFileHolder.FullName, length, forceExtensionToLower: true);
|
relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(sourceDirectoryFileHolder.FullName, length, forceExtensionToLower: true);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Property</PackageId>
|
<PackageId>Phares.View.by.Distance.Property</PackageId>
|
||||||
@ -17,16 +17,13 @@
|
|||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsWindows
|
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">
|
||||||
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">
|
|
||||||
true
|
true
|
||||||
</IsWindows>
|
</IsWindows>
|
||||||
<IsOSX
|
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">
|
||||||
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">
|
|
||||||
true
|
true
|
||||||
</IsOSX>
|
</IsOSX>
|
||||||
<IsLinux
|
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">
|
||||||
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">
|
|
||||||
true
|
true
|
||||||
</IsLinux>
|
</IsLinux>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -43,14 +40,12 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
<PackageReference Include="ShellProgressBar" Version="5.1.0" />
|
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -5,6 +5,8 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using View_by_Distance.Metadata.Models;
|
using View_by_Distance.Metadata.Models;
|
||||||
|
using View_by_Distance.Property.Models.Stateless;
|
||||||
|
using View_by_Distance.Shared.Models;
|
||||||
using View_by_Distance.Shared.Models.Stateless;
|
using View_by_Distance.Shared.Models.Stateless;
|
||||||
|
|
||||||
namespace View_by_Distance.Resize.Models;
|
namespace View_by_Distance.Resize.Models;
|
||||||
@ -64,6 +66,18 @@ public class C_Resize
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAngleBracketCollection(Property.Models.Configuration configuration, string cResultsFullGroupDirectory, string sourceDirectory)
|
||||||
|
{
|
||||||
|
AngleBracketCollection.Clear();
|
||||||
|
AngleBracketCollection.AddRange(IResult.GetDirectoryInfoCollection(configuration,
|
||||||
|
sourceDirectory,
|
||||||
|
cResultsFullGroupDirectory,
|
||||||
|
contentDescription: "Resized image",
|
||||||
|
singletonDescription: "Resize dimensions for each resolution",
|
||||||
|
collectionDescription: string.Empty,
|
||||||
|
converted: true));
|
||||||
|
}
|
||||||
|
|
||||||
#pragma warning disable CA1416
|
#pragma warning disable CA1416
|
||||||
|
|
||||||
public static (ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) GetGifLowQuality()
|
public static (ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) GetGifLowQuality()
|
||||||
@ -161,16 +175,12 @@ public class C_Resize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] SaveResizedSubfile3(Shared.Models.Item item, int[] resize, bool returnAndDoNotWrite, byte[] bytes)
|
private byte[] SaveResizedSubfile3(MappingFromItem mappingFromItem, int[] resize, bool returnAndDoNotWrite, byte[] bytes)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
if (item.ResizedFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ResizedFileHolder));
|
|
||||||
byte[] results;
|
byte[] results;
|
||||||
Bitmap bitmap;
|
Bitmap bitmap;
|
||||||
int outputResolutionWidth = resize[_OutputResolutionWidthIndex];
|
int outputResolutionWidth = resize[_OutputResolutionWidthIndex];
|
||||||
using Bitmap temp = new(item.ImageFileHolder.FullName, useIcm: false);
|
using Bitmap temp = new(mappingFromItem.ImageFileHolder.FullName, useIcm: false);
|
||||||
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
||||||
PropertyItem[] propertyItems = temp.PropertyItems;
|
PropertyItem[] propertyItems = temp.PropertyItems;
|
||||||
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
||||||
@ -211,21 +221,17 @@ public class C_Resize
|
|||||||
{
|
{
|
||||||
results = Array.Empty<byte>();
|
results = Array.Empty<byte>();
|
||||||
CopyPropertyItems(bytes, propertyItems, bitmap);
|
CopyPropertyItems(bytes, propertyItems, bitmap);
|
||||||
bitmap.Save(item.ResizedFileHolder.FullName, _ImageCodecInfo, _EncoderParameters);
|
bitmap.Save(mappingFromItem.ResizedFileHolder.FullName, _ImageCodecInfo, _EncoderParameters);
|
||||||
}
|
}
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] SaveResizedSubfile5(Shared.Models.Item item, int[] resize, bool returnAndDoNotWrite, byte[] bytes)
|
private byte[] SaveResizedSubfile5(MappingFromItem mappingFromItem, int[] resize, bool returnAndDoNotWrite, byte[] bytes)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
if (item.ResizedFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ResizedFileHolder));
|
|
||||||
byte[] results;
|
byte[] results;
|
||||||
Bitmap bitmap;
|
Bitmap bitmap;
|
||||||
using Bitmap temp = new(item.ImageFileHolder.FullName, useIcm: false);
|
using Bitmap temp = new(mappingFromItem.ImageFileHolder.FullName, useIcm: false);
|
||||||
PropertyItem[] propertyItems = temp.PropertyItems;
|
PropertyItem[] propertyItems = temp.PropertyItems;
|
||||||
int tempResolutionWidth = resize[_TempResolutionWidth];
|
int tempResolutionWidth = resize[_TempResolutionWidth];
|
||||||
int tempResolutionHeight = resize[_TempResolutionHeight];
|
int tempResolutionHeight = resize[_TempResolutionHeight];
|
||||||
@ -279,7 +285,7 @@ public class C_Resize
|
|||||||
{
|
{
|
||||||
results = Array.Empty<byte>();
|
results = Array.Empty<byte>();
|
||||||
CopyPropertyItems(bytes, propertyItems, bitmap);
|
CopyPropertyItems(bytes, propertyItems, bitmap);
|
||||||
bitmap.Save(item.ResizedFileHolder.FullName, _ImageCodecInfo, _EncoderParameters);
|
bitmap.Save(mappingFromItem.ResizedFileHolder.FullName, _ImageCodecInfo, _EncoderParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
@ -288,28 +294,26 @@ public class C_Resize
|
|||||||
|
|
||||||
#pragma warning restore CA1416
|
#pragma warning restore CA1416
|
||||||
|
|
||||||
private byte[] SaveResizedSubfile(Shared.Models.Item item, int[] resize, bool returnAndDoNotWrite)
|
private byte[] SaveResizedSubfile(Shared.Models.Property property, MappingFromItem mappingFromItem, int[] resize, bool returnAndDoNotWrite)
|
||||||
{
|
{
|
||||||
if (item.Property is null)
|
|
||||||
throw new NullReferenceException(nameof(item.Property));
|
|
||||||
byte[] results;
|
byte[] results;
|
||||||
// string subFile, Shared.Models.Property property, Shared.Models.FileHolder? fileHolder
|
// string subFile, Shared.Models.Property property, Shared.Models.FileHolder? fileHolder
|
||||||
string dateTimeFormat = Shared.Models.Stateless.Methods.IProperty.DateTimeFormat();
|
string dateTimeFormat = Shared.Models.Stateless.Methods.IProperty.DateTimeFormat();
|
||||||
DateTime dateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
DateTime dateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(property);
|
||||||
string dateTimeValue = dateTime.ToString(dateTimeFormat);
|
string dateTimeValue = dateTime.ToString(dateTimeFormat);
|
||||||
byte[] bytes = _ASCIIEncoding.GetBytes(dateTimeValue);
|
byte[] bytes = _ASCIIEncoding.GetBytes(dateTimeValue);
|
||||||
if (_ASCIIEncoding.GetString(bytes, 0, bytes.Length) != dateTimeValue)
|
if (_ASCIIEncoding.GetString(bytes, 0, bytes.Length) != dateTimeValue)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (resize.Length == 3)
|
if (resize.Length == 3)
|
||||||
results = SaveResizedSubfile3(item, resize, returnAndDoNotWrite, bytes);
|
results = SaveResizedSubfile3(mappingFromItem, resize, returnAndDoNotWrite, bytes);
|
||||||
else if (resize.Length == 5)
|
else if (resize.Length == 5)
|
||||||
results = SaveResizedSubfile5(item, resize, returnAndDoNotWrite, bytes);
|
results = SaveResizedSubfile5(mappingFromItem, resize, returnAndDoNotWrite, bytes);
|
||||||
else
|
else
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetResizedBytes(string outputResolution, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, Shared.Models.Item item, Dictionary<string, int[]> imageResizes)
|
public byte[] GetResizedBytes(string outputResolution, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, Shared.Models.Property property, MappingFromItem mappingFromItem, Dictionary<string, int[]> imageResizes)
|
||||||
{
|
{
|
||||||
byte[] results;
|
byte[] results;
|
||||||
if (!imageResizes.ContainsKey(outputResolution))
|
if (!imageResizes.ContainsKey(outputResolution))
|
||||||
@ -318,23 +322,19 @@ public class C_Resize
|
|||||||
int outputResolutionWidth = resize[_OutputResolutionWidthIndex];
|
int outputResolutionWidth = resize[_OutputResolutionWidthIndex];
|
||||||
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
||||||
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
||||||
results = SaveResizedSubfile(item, resize, returnAndDoNotWrite: true);
|
results = SaveResizedSubfile(property, mappingFromItem, resize, returnAndDoNotWrite: true);
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveResizedSubfile(string outputResolution, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, Shared.Models.Item item, string original, Dictionary<string, int[]> imageResizes)
|
public void SaveResizedSubfile(Property.Models.Configuration configuration, string outputResolution, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, Item item, Shared.Models.Property property, MappingFromItem mappingFromItem, string original, Dictionary<string, int[]> imageResizes)
|
||||||
{
|
{
|
||||||
if (item.Property is null)
|
if (mappingFromItem.ResizedFileHolder is null)
|
||||||
throw new NullReferenceException(nameof(item.Property));
|
throw new NullReferenceException(nameof(mappingFromItem.ResizedFileHolder));
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
if (item.ResizedFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ResizedFileHolder));
|
|
||||||
if (!imageResizes.ContainsKey(outputResolution))
|
if (!imageResizes.ContainsKey(outputResolution))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
FileInfo fileInfo = new(item.ResizedFileHolder.FullName);
|
FileInfo fileInfo = new(mappingFromItem.ResizedFileHolder.FullName);
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (fileInfo.Directory?.Parent is null)
|
if (fileInfo.Directory?.Parent is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
@ -342,7 +342,7 @@ public class C_Resize
|
|||||||
if (File.Exists(parentCheck))
|
if (File.Exists(parentCheck))
|
||||||
{
|
{
|
||||||
File.Move(parentCheck, fileInfo.FullName);
|
File.Move(parentCheck, fileInfo.FullName);
|
||||||
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(item.ResizedFileHolder));
|
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(mappingFromItem.ResizedFileHolder));
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,8 +355,8 @@ public class C_Resize
|
|||||||
{
|
{
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.Exists)
|
||||||
{
|
{
|
||||||
File.Copy(item.ImageFileHolder.FullName, fileInfo.FullName);
|
File.Copy(mappingFromItem.ImageFileHolder.FullName, fileInfo.FullName);
|
||||||
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(item.ResizedFileHolder));
|
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(mappingFromItem.ResizedFileHolder));
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,14 +373,14 @@ public class C_Resize
|
|||||||
check = true;
|
check = true;
|
||||||
if (check)
|
if (check)
|
||||||
{
|
{
|
||||||
_ = SaveResizedSubfile(item, resize, returnAndDoNotWrite: false);
|
_ = SaveResizedSubfile(property, mappingFromItem, resize, returnAndDoNotWrite: false);
|
||||||
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(item.ResizedFileHolder));
|
item.SetResizedFileHolder(_FileNameExtension, Shared.Models.Stateless.Methods.IFileHolder.Refresh(mappingFromItem.ResizedFileHolder));
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(C_Resize), DateTime.Now));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] GetCollection(string outputResolution)
|
private static int[] GetCollection(string outputResolution)
|
||||||
{
|
{
|
||||||
List<int> results = new();
|
List<int> results = new();
|
||||||
string[] segments = outputResolution.Split('x');
|
string[] segments = outputResolution.Split('x');
|
||||||
@ -447,37 +447,30 @@ public class C_Resize
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, int[]> GetResizeKeyValuePairs(Property.Models.Configuration configuration, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, string original, List<KeyValuePair<string, string>> metadataCollection, Shared.Models.Item item)
|
public FileHolder GetResizedFileHolder(Item item)
|
||||||
|
{
|
||||||
|
FileHolder result = new(Path.Combine(AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(item.ImageFileHolder.FullName)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, int[]> GetResizeKeyValuePairs(Property.Models.Configuration configuration, string cResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, string original, List<KeyValuePair<string, string>> metadataCollection, Shared.Models.Property property, MappingFromItem mappingFromItem)
|
||||||
{
|
{
|
||||||
Dictionary<string, int[]> results;
|
Dictionary<string, int[]> results;
|
||||||
if (item.Property?.Id is null)
|
|
||||||
throw new NullReferenceException(nameof(item.Property.Id));
|
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
|
||||||
string json;
|
string json;
|
||||||
string[] changesFrom = new string[] { nameof(Property.Models.A_Property), nameof(B_Metadata) };
|
string[] changesFrom = new string[] { nameof(Property.Models.A_Property), nameof(B_Metadata) };
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
string usingRelativePath = Path.Combine(AngleBracketCollection[0].Replace("<>", "{}"), string.Concat(item.ImageFileHolder.NameWithoutExtension, ".json"));
|
string cResizeSingletonFile = Path.Combine(cResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, $"{mappingFromItem.Id}{mappingFromItem.ImageFileHolder.ExtensionLowered}.json");
|
||||||
string cResizeSingletonFile = Path.Combine(cResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, $"{item.Property.Id.Value}{item.ImageFileHolder.ExtensionLowered}.json");
|
|
||||||
FileInfo fileInfo = new(cResizeSingletonFile);
|
FileInfo fileInfo = new(cResizeSingletonFile);
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.FullName.Contains(configuration.ResultAllInOne) && !fileInfo.Exists)
|
||||||
{
|
{
|
||||||
if (File.Exists(usingRelativePath))
|
if (fileInfo.Directory?.Parent is null)
|
||||||
|
throw new Exception();
|
||||||
|
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
||||||
|
if (File.Exists(parentCheck))
|
||||||
{
|
{
|
||||||
File.Move(usingRelativePath, fileInfo.FullName);
|
File.Move(parentCheck, fileInfo.FullName);
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
}
|
}
|
||||||
if (!fileInfo.Exists)
|
|
||||||
{
|
|
||||||
if (fileInfo.Directory?.Parent is null)
|
|
||||||
throw new Exception();
|
|
||||||
string parentCheck = Path.Combine(fileInfo.Directory.Parent.FullName, fileInfo.Name);
|
|
||||||
if (File.Exists(parentCheck))
|
|
||||||
{
|
|
||||||
File.Move(parentCheck, fileInfo.FullName);
|
|
||||||
fileInfo.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (_ForceResizeLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
if (_ForceResizeLastWriteTimeToCreationTime && !fileInfo.Exists && File.Exists(Path.ChangeExtension(fileInfo.FullName, ".delete")))
|
||||||
{
|
{
|
||||||
@ -509,7 +502,7 @@ public class C_Resize
|
|||||||
results = keyValuePairs;
|
results = keyValuePairs;
|
||||||
if ((from l in results where l.Value[0] == l.Value[1] select true).Any())
|
if ((from l in results where l.Value[0] == l.Value[1] select true).Any())
|
||||||
{
|
{
|
||||||
results = GetImageResizes(item.Property, metadataCollection, original);
|
results = GetImageResizes(property, metadataCollection, original);
|
||||||
if (!(from l in results where l.Value[0] == l.Value[1] select true).Any())
|
if (!(from l in results where l.Value[0] == l.Value[1] select true).Any())
|
||||||
throw new Exception("Was square!");
|
throw new Exception("Was square!");
|
||||||
}
|
}
|
||||||
@ -523,7 +516,7 @@ public class C_Resize
|
|||||||
}
|
}
|
||||||
if (results is null || !results.Any())
|
if (results is null || !results.Any())
|
||||||
{
|
{
|
||||||
results = GetImageResizes(item.Property, metadataCollection, original);
|
results = GetImageResizes(property, metadataCollection, original);
|
||||||
json = JsonSerializer.Serialize(results, _WriteIndentedJsonSerializerOptions);
|
json = JsonSerializer.Serialize(results, _WriteIndentedJsonSerializerOptions);
|
||||||
bool updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
bool updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
||||||
DateTime? dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
DateTime? dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
||||||
@ -539,8 +532,6 @@ public class C_Resize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Shared.Models.FileHolder fileHolder = new(Path.Combine(AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(item.ImageFileHolder.FullName)));
|
|
||||||
item.SetResizedFileHolder(_FileNameExtension, fileHolder);
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>library</OutputType>
|
<OutputType>library</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Resize</PackageId>
|
<PackageId>Phares.View.by.Distance.Resize</PackageId>
|
||||||
@ -34,12 +34,10 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
</ItemGroup>
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<ItemGroup>
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -13,7 +13,6 @@ public class Face : Properties.IFace
|
|||||||
protected readonly OutputResolution? _OutputResolution;
|
protected readonly OutputResolution? _OutputResolution;
|
||||||
protected Location? _Location;
|
protected Location? _Location;
|
||||||
protected Mapping? _Mapping;
|
protected Mapping? _Mapping;
|
||||||
protected readonly string _RelativePath;
|
|
||||||
public DateTime DateTime => _DateTime;
|
public DateTime DateTime => _DateTime;
|
||||||
public FaceDistance? FaceDistance => _FaceDistance;
|
public FaceDistance? FaceDistance => _FaceDistance;
|
||||||
public FaceEncoding? FaceEncoding => _FaceEncoding;
|
public FaceEncoding? FaceEncoding => _FaceEncoding;
|
||||||
@ -21,10 +20,9 @@ public class Face : Properties.IFace
|
|||||||
public Location? Location => _Location;
|
public Location? Location => _Location;
|
||||||
public Mapping? Mapping => _Mapping;
|
public Mapping? Mapping => _Mapping;
|
||||||
public OutputResolution? OutputResolution => _OutputResolution;
|
public OutputResolution? OutputResolution => _OutputResolution;
|
||||||
public string RelativePath => _RelativePath;
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Face(DateTime dateTime, FaceDistance? faceDistance, FaceEncoding? faceEncoding, Dictionary<Stateless.FacePart, FacePoint[]>? faceParts, Location? location, Mapping? mapping, OutputResolution? outputResolution, string relativePath)
|
public Face(DateTime dateTime, FaceDistance? faceDistance, FaceEncoding? faceEncoding, Dictionary<Stateless.FacePart, FacePoint[]>? faceParts, Location? location, Mapping? mapping, OutputResolution? outputResolution)
|
||||||
{
|
{
|
||||||
_DateTime = dateTime;
|
_DateTime = dateTime;
|
||||||
_FaceDistance = faceDistance;
|
_FaceDistance = faceDistance;
|
||||||
@ -33,27 +31,26 @@ public class Face : Properties.IFace
|
|||||||
_Location = location;
|
_Location = location;
|
||||||
_Mapping = mapping;
|
_Mapping = mapping;
|
||||||
_OutputResolution = outputResolution;
|
_OutputResolution = outputResolution;
|
||||||
_RelativePath = relativePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face(int locationDigits, int locationFactor, int facesCount, Face face) :
|
public Face(int locationDigits, int locationFactor, int facesCount, Face face) :
|
||||||
this(face.DateTime, null, face.FaceEncoding, face.FaceParts, face.Location, null, face.OutputResolution, face.RelativePath)
|
this(face.DateTime, null, face.FaceEncoding, face.FaceParts, face.Location, null, face.OutputResolution)
|
||||||
{
|
{
|
||||||
if (face.Location?.Confidence is not null && face.OutputResolution is not null)
|
if (face.Location?.Confidence is not null && face.OutputResolution is not null)
|
||||||
_Location = new(face.Location.Confidence, face.OutputResolution.Height, face.Location, locationDigits, locationFactor, face.OutputResolution.Width, facesCount);
|
_Location = new(face.Location.Confidence, face.OutputResolution.Height, face.Location, locationDigits, locationFactor, face.OutputResolution.Width, facesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face(Property property, int outputResolutionWidth, int outputResolutionHeight, int outputResolutionOrientation, string relativePath, Location? location) :
|
public Face(Property property, int outputResolutionWidth, int outputResolutionHeight, int outputResolutionOrientation, Location? location) :
|
||||||
this(DateTime.MinValue, null, null, null, location, null, null, relativePath)
|
this(DateTime.MinValue, null, null, null, location, null, null)
|
||||||
{
|
{
|
||||||
DateTime?[] dateTimes;
|
DateTime?[] dateTimes;
|
||||||
_OutputResolution = new(outputResolutionHeight, outputResolutionOrientation, outputResolutionWidth);
|
_OutputResolution = new(outputResolutionHeight, outputResolutionOrientation, outputResolutionWidth);
|
||||||
dateTimes = new DateTime?[] { property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeOriginal, property.GPSDateStamp };
|
dateTimes = new DateTime?[] { property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeFromName, property.DateTimeOriginal, property.GPSDateStamp };
|
||||||
_DateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
_DateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face(Face face, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
|
public Face(Face face, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
|
||||||
this(face.DateTime, face.FaceDistance, face.FaceEncoding, face.FaceParts, new(height, location, locationDigits, locationFactor, width, zCount), face.Mapping, face.OutputResolution, face.RelativePath)
|
this(face.DateTime, face.FaceDistance, face.FaceEncoding, face.FaceParts, new(height, location, locationDigits, locationFactor, width, zCount), face.Mapping, face.OutputResolution)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -144,9 +144,9 @@ public class FaceFileSystem : FileSystem, Properties.IFaceFileSystem
|
|||||||
faceHeight = face.Location.Bottom - face.Location.Top;
|
faceHeight = face.Location.Bottom - face.Location.Top;
|
||||||
confidence = face.Location.Confidence.ToString("00.000");
|
confidence = face.Location.Confidence.ToString("00.000");
|
||||||
}
|
}
|
||||||
string? directoryName = Path.GetDirectoryName(face.RelativePath);
|
string? directoryName = Path.GetDirectoryName("face.RelativePath");
|
||||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(face.RelativePath);
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension("face.RelativePath");
|
||||||
string sourceFullFileName = string.Concat(cResizeContent, face.RelativePath);
|
string sourceFullFileName = string.Concat(cResizeContent, "face.RelativePath");
|
||||||
if (directoryName is null)
|
if (directoryName is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
string faceFullFileName = Path.Combine($"{dFacesContentDirectory}{directoryName}", fileNameWithoutExtension, $"{locationIndex} - {fileNameWithoutExtension}.png");
|
string faceFullFileName = Path.Combine($"{dFacesContentDirectory}{directoryName}", fileNameWithoutExtension, $"{locationIndex} - {fileNameWithoutExtension}.png");
|
||||||
|
@ -7,9 +7,10 @@ public class Item : Properties.IItem
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected readonly bool? _Abandoned;
|
protected readonly bool? _Abandoned;
|
||||||
protected readonly bool? _Changed;
|
|
||||||
protected List<Face> _Faces;
|
protected List<Face> _Faces;
|
||||||
protected readonly FileHolder? _ImageFileHolder;
|
protected readonly bool? _FileSizeChanged;
|
||||||
|
protected readonly FileHolder _ImageFileHolder;
|
||||||
|
protected bool? _LastWriteTimeChanged;
|
||||||
protected bool? _Moved;
|
protected bool? _Moved;
|
||||||
protected readonly bool? _NoJson;
|
protected readonly bool? _NoJson;
|
||||||
protected Property? _Property;
|
protected Property? _Property;
|
||||||
@ -18,9 +19,10 @@ public class Item : Properties.IItem
|
|||||||
protected readonly string _SourceDirectoryFile;
|
protected readonly string _SourceDirectoryFile;
|
||||||
protected bool _ValidImageFormatExtension;
|
protected bool _ValidImageFormatExtension;
|
||||||
public bool? Abandoned => _Abandoned;
|
public bool? Abandoned => _Abandoned;
|
||||||
public bool? Changed => _Changed;
|
|
||||||
public List<Face> Faces => _Faces;
|
public List<Face> Faces => _Faces;
|
||||||
public FileHolder? ImageFileHolder => _ImageFileHolder;
|
public bool? FileSizeChanged => _FileSizeChanged;
|
||||||
|
public FileHolder ImageFileHolder => _ImageFileHolder;
|
||||||
|
public bool? LastWriteTimeChanged => _LastWriteTimeChanged;
|
||||||
public bool? Moved => _Moved;
|
public bool? Moved => _Moved;
|
||||||
public bool? NoJson => _NoJson;
|
public bool? NoJson => _NoJson;
|
||||||
public Property? Property => _Property;
|
public Property? Property => _Property;
|
||||||
@ -30,32 +32,25 @@ public class Item : Properties.IItem
|
|||||||
public bool ValidImageFormatExtension => _ValidImageFormatExtension;
|
public bool ValidImageFormatExtension => _ValidImageFormatExtension;
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Item(bool? abandoned, bool? changed, List<Face> faces, FileHolder? imageFileHolder, bool? moved, bool? noJson, Property? property, string relativePath, FileHolder? resizedFileHolder, string sourceDirectoryFile, bool validImageFormatExtension)
|
public Item(bool? abandoned, List<Face> faces, bool? fileSizeChanged, FileHolder imageFileHolder, bool? lastWriteTimeChanged, bool? moved, bool? noJson, Property? property, string relativePath, FileHolder? resizedFileHolder, string sourceDirectoryFile, bool validImageFormatExtension)
|
||||||
{
|
{
|
||||||
_Abandoned = abandoned;
|
|
||||||
_Changed = changed;
|
|
||||||
_Faces = faces;
|
_Faces = faces;
|
||||||
_ImageFileHolder = imageFileHolder;
|
|
||||||
_Moved = moved;
|
_Moved = moved;
|
||||||
_NoJson = noJson;
|
_NoJson = noJson;
|
||||||
_Property = property;
|
_Property = property;
|
||||||
|
_Abandoned = abandoned;
|
||||||
_RelativePath = relativePath;
|
_RelativePath = relativePath;
|
||||||
|
_FileSizeChanged = fileSizeChanged;
|
||||||
|
_ImageFileHolder = imageFileHolder;
|
||||||
_ResizedFileHolder = resizedFileHolder;
|
_ResizedFileHolder = resizedFileHolder;
|
||||||
_SourceDirectoryFile = sourceDirectoryFile;
|
_SourceDirectoryFile = sourceDirectoryFile;
|
||||||
|
_LastWriteTimeChanged = lastWriteTimeChanged;
|
||||||
_ValidImageFormatExtension = validImageFormatExtension;
|
_ValidImageFormatExtension = validImageFormatExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item(string sourceDirectoryFile, string relativePath, FileHolder imageFileInfo, bool isValidImageFormatExtension, Property? property, bool? abandoned, bool? changed)
|
public Item(string sourceDirectoryFile, string relativePath, FileHolder imageFileInfo, bool validImageFormatExtension, Property? property, bool? abandoned, bool? fileSizeChanged, bool? lastWriteTimeChanged) :
|
||||||
|
this(abandoned, new(), fileSizeChanged, imageFileInfo, lastWriteTimeChanged, null, abandoned is null, property, relativePath, null, sourceDirectoryFile, validImageFormatExtension)
|
||||||
{
|
{
|
||||||
_Faces = new();
|
|
||||||
_Changed = changed;
|
|
||||||
_Property = property;
|
|
||||||
_Abandoned = abandoned;
|
|
||||||
_NoJson = abandoned is null;
|
|
||||||
_RelativePath = relativePath;
|
|
||||||
_ImageFileHolder = imageFileInfo;
|
|
||||||
_SourceDirectoryFile = sourceDirectoryFile;
|
|
||||||
_ValidImageFormatExtension = isValidImageFormatExtension;
|
|
||||||
if (relativePath.EndsWith(".json"))
|
if (relativePath.EndsWith(".json"))
|
||||||
throw new ArgumentException("Can not be a *.json file!");
|
throw new ArgumentException("Can not be a *.json file!");
|
||||||
if (imageFileInfo is not null && imageFileInfo.ExtensionLowered is ".json")
|
if (imageFileInfo is not null && imageFileInfo.ExtensionLowered is ".json")
|
||||||
@ -63,7 +58,7 @@ public class Item : Properties.IItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Item(string sourceDirectoryFile, string relativePath, bool isValidImageFormatExtension) :
|
public Item(string sourceDirectoryFile, string relativePath, bool isValidImageFormatExtension) :
|
||||||
this(sourceDirectoryFile, relativePath, new(sourceDirectoryFile), isValidImageFormatExtension, null, null, null)
|
this(sourceDirectoryFile, relativePath, new(sourceDirectoryFile), isValidImageFormatExtension, null, null, null, null)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
@ -84,7 +79,7 @@ public class Item : Properties.IItem
|
|||||||
_ResizedFileHolder = fileHolder;
|
_ResizedFileHolder = fileHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Any() => (_Abandoned.HasValue && _Abandoned.Value) || (_Changed.HasValue && _Changed.Value) || (_Moved.HasValue && _Moved.Value) || (_NoJson.HasValue && _NoJson.Value);
|
public bool Any() => (_Abandoned.HasValue && _Abandoned.Value) || (_FileSizeChanged.HasValue && _FileSizeChanged.Value) || (_LastWriteTimeChanged.HasValue && _LastWriteTimeChanged.Value) || (_Moved.HasValue && _Moved.Value) || (_NoJson.HasValue && _NoJson.Value);
|
||||||
|
|
||||||
public void Update(Property property) => _Property = property;
|
public void Update(Property property) => _Property = property;
|
||||||
|
|
||||||
|
@ -30,6 +30,21 @@ public class MappingFromItem : Properties.IMappingFromItem
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static MappingFromItem GetMappingFromItem(Item item, FileHolder? resizedFileHolder)
|
||||||
|
{
|
||||||
|
MappingFromItem result;
|
||||||
|
bool? isWrongYear;
|
||||||
|
DateTime minimumDateTime;
|
||||||
|
if (item.Property?.Id is null)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
if (resizedFileHolder is null)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
minimumDateTime = Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||||
|
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
||||||
|
result = new(item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, resizedFileHolder);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||||
|
@ -9,6 +9,5 @@ public interface IFace
|
|||||||
public Dictionary<Stateless.FacePart, FacePoint[]>? FaceParts { get; }
|
public Dictionary<Stateless.FacePart, FacePoint[]>? FaceParts { get; }
|
||||||
public Mapping? Mapping { get; }
|
public Mapping? Mapping { get; }
|
||||||
public OutputResolution? OutputResolution { get; }
|
public OutputResolution? OutputResolution { get; }
|
||||||
public string RelativePath { get; }
|
|
||||||
|
|
||||||
}
|
}
|
@ -4,9 +4,9 @@ public interface IItem
|
|||||||
{
|
{
|
||||||
|
|
||||||
public bool? Abandoned { get; }
|
public bool? Abandoned { get; }
|
||||||
public bool? Changed { get; }
|
public bool? FileSizeChanged { get; }
|
||||||
public List<Face> Faces { get; }
|
public List<Face> Faces { get; }
|
||||||
public FileHolder? ImageFileHolder { get; }
|
public FileHolder ImageFileHolder { get; }
|
||||||
public bool? Moved { get; }
|
public bool? Moved { get; }
|
||||||
public bool? NoJson { get; }
|
public bool? NoJson { get; }
|
||||||
public Property? Property { get; }
|
public Property? Property { get; }
|
||||||
|
@ -6,6 +6,7 @@ public interface IProperty
|
|||||||
public DateTime CreationTime { get; }
|
public DateTime CreationTime { get; }
|
||||||
public DateTime? DateTime { get; }
|
public DateTime? DateTime { get; }
|
||||||
public DateTime? DateTimeDigitized { get; }
|
public DateTime? DateTimeDigitized { get; }
|
||||||
|
public DateTime? DateTimeFromName { get; }
|
||||||
public DateTime? DateTimeOriginal { get; }
|
public DateTime? DateTimeOriginal { get; }
|
||||||
public long FileSize { get; }
|
public long FileSize { get; }
|
||||||
public DateTime? GPSDateStamp { get; }
|
public DateTime? GPSDateStamp { get; }
|
||||||
|
@ -9,6 +9,7 @@ public class Property : Properties.IProperty
|
|||||||
protected DateTime _CreationTime;
|
protected DateTime _CreationTime;
|
||||||
protected DateTime? _DateTime;
|
protected DateTime? _DateTime;
|
||||||
protected DateTime? _DateTimeDigitized;
|
protected DateTime? _DateTimeDigitized;
|
||||||
|
protected DateTime? _DateTimeFromName;
|
||||||
protected DateTime? _DateTimeOriginal;
|
protected DateTime? _DateTimeOriginal;
|
||||||
protected long _FileSize;
|
protected long _FileSize;
|
||||||
protected DateTime? _GPSDateStamp;
|
protected DateTime? _GPSDateStamp;
|
||||||
@ -23,6 +24,7 @@ public class Property : Properties.IProperty
|
|||||||
public DateTime CreationTime => _CreationTime;
|
public DateTime CreationTime => _CreationTime;
|
||||||
public DateTime? DateTime => _DateTime;
|
public DateTime? DateTime => _DateTime;
|
||||||
public DateTime? DateTimeDigitized => _DateTimeDigitized;
|
public DateTime? DateTimeDigitized => _DateTimeDigitized;
|
||||||
|
public DateTime? DateTimeFromName => _DateTimeFromName;
|
||||||
public DateTime? DateTimeOriginal => _DateTimeOriginal;
|
public DateTime? DateTimeOriginal => _DateTimeOriginal;
|
||||||
public long FileSize => _FileSize;
|
public long FileSize => _FileSize;
|
||||||
public DateTime? GPSDateStamp => _GPSDateStamp;
|
public DateTime? GPSDateStamp => _GPSDateStamp;
|
||||||
@ -36,8 +38,9 @@ public class Property : Properties.IProperty
|
|||||||
public int? Width => _Width;
|
public int? Width => _Width;
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Property(DateTime creationTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, long fileSize, DateTime? gpsDateStamp, int? height, int? id, int[] indices, DateTime lastWriteTime, string make, string model, string orientation, int? width)
|
public Property(DateTime creationTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, long fileSize, DateTime? gpsDateStamp, int? height, int? id, int[] indices, DateTime lastWriteTime, string make, string model, string orientation, int? width)
|
||||||
{
|
{
|
||||||
|
_DateTimeFromName = dateTimeFromName;
|
||||||
_CreationTime = creationTime;
|
_CreationTime = creationTime;
|
||||||
_DateTime = dateTime;
|
_DateTime = dateTime;
|
||||||
_DateTimeDigitized = dateTimeDigitized;
|
_DateTimeDigitized = dateTimeDigitized;
|
||||||
@ -60,7 +63,7 @@ public class Property : Properties.IProperty
|
|||||||
return result;
|
return result;
|
||||||
} // ...
|
} // ...
|
||||||
|
|
||||||
public List<DateTime> GetDateTimes() => Stateless.Methods.Property.GetDateTimes(_CreationTime, _LastWriteTime, _DateTime, _DateTimeDigitized, _DateTimeOriginal, _GPSDateStamp);
|
public List<DateTime> GetDateTimes() => Stateless.Methods.Property.GetDateTimes(_CreationTime, _LastWriteTime, _DateTime, _DateTimeDigitized, _DateTimeFromName, _DateTimeOriginal, _GPSDateStamp);
|
||||||
|
|
||||||
public (bool?, string[]) IsWrongYear(FileHolder fileHolder, DateTime? minimumDateTime)
|
public (bool?, string[]) IsWrongYear(FileHolder fileHolder, DateTime? minimumDateTime)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ internal abstract class Face
|
|||||||
foreach (JsonElement jsonElement in jsonElements)
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
{
|
{
|
||||||
tuple = JsonSerializer.Deserialize<Tuple<Models.Face, string>>(jsonElement.ToString());
|
tuple = JsonSerializer.Deserialize<Tuple<Models.Face, string>>(jsonElement.ToString());
|
||||||
if (tuple is null || tuple.Item1 is null || string.IsNullOrEmpty(tuple.Item1.RelativePath))
|
if (tuple is null || tuple.Item1 is null || string.IsNullOrEmpty("tuple.Item1.RelativePath"))
|
||||||
continue;
|
continue;
|
||||||
results.Add(tuple.Item1);
|
results.Add(tuple.Item1);
|
||||||
if (maximum.HasValue && results.Count >= maximum)
|
if (maximum.HasValue && results.Count >= maximum)
|
||||||
|
@ -59,10 +59,10 @@ internal abstract class FaceFileSystem
|
|||||||
if (face[i] is null)
|
if (face[i] is null)
|
||||||
continue;
|
continue;
|
||||||
locationIndex = 0;
|
locationIndex = 0;
|
||||||
directoryName = Path.GetDirectoryName(face[i].RelativePath);
|
directoryName = Path.GetDirectoryName("face[i].RelativePath");
|
||||||
if (directoryName is null)
|
if (directoryName is null)
|
||||||
continue;
|
continue;
|
||||||
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(face[i].RelativePath);
|
fileNameWithoutExtension = Path.GetFileNameWithoutExtension("face[i].RelativePath");
|
||||||
jsonFileName = string.Concat(locationIndex.Value, " - ", fileNameWithoutExtension, extension);
|
jsonFileName = string.Concat(locationIndex.Value, " - ", fileNameWithoutExtension, extension);
|
||||||
eDistanceCollectionFileFullName = Path.Combine($"{tuple.E_DistanceCollectionDirectory}{directoryName}", fileNameWithoutExtension, jsonFileName);
|
eDistanceCollectionFileFullName = Path.Combine($"{tuple.E_DistanceCollectionDirectory}{directoryName}", fileNameWithoutExtension, jsonFileName);
|
||||||
if (i == 0 && extension is ".json" && eDistanceCollectionFileFullName != selectedFileFullName)
|
if (i == 0 && extension is ".json" && eDistanceCollectionFileFullName != selectedFileFullName)
|
||||||
|
16
Shared/Models/Stateless/Methods/IMappingFromItem.cs
Normal file
16
Shared/Models/Stateless/Methods/IMappingFromItem.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||||
|
|
||||||
|
public interface IMappingFromItem
|
||||||
|
{ // ...
|
||||||
|
|
||||||
|
MappingFromItem TestStatic_GetMappingFromItem(Models.Item item, Models.FileHolder? resizedFileHolder)
|
||||||
|
=> GetMappingFromItem(item, resizedFileHolder);
|
||||||
|
static MappingFromItem GetMappingFromItem(Models.Item item, Models.FileHolder? resizedFileHolder)
|
||||||
|
=> MappingFromItem.GetMappingFromItem(item, resizedFileHolder);
|
||||||
|
|
||||||
|
MappingFromItem TestStatic_GetMappingFromItem(Models.Item item)
|
||||||
|
=> GetMappingFromItem(item);
|
||||||
|
static MappingFromItem GetMappingFromItem(Models.Item item)
|
||||||
|
=> GetMappingFromItem(item, item.ResizedFileHolder);
|
||||||
|
|
||||||
|
}
|
@ -3,9 +3,10 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
|||||||
public interface IPersonURL
|
public interface IPersonURL
|
||||||
{
|
{
|
||||||
|
|
||||||
string TestStatic_GetDefaultValue() => PersonURL.GetDefaultValue(); // <{1}>PluralValue
|
string TestStatic_GetDefaultValue() =>
|
||||||
|
GetDefaultValue(); // <{1}>PluralValue
|
||||||
static string GetDefaultValue() => PersonURL.GetDefaultValue(); // <{1}>PluralValue
|
static string GetDefaultValue() =>
|
||||||
|
PersonURL.GetDefaultValue(); // <{1}>PluralValue
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
@ -6,56 +6,84 @@ public interface IProperty
|
|||||||
string TestStatic_DateTimeFormat();
|
string TestStatic_DateTimeFormat();
|
||||||
static string DateTimeFormat() => "yyyy:MM:dd HH:mm:ss";
|
static string DateTimeFormat() => "yyyy:MM:dd HH:mm:ss";
|
||||||
|
|
||||||
int TestStatic_GetDeterministicHashCode(byte[] value);
|
int TestStatic_GetDeterministicHashCode(byte[] value) =>
|
||||||
|
GetDeterministicHashCode(value);
|
||||||
static int GetDeterministicHashCode(byte[] value) =>
|
static int GetDeterministicHashCode(byte[] value) =>
|
||||||
Property.GetDeterministicHashCode(value);
|
Property.GetDeterministicHashCode(value);
|
||||||
|
|
||||||
int TestStatic_GetDeterministicHashCode(string value);
|
List<DateTime> TestStatic_GetMetadataDateTimesByPattern(string dateTimeFormat, Models.FileHolder fileHolder) =>
|
||||||
|
GetMetadataDateTimesByPattern(dateTimeFormat, fileHolder);
|
||||||
|
static List<DateTime> GetMetadataDateTimesByPattern(string dateTimeFormat, Models.FileHolder fileHolder) =>
|
||||||
|
Property.GetMetadataDateTimesByPattern(dateTimeFormat, fileHolder.FullName);
|
||||||
|
|
||||||
|
int TestStatic_GetDeterministicHashCode(string value) =>
|
||||||
|
GetDeterministicHashCode(value);
|
||||||
static int GetDeterministicHashCode(string value) =>
|
static int GetDeterministicHashCode(string value) =>
|
||||||
Property.GetDeterministicHashCode(value);
|
Property.GetDeterministicHashCode(value);
|
||||||
|
|
||||||
DateTime TestStatic_GetDateTime(Models.Property? property);
|
DateTime TestStatic_GetDateTime(Models.Property? property) =>
|
||||||
|
GetDateTime(property);
|
||||||
static DateTime GetDateTime(Models.Property? property) =>
|
static DateTime GetDateTime(Models.Property? property) =>
|
||||||
Property.GetDateTime(property);
|
Property.GetDateTime(property);
|
||||||
|
|
||||||
DateTime TestStatic_GetMinimumDateTime(Models.Property? property);
|
DateTime TestStatic_GetMinimumDateTime(Models.Property? property) =>
|
||||||
|
GetMinimumDateTime(property);
|
||||||
static DateTime GetMinimumDateTime(Models.Property? property) =>
|
static DateTime GetMinimumDateTime(Models.Property? property) =>
|
||||||
Property.GetMinimumDateTime(property);
|
Property.GetMinimumDateTime(property);
|
||||||
|
|
||||||
(int Season, string seasonName) TestStatic_GetSeason(int dayOfYear);
|
(int Season, string seasonName) TestStatic_GetSeason(int dayOfYear) =>
|
||||||
|
GetSeason(dayOfYear);
|
||||||
static (int Season, string seasonName) GetSeason(int dayOfYear) =>
|
static (int Season, string seasonName) GetSeason(int dayOfYear) =>
|
||||||
Property.GetSeason(dayOfYear);
|
Property.GetSeason(dayOfYear);
|
||||||
|
|
||||||
string TestStatic_GetDiffRootDirectory(string diffPropertyDirectory);
|
string TestStatic_GetDiffRootDirectory(string diffPropertyDirectory) =>
|
||||||
|
GetDiffRootDirectory(diffPropertyDirectory);
|
||||||
static string GetDiffRootDirectory(string diffPropertyDirectory) =>
|
static string GetDiffRootDirectory(string diffPropertyDirectory) =>
|
||||||
Property.GetDiffRootDirectory(diffPropertyDirectory);
|
Property.GetDiffRootDirectory(diffPropertyDirectory);
|
||||||
|
|
||||||
bool TestStatic_Any(Models.Container[] propertyHolderCollections);
|
bool TestStatic_Any(Models.Container[] propertyHolderCollections) =>
|
||||||
|
Any(propertyHolderCollections);
|
||||||
static bool Any(Models.Container[] propertyHolderCollections) =>
|
static bool Any(Models.Container[] propertyHolderCollections) =>
|
||||||
Property.Any(propertyHolderCollections);
|
Property.Any(propertyHolderCollections);
|
||||||
|
|
||||||
(bool?, string[]) TestStatic_IsWrongYear(string[] segments, string year);
|
(bool?, string[]) TestStatic_IsWrongYear(string[] segments, string year) =>
|
||||||
|
IsWrongYear(segments, year);
|
||||||
static (bool?, string[]) IsWrongYear(string[] segments, string year) =>
|
static (bool?, string[]) IsWrongYear(string[] segments, string year) =>
|
||||||
Property.IsWrongYear(segments, year);
|
Property.IsWrongYear(segments, year);
|
||||||
|
|
||||||
List<DateTime> TestStatic_GetDateTimes(Models.Property property);
|
(DateTime?, int?, string?) TestStatic_Get(Models.FileHolder fileHolder) =>
|
||||||
static List<DateTime> GetDateTimes(Models.Property property) =>
|
Get(fileHolder);
|
||||||
Property.GetDateTimes(property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeOriginal, property.GPSDateStamp);
|
static (DateTime?, int?, string?) Get(Models.FileHolder fileHolder) =>
|
||||||
|
Property.Get(fileHolder);
|
||||||
|
|
||||||
double TestStatic_GetStandardDeviation(IEnumerable<long> values, double average);
|
DateTime? TestStatic_GetDateTimeFromName(Models.FileHolder fileHolder) =>
|
||||||
|
GetDateTimeFromName(fileHolder);
|
||||||
|
static DateTime? GetDateTimeFromName(Models.FileHolder fileHolder) =>
|
||||||
|
Property.GetDateTimeFromName(fileHolder);
|
||||||
|
|
||||||
|
List<DateTime> TestStatic_GetDateTimes(Models.Property property) =>
|
||||||
|
GetDateTimes(property);
|
||||||
|
static List<DateTime> GetDateTimes(Models.Property property) =>
|
||||||
|
Property.GetDateTimes(property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeFromName, property.DateTimeOriginal, property.GPSDateStamp);
|
||||||
|
|
||||||
|
double TestStatic_GetStandardDeviation(IEnumerable<long> values, double average) =>
|
||||||
|
GetStandardDeviation(values, average);
|
||||||
static double GetStandardDeviation(IEnumerable<long> values, double average) =>
|
static double GetStandardDeviation(IEnumerable<long> values, double average) =>
|
||||||
Property.GetStandardDeviation(values, average);
|
Property.GetStandardDeviation(values, average);
|
||||||
|
|
||||||
TimeSpan TestStatic_GetThreeStandardDeviationHigh(int minimum, Models.Container container);
|
TimeSpan TestStatic_GetThreeStandardDeviationHigh(int minimum, Models.Container container) =>
|
||||||
|
GetThreeStandardDeviationHigh(minimum, container);
|
||||||
static TimeSpan GetThreeStandardDeviationHigh(int minimum, Models.Container container) =>
|
static TimeSpan GetThreeStandardDeviationHigh(int minimum, Models.Container container) =>
|
||||||
Property.GetThreeStandardDeviationHigh(minimum, container);
|
Property.GetThreeStandardDeviationHigh(minimum, container);
|
||||||
|
|
||||||
(int, List<DateTime>, List<Models.Item>) TestStatic_Get(Models.Container container, TimeSpan threeStandardDeviationHigh, int i);
|
(int, List<DateTime>, List<Models.Item>) TestStatic_Get(Models.Container container, TimeSpan threeStandardDeviationHigh, int i) =>
|
||||||
|
Get(container, threeStandardDeviationHigh, i);
|
||||||
static (int, List<DateTime>, List<Models.Item>) Get(Models.Container container, TimeSpan threeStandardDeviationHigh, int i) =>
|
static (int, List<DateTime>, List<Models.Item>) Get(Models.Container container, TimeSpan threeStandardDeviationHigh, int i) =>
|
||||||
Property.Get(container, threeStandardDeviationHigh, i);
|
Property.Get(container, threeStandardDeviationHigh, i);
|
||||||
|
|
||||||
List<DateTime> TestStatic_GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, DateTime? gpsDateStamp);
|
List<DateTime> TestStatic_GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, DateTime? gpsDateStamp) =>
|
||||||
static List<DateTime> GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, DateTime? gpsDateStamp) =>
|
GetDateTimes(creationTime, lastWriteTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginal, gpsDateStamp);
|
||||||
Property.GetDateTimes(creationTime, lastWriteTime, dateTime, dateTimeDigitized, dateTimeOriginal, gpsDateStamp);
|
static List<DateTime> GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, DateTime? gpsDateStamp) =>
|
||||||
|
Property.GetDateTimes(creationTime, lastWriteTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginal, gpsDateStamp);
|
||||||
|
|
||||||
}
|
}
|
@ -5,8 +5,7 @@ internal abstract class Index
|
|||||||
|
|
||||||
private static string GetJsonContains(string result, string jsonFileFullName, FileInfo fileInfo, string fileSegmentCollection)
|
private static string GetJsonContains(string result, string jsonFileFullName, FileInfo fileInfo, string fileSegmentCollection)
|
||||||
{
|
{
|
||||||
if (fileInfo is null)
|
fileInfo ??= new FileInfo(jsonFileFullName);
|
||||||
fileInfo = new FileInfo(jsonFileFullName);
|
|
||||||
result = result.Replace(fileSegmentCollection, nameof(Properties.IIndex.RelativePaths)).Replace("\\\\", "/");
|
result = result.Replace(fileSegmentCollection, nameof(Properties.IIndex.RelativePaths)).Replace("\\\\", "/");
|
||||||
File.WriteAllText(fileInfo.FullName, result);
|
File.WriteAllText(fileInfo.FullName, result);
|
||||||
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
||||||
@ -15,8 +14,7 @@ internal abstract class Index
|
|||||||
|
|
||||||
private static string GetJsonSpecial(string result, string jsonFileFullName, FileInfo fileInfo)
|
private static string GetJsonSpecial(string result, string jsonFileFullName, FileInfo fileInfo)
|
||||||
{
|
{
|
||||||
if (fileInfo is null)
|
fileInfo ??= new FileInfo(jsonFileFullName);
|
||||||
fileInfo = new FileInfo(jsonFileFullName);
|
|
||||||
result = result.Replace("/u0", "\\u0");
|
result = result.Replace("/u0", "\\u0");
|
||||||
File.WriteAllText(fileInfo.FullName, result);
|
File.WriteAllText(fileInfo.FullName, result);
|
||||||
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
||||||
|
@ -10,15 +10,11 @@ internal abstract class Item
|
|||||||
List<string> collection = new();
|
List<string> collection = new();
|
||||||
foreach (Models.Item item in itemsA)
|
foreach (Models.Item item in itemsA)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
results.Add(item);
|
results.Add(item);
|
||||||
collection.Add(item.ImageFileHolder.FullName);
|
collection.Add(item.ImageFileHolder.FullName);
|
||||||
}
|
}
|
||||||
foreach (Models.Item item in itemsB)
|
foreach (Models.Item item in itemsB)
|
||||||
{
|
{
|
||||||
if (item.ImageFileHolder is null)
|
|
||||||
continue;
|
|
||||||
if (collection.Contains(item.ImageFileHolder.FullName))
|
if (collection.Contains(item.ImageFileHolder.FullName))
|
||||||
continue;
|
continue;
|
||||||
result++;
|
result++;
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||||
|
|
||||||
internal abstract class Property
|
internal abstract class Property
|
||||||
@ -85,7 +92,46 @@ internal abstract class Property
|
|||||||
return new(result, results);
|
return new(result, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<DateTime> GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, DateTime? gpsDateStamp)
|
internal static DateTime? GetDateTimeFromName(Models.FileHolder fileHolder)
|
||||||
|
{
|
||||||
|
DateTime? result = null;
|
||||||
|
int length;
|
||||||
|
string format;
|
||||||
|
string fullFormat;
|
||||||
|
StringBuilder value = new();
|
||||||
|
string[][] dateFormats = new string[][]
|
||||||
|
{
|
||||||
|
new string[] { string.Empty, "yyyyMMdd_HHmmss", string.Empty },
|
||||||
|
new string[] { string.Empty, "yyyy-MM-dd HH.mm.ss", string.Empty },
|
||||||
|
new string[] { string.Empty, "yyyyMMdd_HHmmss", "_LLS" },
|
||||||
|
new string[] { string.Empty, "yyyyMMdd_HHmmss", "_HDR" },
|
||||||
|
new string[] { "IMG_", "yyyyMMdd_HHmmss", string.Empty },
|
||||||
|
new string[] { "IMG#####-", "yyyyMMdd-HHmm", string.Empty },
|
||||||
|
new string[] { "CameraZOOM-", "yyyyMMddHHmmss", string.Empty },
|
||||||
|
new string[] { "VideoCapture_", "yyyyMMdd-HHmmss ", string.Empty }
|
||||||
|
};
|
||||||
|
foreach (string[] dateFormat in dateFormats)
|
||||||
|
{
|
||||||
|
_ = value.Clear();
|
||||||
|
fullFormat = string.Join(string.Empty, dateFormat);
|
||||||
|
if (fileHolder.NameWithoutExtension.Length != fullFormat.Length)
|
||||||
|
continue;
|
||||||
|
format = dateFormat[1];
|
||||||
|
length = dateFormat[0].Length + dateFormat[1].Length;
|
||||||
|
for (int i = dateFormat[0].Length; i < length; i++)
|
||||||
|
_ = value.Append(fileHolder.NameWithoutExtension[i]);
|
||||||
|
if (value.Length != format.Length)
|
||||||
|
continue;
|
||||||
|
if (DateTime.TryParseExact(value.ToString(), format, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime checkDateTime))
|
||||||
|
{
|
||||||
|
result = checkDateTime;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static List<DateTime> GetDateTimes(DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, DateTime? gpsDateStamp)
|
||||||
{
|
{
|
||||||
List<DateTime> results = new()
|
List<DateTime> results = new()
|
||||||
{
|
{
|
||||||
@ -96,6 +142,8 @@ internal abstract class Property
|
|||||||
results.Add(dateTime.Value);
|
results.Add(dateTime.Value);
|
||||||
if (dateTimeDigitized.HasValue)
|
if (dateTimeDigitized.HasValue)
|
||||||
results.Add(dateTimeDigitized.Value);
|
results.Add(dateTimeDigitized.Value);
|
||||||
|
if (dateTimeFromName.HasValue)
|
||||||
|
results.Add(dateTimeFromName.Value);
|
||||||
if (dateTimeOriginal.HasValue)
|
if (dateTimeOriginal.HasValue)
|
||||||
results.Add(dateTimeOriginal.Value);
|
results.Add(dateTimeOriginal.Value);
|
||||||
if (gpsDateStamp.HasValue)
|
if (gpsDateStamp.HasValue)
|
||||||
@ -119,6 +167,8 @@ internal abstract class Property
|
|||||||
dateTimes.Add(property.DateTime.Value);
|
dateTimes.Add(property.DateTime.Value);
|
||||||
if (property.DateTimeDigitized.HasValue)
|
if (property.DateTimeDigitized.HasValue)
|
||||||
dateTimes.Add(property.DateTimeDigitized.Value);
|
dateTimes.Add(property.DateTimeDigitized.Value);
|
||||||
|
if (property.DateTimeFromName.HasValue)
|
||||||
|
dateTimes.Add(property.DateTimeFromName.Value);
|
||||||
if (property.DateTimeOriginal.HasValue)
|
if (property.DateTimeOriginal.HasValue)
|
||||||
dateTimes.Add(property.DateTimeOriginal.Value);
|
dateTimes.Add(property.DateTimeOriginal.Value);
|
||||||
if (property.GPSDateStamp.HasValue)
|
if (property.GPSDateStamp.HasValue)
|
||||||
@ -269,4 +319,119 @@ internal abstract class Property
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static List<DateTime> GetMetadataDateTimesByPattern(string dateTimeFormat, string sourceDirectoryFile)
|
||||||
|
{
|
||||||
|
List<DateTime> results = new();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime checkDateTime;
|
||||||
|
DateTime kristy = new(1976, 3, 8);
|
||||||
|
IReadOnlyList<MetadataExtractor.Directory> directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(sourceDirectoryFile);
|
||||||
|
foreach (MetadataExtractor.Directory directory in directories)
|
||||||
|
{
|
||||||
|
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(tag.Description) || tag.Description.Length != dateTimeFormat.Length)
|
||||||
|
continue;
|
||||||
|
if (!DateTime.TryParseExact(tag.Description, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
||||||
|
continue;
|
||||||
|
if (checkDateTime < kristy)
|
||||||
|
continue;
|
||||||
|
results.Add(checkDateTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CA1416
|
||||||
|
|
||||||
|
internal static (DateTime?, int?, string?) Get(Models.FileHolder fileHolder)
|
||||||
|
{
|
||||||
|
byte[] bytes;
|
||||||
|
string value;
|
||||||
|
int? id = null;
|
||||||
|
DateTime checkDateTime;
|
||||||
|
string? message = null;
|
||||||
|
DateTime? dateTime = null;
|
||||||
|
PropertyItem? propertyItem;
|
||||||
|
DateTime? gpsDateStamp = null;
|
||||||
|
DateTime? dateTimeOriginal = null;
|
||||||
|
DateTime? dateTimeDigitized = null;
|
||||||
|
ASCIIEncoding asciiEncoding = new();
|
||||||
|
string dateTimeFormat = IProperty.DateTimeFormat();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using Image image = Image.FromFile(fileHolder.FullName);
|
||||||
|
using Bitmap bitmap = new(image);
|
||||||
|
Rectangle rectangle = new(0, 0, image.Width, image.Height);
|
||||||
|
BitmapData bitmapData = bitmap.LockBits(rectangle, ImageLockMode.ReadOnly, bitmap.PixelFormat);
|
||||||
|
IntPtr intPtr = bitmapData.Scan0;
|
||||||
|
int length = bitmapData.Stride * bitmap.Height;
|
||||||
|
bytes = new byte[length];
|
||||||
|
Marshal.Copy(intPtr, bytes, 0, length);
|
||||||
|
bitmap.UnlockBits(bitmapData);
|
||||||
|
id = IProperty.GetDeterministicHashCode(bytes);
|
||||||
|
if (image.PropertyIdList.Contains((int)IExif.Tags.DateTime))
|
||||||
|
{
|
||||||
|
propertyItem = image.GetPropertyItem((int)IExif.Tags.DateTime);
|
||||||
|
if (propertyItem?.Value is not null)
|
||||||
|
{
|
||||||
|
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||||
|
if (value.Length > dateTimeFormat.Length)
|
||||||
|
value = value[..dateTimeFormat.Length];
|
||||||
|
if (value.Length == dateTimeFormat.Length && DateTime.TryParseExact(value, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
||||||
|
dateTime = checkDateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (image.PropertyIdList.Contains((int)IExif.Tags.DateTimeDigitized))
|
||||||
|
{
|
||||||
|
propertyItem = image.GetPropertyItem((int)IExif.Tags.DateTimeDigitized);
|
||||||
|
if (propertyItem?.Value is not null)
|
||||||
|
{
|
||||||
|
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||||
|
if (value.Length > dateTimeFormat.Length)
|
||||||
|
value = value[..dateTimeFormat.Length];
|
||||||
|
if (value.Length == dateTimeFormat.Length && DateTime.TryParseExact(value, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
||||||
|
dateTimeDigitized = checkDateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (image.PropertyIdList.Contains((int)IExif.Tags.DateTimeOriginal))
|
||||||
|
{
|
||||||
|
propertyItem = image.GetPropertyItem((int)IExif.Tags.DateTimeOriginal);
|
||||||
|
if (propertyItem?.Value is not null)
|
||||||
|
{
|
||||||
|
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||||
|
if (value.Length > dateTimeFormat.Length)
|
||||||
|
value = value[..dateTimeFormat.Length];
|
||||||
|
if (value.Length == dateTimeFormat.Length && DateTime.TryParseExact(value, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
||||||
|
dateTimeOriginal = checkDateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (image.PropertyIdList.Contains((int)IExif.Tags.GPSDateStamp))
|
||||||
|
{
|
||||||
|
propertyItem = image.GetPropertyItem((int)IExif.Tags.GPSDateStamp);
|
||||||
|
if (propertyItem?.Value is not null)
|
||||||
|
{
|
||||||
|
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||||
|
if (value.Length > dateTimeFormat.Length)
|
||||||
|
value = value[..dateTimeFormat.Length];
|
||||||
|
if (value.Length == dateTimeFormat.Length && DateTime.TryParseExact(value, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out checkDateTime))
|
||||||
|
gpsDateStamp = checkDateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bitmap.Dispose();
|
||||||
|
image.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
message = string.Concat(new StackFrame().GetMethod()?.Name, " <", fileHolder.FullName, ">");
|
||||||
|
}
|
||||||
|
DateTime?[] dateTimes = new DateTime?[] { fileHolder.LastWriteTime, fileHolder.CreationTime, dateTime, dateTimeDigitized, dateTimeOriginal, gpsDateStamp };
|
||||||
|
return new(dateTimes.Min(), id, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore CA1416
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
#pragma warning disable SYSLIB0022
|
#pragma warning disable SYSLIB0022
|
||||||
|
#pragma warning disable SYSLIB0041
|
||||||
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Phares.View.by.Distance.Shared</PackageId>
|
<PackageId>Phares.View.by.Distance.Shared</PackageId>
|
||||||
@ -33,8 +33,8 @@
|
|||||||
<SupportedPlatform Include="browser" />
|
<SupportedPlatform Include="browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="MetadataExtractor" Version="2.7.1" />
|
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,11 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.Configuration Get(Configuration configuration)
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.CheckDFaceAndUpWriteDates is null)
|
if (configuration.CheckDFaceAndUpWriteDates is null)
|
||||||
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
||||||
if (configuration.CheckJsonForDistanceResults is null)
|
if (configuration.CheckJsonForDistanceResults is null)
|
||||||
@ -81,10 +83,8 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
if (configuration.IgnoreRelativePaths is null)
|
if (configuration.IgnoreRelativePaths is null)
|
||||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||||
if (configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions is null)
|
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions = Array.Empty<string>();
|
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions is null)
|
|
||||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||||
if (configuration.MixedYearRelativePaths is null)
|
if (configuration.MixedYearRelativePaths is null)
|
||||||
@ -115,16 +115,13 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.PropertiesChangedForResize));
|
throw new NullReferenceException(nameof(configuration.PropertiesChangedForResize));
|
||||||
if (configuration.Reverse is null)
|
if (configuration.Reverse is null)
|
||||||
throw new NullReferenceException(nameof(configuration.Reverse));
|
throw new NullReferenceException(nameof(configuration.Reverse));
|
||||||
if (configuration.SaveFaceLandmarkForOutputResolutions is null)
|
configuration.SaveFaceLandmarkForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveFaceLandmarkForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveFullYearOfRandomFiles is null)
|
if (configuration.SaveFullYearOfRandomFiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
||||||
if (configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions is null)
|
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveResizedSubfiles is null)
|
if (configuration.SaveResizedSubfiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
||||||
if (configuration.SaveShortcutsForOutputResolutions is null)
|
configuration.SaveShortcutsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveShortcutsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SkipSearch is null)
|
if (configuration.SkipSearch is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
||||||
if (configuration.TestDistanceResults is null)
|
if (configuration.TestDistanceResults is null)
|
||||||
@ -178,7 +175,7 @@ public class Configuration
|
|||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
Configuration configuration;
|
Configuration? configuration;
|
||||||
if (isEnvironment is null)
|
if (isEnvironment is null)
|
||||||
configuration = configurationRoot.Get<Configuration>();
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
else
|
else
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VSTestLogger>trx</VSTestLogger>
|
<VSTestLogger>trx</VSTestLogger>
|
||||||
@ -27,18 +27,18 @@
|
|||||||
<DefineConstants>Linux</DefineConstants>
|
<DefineConstants>Linux</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0" />
|
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.13.14" />
|
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -59,7 +59,7 @@ public class UnitTestIsEnvironment
|
|||||||
List<string> jsonFiles = new();
|
List<string> jsonFiles = new();
|
||||||
foreach (IConfigurationProvider configurationProvider in _ConfigurationRoot.Providers)
|
foreach (IConfigurationProvider configurationProvider in _ConfigurationRoot.Providers)
|
||||||
{
|
{
|
||||||
if (configurationProvider is not JsonConfigurationProvider jsonConfigurationProvider)
|
if (configurationProvider is not JsonConfigurationProvider jsonConfigurationProvider || jsonConfigurationProvider.Source.Path is null)
|
||||||
continue;
|
continue;
|
||||||
jsonFiles.Add(jsonConfigurationProvider.Source.Path);
|
jsonFiles.Add(jsonConfigurationProvider.Source.Path);
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ public class UnitTestResize
|
|||||||
string sourceDirectoryName = "Halloween 2006";
|
string sourceDirectoryName = "Halloween 2006";
|
||||||
Item item;
|
Item item;
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
|
FileHolder resizedFileHolder;
|
||||||
string original = "Original";
|
string original = "Original";
|
||||||
string aResultsFullGroupDirectory;
|
string aResultsFullGroupDirectory;
|
||||||
string bResultsFullGroupDirectory;
|
string bResultsFullGroupDirectory;
|
||||||
@ -125,45 +126,29 @@ public class UnitTestResize
|
|||||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
||||||
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||||
_ = resize.ToString();
|
_ = resize.ToString();
|
||||||
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
aResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Properties for each image",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: false));
|
|
||||||
metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
bResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Metadata as key value pairs",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
cResultsFullGroupDirectory,
|
|
||||||
contentDescription: "Resized image",
|
|
||||||
singletonDescription: "Resize dimensions for each resolution",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
string sourceDirectoryFile = ".json";
|
string sourceDirectoryFile = ".json";
|
||||||
FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
||||||
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
||||||
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
||||||
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false);
|
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
resize.SetAngleBracketCollection(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
metadata.SetAngleBracketCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false, false);
|
||||||
Assert.IsNotNull(item.ImageFileHolder);
|
Assert.IsNotNull(item.ImageFileHolder);
|
||||||
if (item.Property is null)
|
if (item.Property is null)
|
||||||
{
|
{
|
||||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||||
item.Update(property);
|
item.Update(property);
|
||||||
}
|
}
|
||||||
(int _, metadataCollection) = metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, item);
|
if (property is null || item.Property is null)
|
||||||
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item);
|
throw new NullReferenceException(nameof(property));
|
||||||
Assert.IsNotNull(item.ResizedFileHolder);
|
resizedFileHolder = resize.GetResizedFileHolder(item);
|
||||||
resize.SaveResizedSubfile(outputResolution, cResultsFullGroupDirectory, subFileTuples, item, original, imageResizeKeyValuePairs);
|
item.SetResizedFileHolder(resize.FileNameExtension, resizedFileHolder);
|
||||||
|
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
|
||||||
|
(int _, metadataCollection) = metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem);
|
||||||
|
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item.Property, mappingFromItem);
|
||||||
|
Assert.IsNotNull(mappingFromItem.ResizedFileHolder);
|
||||||
|
resize.SaveResizedSubfile(_Configuration.PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, original, imageResizeKeyValuePairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -20,10 +20,10 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings.MaxDegreeOfParallelism is null)
|
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
@ -36,7 +36,7 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,11 @@ public class Configuration
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.Configuration Get(Configuration configuration)
|
private static Models.Configuration Get(Configuration? configuration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
|
if (configuration is null)
|
||||||
|
throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.CheckDFaceAndUpWriteDates is null)
|
if (configuration.CheckDFaceAndUpWriteDates is null)
|
||||||
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
throw new NullReferenceException(nameof(configuration.CheckDFaceAndUpWriteDates));
|
||||||
if (configuration.CheckJsonForDistanceResults is null)
|
if (configuration.CheckJsonForDistanceResults is null)
|
||||||
@ -115,10 +117,8 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
if (configuration.IgnoreRelativePaths is null)
|
if (configuration.IgnoreRelativePaths is null)
|
||||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||||
if (configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions is null)
|
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions = Array.Empty<string>();
|
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||||
if (configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions is null)
|
|
||||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||||
if (configuration.LocationDigits is null)
|
if (configuration.LocationDigits is null)
|
||||||
@ -175,16 +175,13 @@ public class Configuration
|
|||||||
throw new NullReferenceException(nameof(configuration.RetryImagesWithoutAFace));
|
throw new NullReferenceException(nameof(configuration.RetryImagesWithoutAFace));
|
||||||
if (configuration.Reverse is null)
|
if (configuration.Reverse is null)
|
||||||
throw new NullReferenceException(nameof(configuration.Reverse));
|
throw new NullReferenceException(nameof(configuration.Reverse));
|
||||||
if (configuration.SaveFaceLandmarkForOutputResolutions is null)
|
configuration.SaveFaceLandmarkForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveFaceLandmarkForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveFullYearOfRandomFiles is null)
|
if (configuration.SaveFullYearOfRandomFiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
throw new NullReferenceException(nameof(configuration.SaveFullYearOfRandomFiles));
|
||||||
if (configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions is null)
|
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveResizedImagesByPersonKeyFormattedForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SaveResizedSubfiles is null)
|
if (configuration.SaveResizedSubfiles is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
throw new NullReferenceException(nameof(configuration.SaveResizedSubfiles));
|
||||||
if (configuration.SaveShortcutsForOutputResolutions is null)
|
configuration.SaveShortcutsForOutputResolutions ??= Array.Empty<string>();
|
||||||
configuration.SaveShortcutsForOutputResolutions = Array.Empty<string>();
|
|
||||||
if (configuration.SkipSearch is null)
|
if (configuration.SkipSearch is null)
|
||||||
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
throw new NullReferenceException(nameof(configuration.SkipSearch));
|
||||||
if (configuration.SortingMaximumPerFaceShouldBeHigh is null)
|
if (configuration.SortingMaximumPerFaceShouldBeHigh is null)
|
||||||
@ -267,7 +264,7 @@ public class Configuration
|
|||||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
|
||||||
{
|
{
|
||||||
Models.Configuration result;
|
Models.Configuration result;
|
||||||
Configuration configuration;
|
Configuration? configuration;
|
||||||
if (isEnvironment is null)
|
if (isEnvironment is null)
|
||||||
configuration = configurationRoot.Get<Configuration>();
|
configuration = configurationRoot.Get<Configuration>();
|
||||||
else
|
else
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VSTestLogger>trx</VSTestLogger>
|
<VSTestLogger>trx</VSTestLogger>
|
||||||
@ -27,17 +27,17 @@
|
|||||||
<DefineConstants>Linux</DefineConstants>
|
<DefineConstants>Linux</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0" />
|
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||||
|
@ -172,6 +172,7 @@ public class UnitTestFace
|
|||||||
Item item;
|
Item item;
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
string original = "Original";
|
string original = "Original";
|
||||||
|
FileHolder resizedFileHolder;
|
||||||
string aResultsFullGroupDirectory;
|
string aResultsFullGroupDirectory;
|
||||||
string bResultsFullGroupDirectory;
|
string bResultsFullGroupDirectory;
|
||||||
string cResultsFullGroupDirectory;
|
string cResultsFullGroupDirectory;
|
||||||
@ -198,46 +199,30 @@ public class UnitTestFace
|
|||||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
||||||
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
C_Resize resize = new(_Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||||
_ = resize.ToString();
|
_ = resize.ToString();
|
||||||
propertyLogic.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
aResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Properties for each image",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: false));
|
|
||||||
metadata.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
bResultsFullGroupDirectory,
|
|
||||||
contentDescription: string.Empty,
|
|
||||||
singletonDescription: "Metadata as key value pairs",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
resize.AngleBracketCollection.AddRange(Property.Models.Stateless.IResult.GetDirectoryInfoCollection(
|
|
||||||
_PropertyConfiguration,
|
|
||||||
sourceDirectory,
|
|
||||||
cResultsFullGroupDirectory,
|
|
||||||
contentDescription: "Resized image",
|
|
||||||
singletonDescription: "Resize dimensions for each resolution",
|
|
||||||
collectionDescription: string.Empty,
|
|
||||||
converted: true));
|
|
||||||
string sourceDirectoryFile = ".json";
|
string sourceDirectoryFile = ".json";
|
||||||
FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
||||||
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
||||||
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
||||||
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false);
|
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
resize.SetAngleBracketCollection(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
metadata.SetAngleBracketCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, sourceDirectory);
|
||||||
|
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false, false);
|
||||||
Assert.IsNotNull(item.ImageFileHolder);
|
Assert.IsNotNull(item.ImageFileHolder);
|
||||||
if (item.Property is null)
|
if (item.Property is null)
|
||||||
{
|
{
|
||||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||||
item.Update(property);
|
item.Update(property);
|
||||||
}
|
}
|
||||||
(int _, metadataCollection) = metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, item);
|
if (property is null || item.Property is null)
|
||||||
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item);
|
throw new NullReferenceException(nameof(property));
|
||||||
Assert.IsNotNull(item.ResizedFileHolder);
|
resizedFileHolder = resize.GetResizedFileHolder(item);
|
||||||
resize.SaveResizedSubfile(outputResolution, cResultsFullGroupDirectory, subFileTuples, item, original, imageResizeKeyValuePairs);
|
item.SetResizedFileHolder(resize.FileNameExtension, resizedFileHolder);
|
||||||
Image image = FaceRecognition.LoadImageFile(item.ResizedFileHolder.FullName);
|
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
|
||||||
|
(int _, metadataCollection) = metadata.GetMetadataCollection(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, subFileTuples, parseExceptions, mappingFromItem);
|
||||||
|
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, original, metadataCollection, item.Property, mappingFromItem);
|
||||||
|
Assert.IsNotNull(mappingFromItem.ResizedFileHolder);
|
||||||
|
resize.SaveResizedSubfile(_Configuration.PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, original, imageResizeKeyValuePairs);
|
||||||
|
Image image = FaceRecognition.LoadImageFile(mappingFromItem.ResizedFileHolder.FullName);
|
||||||
Assert.IsNotNull(image);
|
Assert.IsNotNull(image);
|
||||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
|
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(_Configuration);
|
||||||
FaceRecognition faceRecognition = new(_Configuration.NumberOfTimesToUpsample, _Configuration.NumberOfJitters, predictorModel, model, modelParameter);
|
FaceRecognition faceRecognition = new(_Configuration.NumberOfTimesToUpsample, _Configuration.NumberOfJitters, predictorModel, model, modelParameter);
|
||||||
|
@ -37,8 +37,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Face", "Face\Face.csproj",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceParts", "FaceParts\FaceParts.csproj", "{919525B1-60BA-40C6-BA66-6F7F4C526E01}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceParts", "FaceParts\FaceParts.csproj", "{919525B1-60BA-40C6-BA66-6F7F4C526E01}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drag-Drop", "Drag-Drop\Drag-Drop.csproj", "{796F5B13-1E23-433F-8CBF-BF548AC4AF3F}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -116,9 +114,5 @@ Global
|
|||||||
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Release|Any CPU.Build.0 = Release|Any CPU
|
{919525B1-60BA-40C6-BA66-6F7F4C526E01}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{796F5B13-1E23-433F-8CBF-BF548AC4AF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{796F5B13-1E23-433F-8CBF-BF548AC4AF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{796F5B13-1E23-433F-8CBF-BF548AC4AF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{796F5B13-1E23-433F-8CBF-BF548AC4AF3F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user