Back to using BlurHasher but not linked yet

This commit is contained in:
Mike Phares 2023-06-11 00:37:14 -07:00
parent 9c4767d454
commit f4b5a3a47c
15 changed files with 136 additions and 123 deletions

View File

@ -12,8 +12,9 @@ public static class Core
/// <param name="componentsY">The number of components used on the Y-Axis for the DCT</param>
/// <param name="progressCallback">An optional progress handler to receive progress updates</param>
/// <returns>The resulting BlurHash string</returns>
public static string Encode(Pixel[,] pixels, int componentsX, int componentsY, IProgress<int>? progressCallback = null)
public static ReadOnlySpan<char> Encode(Pixel[,] pixels, int componentsX, int componentsY, IProgress<int>? progressCallback = null)
{
Span<char> results = new char[4 + 2 * componentsX * componentsY];
if (componentsX < 1)
throw new ArgumentException("componentsX needs to be at least 1");
if (componentsX > 9)
@ -119,13 +120,14 @@ public static class Core
EncodeAc(factors[factorIndex].Red, factors[factorIndex].Green, factors[factorIndex].Blue, maximumValue).EncodeBase83(resultBuffer.Slice(6 + (factorIndex - 1) * 2, 2));
}
return resultBuffer.ToString();
resultBuffer.CopyTo(results);
return results;
}
/// <summary>
/// Decodes a BlurHash string into a 2-dimensional array of pixels
/// </summary>
/// <param name="blurhash">The blurhash string to decode</param>
/// <param name="blurHash">The blurHash string to decode</param>
/// <param name="pixels">
/// A two-dimensional array that will be filled with the pixel data.<br />
/// First dimension is the width, second dimension is the height
@ -133,30 +135,28 @@ public static class Core
/// <param name="punch">A value that affects the contrast of the decoded image. 1 means normal, smaller values will make the effect more subtle, and larger values will make it stronger.</param>
/// <param name="progressCallback">An optional progress handler to receive progress updates</param>
/// <returns>A 2-dimensional array of <see cref="Pixel"/>s </returns>
public static void Decode(string blurhash, Pixel[,] pixels, double punch = 1.0, IProgress<int>? progressCallback = null)
public static void Decode(ReadOnlySpan<char> blurHash, Pixel[,] pixels, double punch = 1.0, IProgress<int>? progressCallback = null)
{
if (blurhash.Length < 6)
if (blurHash.Length < 6)
{
throw new ArgumentException("BlurHash value needs to be at least 6 characters", nameof(blurhash));
throw new ArgumentException("BlurHash value needs to be at least 6 characters", nameof(blurHash));
}
ReadOnlySpan<char> blurhashSpan = blurhash.AsSpan();
int outputWidth = pixels.GetLength(0);
int outputHeight = pixels.GetLength(1);
int sizeFlag = blurhashSpan[..1].DecodeBase83();
int sizeFlag = blurHash[..1].DecodeBase83();
int componentsY = sizeFlag / 9 + 1;
int componentsX = sizeFlag % 9 + 1;
int componentCount = componentsX * componentsY;
if (blurhash.Length != 4 + 2 * componentsX * componentsY)
if (blurHash.Length != 4 + 2 * componentsX * componentsY)
{
throw new ArgumentException("BlurHash value is missing data", nameof(blurhash));
throw new ArgumentException("BlurHash value is missing data", nameof(blurHash));
}
double quantizedMaximumValue = blurhashSpan.Slice(1, 1).DecodeBase83();
double quantizedMaximumValue = blurHash.Slice(1, 1).DecodeBase83();
double maximumValue = (quantizedMaximumValue + 1.0) / 166.0;
Pixel[,] coefficients = new Pixel[componentsX, componentsY];
@ -167,12 +167,12 @@ public static class Core
{
if (xComponent == 0 && yComponent == 0)
{
int value = blurhashSpan.Slice(2, 4).DecodeBase83();
int value = blurHash.Slice(2, 4).DecodeBase83();
coefficients[xComponent, yComponent] = DecodeDc(value);
}
else
{
int value = blurhashSpan.Slice(4 + componentIndex * 2, 2).DecodeBase83();
int value = blurHash.Slice(4 + componentIndex * 2, 2).DecodeBase83();
coefficients[xComponent, yComponent] = DecodeAc(value, maximumValue * punch);
}

View File

@ -15,20 +15,21 @@ public static class BlurHasher
/// <param name="componentsX">The number of components used on the X-Axis for the DCT</param>
/// <param name="componentsY">The number of components used on the Y-Axis for the DCT</param>
/// <returns>The resulting BlurHash string</returns>
public static string Encode(Image image, int componentsX, int componentsY) => Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY);
public static ReadOnlySpan<char> Encode(Image image, int componentsX, int componentsY) =>
Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY);
/// <summary>
/// Decodes a BlurHash string into a <c>System.Drawing.Image</c>
/// </summary>
/// <param name="blurhash">The blurhash string to decode</param>
/// <param name="blurHash">The blurHash string to decode</param>
/// <param name="outputWidth">The desired width of the output in pixels</param>
/// <param name="outputHeight">The desired height of the output in pixels</param>
/// <param name="punch">A value that affects the contrast of the decoded image. 1 means normal, smaller values will make the effect more subtle, and larger values will make it stronger.</param>
/// <returns>The decoded preview</returns>
public static Image Decode(string blurhash, int outputWidth, int outputHeight, double punch = 1.0)
public static Image Decode(ReadOnlySpan<char> blurHash, int outputWidth, int outputHeight, double punch = 1.0)
{
Pixel[,] pixelData = new Pixel[outputWidth, outputHeight];
Core.Decode(blurhash, pixelData, punch);
Core.Decode(blurHash, pixelData, punch);
return ConvertToBitmap(pixelData);
}

View File

@ -1,51 +1,68 @@
using System.Drawing;
using System.Text;
using View_by_Distance.Shared.Models;
using View_by_Distance.Shared.Models.Methods;
namespace View_by_Distance.BlurHash.Models;
public class BlurHasher : IBlurHasher
public class C2_BlurHasher : IBlurHasher
{
string IBlurHasher.Encode(Image image) =>
#pragma warning disable CA1416
image.Width < image.Height ? Encode(image, 4, 3) : Encode(image, 3, 4);
#pragma warning restore CA1416
private readonly IReadOnlyDictionary<string, string[]> _JsonGroups;
string IBlurHasher.EncodeAndSave(Image image, string directory) =>
#pragma warning disable CA1416
image.Width < image.Height ? EncodeAndSave(image, 4, 3, 300, 190, directory) : EncodeAndSave(image, 3, 4, 300, 190, directory);
#pragma warning restore CA1416
public C2_BlurHasher(string resultAllInOne, string? resultsFullGroupDirectory) =>
_JsonGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(resultAllInOne, resultsFullGroupDirectory);
string IBlurHasher.Encode(Image image, int x, int y) =>
Encode(image, x, y);
string IBlurHasher.EncodeAndSave(Image image, int x, int y, string directory) =>
EncodeAndSave(image, x, y, 300, 190, directory);
internal static string Encode(Image image, int x, int y) =>
System.Drawing.BlurHash.BlurHasher.Encode(image, x, y);
public string EncodeAndSave(Image image, int x, int y, int width, int height, string directory)
string IBlurHasher.Encode(FileHolder fileHolder)
{
string result;
#pragma warning disable CA1416
Image image = Image.FromFile(fileHolder.FullName);
(int componentsX, int componentsY) = image.Width < image.Height ? (4, 3) : (3, 4);
ReadOnlySpan<char> blurHash = System.Drawing.BlurHash.BlurHasher.Encode(image, componentsX, componentsY);
image.Dispose();
#pragma warning restore CA1416
result = blurHash.ToString();
return result;
}
string IBlurHasher.EncodeAndSave(FileHolder fileHolder)
{
string file;
string result;
int actualByte;
result = System.Drawing.BlurHash.BlurHasher.Encode(image, x, y);
using Image actualImage = System.Drawing.BlurHash.BlurHasher.Decode(result, width, height);
char directory;
int directoryIndex;
string extension = ".png";
#pragma warning disable CA1416
Image image = Image.FromFile(fileHolder.FullName);
(int componentsX, int componentsY, int outputWidth, int outputHeight) = image.Width < image.Height ? (4, 3, 300, 190) : (3, 4, 300, 190);
ReadOnlySpan<char> blurHash = System.Drawing.BlurHash.BlurHasher.Encode(image, componentsX, componentsY);
using Image actualImage = System.Drawing.BlurHash.BlurHasher.Decode(blurHash, outputWidth, outputHeight);
result = blurHash.ToString();
byte[] blurHashBytes = Encoding.UTF8.GetBytes(result);
string joined = string.Join(string.Empty, blurHashBytes.Select(l => l.ToString("000")));
string fileName = Path.Combine(directory, $"{x}x{y}-{width}x{height}-{joined}.png");
if (!File.Exists(fileName))
string fileNameWithoutExtension = $"{componentsX}x{componentsY}-{outputWidth}x{outputHeight}-{joined}";
directory = Shared.Models.Stateless.Methods.IDirectory.GetDirectory(fileHolder.Name);
directoryIndex = Shared.Models.Stateless.Methods.IDirectory.GetDirectory(directory);
file = Path.Combine(_JsonGroups["{}"][directoryIndex], $"{fileHolder.Name}.csv");
string contents = string.Concat(result, Environment.NewLine, fileNameWithoutExtension, Environment.NewLine, extension);
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(file, contents, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
directory = Shared.Models.Stateless.Methods.IDirectory.GetDirectory(joined);
directoryIndex = Shared.Models.Stateless.Methods.IDirectory.GetDirectory(directory);
file = Path.Combine(_JsonGroups["()"][directoryIndex], $"{fileNameWithoutExtension}{extension}");
if (!File.Exists(file))
{
using FileStream fileStream = new(fileName, FileMode.CreateNew);
#pragma warning disable CA1416
using FileStream fileStream = new(file, FileMode.CreateNew);
actualImage.Save(fileStream, System.Drawing.Imaging.ImageFormat.Png);
#pragma warning restore CA1416
_ = fileStream.Seek(0, SeekOrigin.Begin);
actualByte = fileStream.ReadByte();
while (actualByte > -1)
actualByte = fileStream.ReadByte();
}
image.Dispose();
#pragma warning restore CA1416
result = blurHash.ToString();
return result;
}

View File

@ -23,6 +23,8 @@ namespace View_by_Distance.Instance;
public partial class DlibDotNet
{
private IBlurHasher? _BlurHasher;
private readonly D_Face _Faces;
private readonly C_Resize _Resize;
private readonly F_Random _Random;
@ -32,7 +34,6 @@ public partial class DlibDotNet
private readonly D2_FaceParts _FaceParts;
private readonly AppSettings _AppSettings;
private readonly List<string> _Exceptions;
private readonly IThumbHasher _IThumbHasher;
private readonly IsEnvironment _IsEnvironment;
private readonly bool _PropertyRootExistedBefore;
private readonly Models.Configuration _Configuration;
@ -52,13 +53,13 @@ public partial class DlibDotNet
IConsole console)
{
string message;
_BlurHasher = null;
_Console = console;
_AppSettings = appSettings;
_IsEnvironment = isEnvironment;
long ticks = DateTime.Now.Ticks;
_Exceptions = new List<string>();
_Log = Serilog.Log.ForContext<DlibDotNet>();
_IThumbHasher = new ThumbHash.Models.C2_ThumbHasher();
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
Models.Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
_Log.Information(propertyConfiguration.RootDirectory);
@ -354,7 +355,6 @@ public partial class DlibDotNet
MapLogic mapLogic,
string outputResolution,
string cResultsFullGroupDirectory,
string c2ResultsFullGroupDirectory,
string dResultsFullGroupDirectory,
List<Tuple<string, DateTime>> sourceDirectoryChanges,
Dictionary<string, List<MappingFromPhotoPrism>> fileNameToCollection,
@ -378,31 +378,28 @@ public partial class DlibDotNet
FileHolder resizedFileHolder = _Resize.GetResizedFileHolder(item);
if (item.Property is not null && item.Property.Id is not null && resizedFileHolder.Exists && item.Property.Width is not null && item.Property.Height is not null)
{
string fileName;
string c2ThumbHasherContentDirectory = Path.Combine(c2ResultsFullGroupDirectory, "()");
string c2ThumbHasherSingletonDirectory = Path.Combine(c2ResultsFullGroupDirectory, "{}");
if (!Directory.Exists(c2ThumbHasherContentDirectory))
_ = Directory.CreateDirectory(c2ThumbHasherContentDirectory);
if (!Directory.Exists(c2ThumbHasherSingletonDirectory))
_ = Directory.CreateDirectory(c2ThumbHasherSingletonDirectory);
MemoryStream memoryStream = _IThumbHasher.GetMemoryStream(Array.Empty<byte>(), item.Property.Width.Value, item.Property.Height.Value);
string thumbHashJson = JsonSerializer.Serialize(Array.Empty<byte>())[1..^1];
if (!Regex.Matches(thumbHashJson, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]").Any())
fileName = Path.Combine(c2ThumbHasherSingletonDirectory, $"{thumbHashJson}.png");
else
{
// string thumbHash = BitConverter.ToString(Array.Empty<byte>()).Replace("-", string.Empty);
// fileName = Path.Combine(c2ThumbHasherContentDirectory, $"{thumbHash}.png");
fileName = Path.Combine(c2ThumbHasherContentDirectory, $"{resizedFileHolder.NameWithoutExtension}.png");
}
if (!File.Exists(fileName))
{
using FileStream fileStream = new(fileName, FileMode.CreateNew);
memoryStream.WriteTo(fileStream);
memoryStream.Dispose();
if (resizedFileHolder.LastWriteTime is not null)
File.SetLastWriteTime(fileName, resizedFileHolder.LastWriteTime.Value);
}
_ = _BlurHasher?.EncodeAndSave(resizedFileHolder);
// if (item.Property.Width.Value < -255 && item.Property.Height.Value < -255)
// {
// MemoryStream memoryStream = _ThumbHasher.GetMemoryStream(Array.Empty<byte>(), item.Property.Width.Value, item.Property.Height.Value);
// string thumbHashJson = JsonSerializer.Serialize(Array.Empty<byte>())[1..^1];
// if (!Regex.Matches(thumbHashJson, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]").Any())
// fileName = Path.Combine(c2HasherSingletonDirectory, $"{thumbHashJson}.png");
// else
// {
// // string thumbHash = BitConverter.ToString(Array.Empty<byte>()).Replace("-", string.Empty);
// // fileName = Path.Combine(c2HasherContentDirectory, $"{thumbHash}.png");
// fileName = Path.Combine(c2HasherContentDirectory, $"{resizedFileHolder.NameWithoutExtension}.png");
// }
// if (!File.Exists(fileName))
// {
// using FileStream fileStream = new(fileName, FileMode.CreateNew);
// memoryStream.WriteTo(fileStream);
// memoryStream.Dispose();
// if (resizedFileHolder.LastWriteTime is not null)
// File.SetLastWriteTime(fileName, resizedFileHolder.LastWriteTime.Value);
// }
// }
}
if (item.Property is not null && item.Property.Id is not null && !item.Any())
{
@ -510,7 +507,6 @@ public partial class DlibDotNet
MapLogic mapLogic,
string outputResolution,
string cResultsFullGroupDirectory,
string c2ResultsFullGroupDirectory,
string dResultsFullGroupDirectory,
string d2ResultsFullGroupDirectory,
List<Tuple<string, DateTime>> sourceDirectoryChanges,
@ -540,7 +536,6 @@ public partial class DlibDotNet
mapLogic,
outputResolution,
cResultsFullGroupDirectory,
c2ResultsFullGroupDirectory,
dResultsFullGroupDirectory,
sourceDirectoryChanges,
fileNameToCollection,
@ -630,7 +625,7 @@ public partial class DlibDotNet
includePredictorModel: false);
string c2ResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
_Configuration.PropertyConfiguration,
nameof(ThumbHash.Models.C2_ThumbHasher),
nameof(BlurHash.Models.C2_BlurHasher),
outputResolution,
includeResizeGroup: true,
includeModel: false,
@ -675,6 +670,7 @@ public partial class DlibDotNet
{
total = 0;
(cResultsFullGroupDirectory, c2ResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
_BlurHasher = new BlurHash.Models.C2_BlurHasher(_Configuration.PropertyConfiguration.ResultAllInOne, c2ResultsFullGroupDirectory);
for (int i = 0; i < containers.Length; i++)
{
container = containers[i];
@ -702,7 +698,6 @@ public partial class DlibDotNet
mapLogic,
outputResolution,
cResultsFullGroupDirectory,
c2ResultsFullGroupDirectory,
dResultsFullGroupDirectory,
d2ResultsFullGroupDirectory,
sourceDirectoryChanges,

View File

@ -49,10 +49,11 @@
<PackageReference Include="WindowsShortcutFactory" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
<ProjectReference Include="..\BlurHash\BlurHash.csproj" />
<ProjectReference Include="..\Distance\Distance.csproj" />
<ProjectReference Include="..\Face\Face.csproj" />
<ProjectReference Include="..\FaceParts\FaceParts.csproj" />
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
<ProjectReference Include="..\Map\Map.csproj" />
<ProjectReference Include="..\Metadata\Metadata.csproj" />
<ProjectReference Include="..\PhotoPrism\PhotoPrism.csproj" />
@ -60,7 +61,6 @@
<ProjectReference Include="..\Property\Property.csproj" />
<ProjectReference Include="..\Resize\Resize.csproj" />
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
<ProjectReference Include="..\ThumbHash\ThumbHash.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="appsettings.json">

View File

@ -19,28 +19,13 @@ public class B_Metadata
private readonly IReadOnlyDictionary<string, string[]> _JsonGroups;
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
public B_Metadata(Configuration configuration, bool forceMetadataLastWriteTimeToCreationTime, bool propertiesChangedForMetadata, string aResultsFullGroupDirectory)
public B_Metadata(Configuration configuration, bool forceMetadataLastWriteTimeToCreationTime, bool propertiesChangedForMetadata, string bResultsFullGroupDirectory)
{
_Log = Serilog.Log.ForContext<B_Metadata>();
_PropertiesChangedForMetadata = propertiesChangedForMetadata;
_ForceMetadataLastWriteTimeToCreationTime = forceMetadataLastWriteTimeToCreationTime;
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
string checkDirectory;
List<string> collection = new();
for (int i = 0; i < 12; i++)
{
if (i == 10)
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, "-");
else if (i == 11)
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, "_");
else
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, i.ToString());
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
collection.Add(checkDirectory);
}
Dictionary<string, string[]> jsonGroups = new() { { "{}", collection.ToArray() } };
_JsonGroups = jsonGroups;
_JsonGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(configuration.ResultAllInOne, bResultsFullGroupDirectory);
}
public override string ToString()

View File

@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<UserSecretsId>7ca5318a-9332-4217-b9d8-cae696629934</UserSecretsId>
</PropertyGroup>
<PropertyGroup>

View File

@ -39,22 +39,7 @@ public class A_Property
_AngleBracketCollection = new List<string>();
_MaxDegreeOfParallelism = maxDegreeOfParallelism;
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
string checkDirectory;
List<string> collection = new();
for (int i = 0; i < 12; i++)
{
if (i == 10)
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, "-");
else if (i == 11)
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, "_");
else
checkDirectory = Path.Combine(aResultsFullGroupDirectory, "{}", configuration.ResultAllInOne, i.ToString());
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
collection.Add(checkDirectory);
}
Dictionary<string, string[]> jsonGroups = new() { { "{}", collection.ToArray() } };
_JsonGroups = jsonGroups;
_JsonGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(configuration.ResultAllInOne, aResultsFullGroupDirectory);
}
public override string ToString()

View File

@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<OutputType>library</OutputType>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Property</PackageId>

View File

@ -1,14 +1,9 @@
using System.Drawing;
namespace View_by_Distance.Shared.Models.Methods;
public interface IBlurHasher
{
string Encode(Image image);
string Encode(Image image, int x, int y);
string EncodeAndSave(Image image, string directory);
string EncodeAndSave(Image image, int x, int y, string directory);
string EncodeAndSave(Image image, int x, int y, int width, int height, string directory);
string Encode(FileHolder fileHolder);
string EncodeAndSave(FileHolder fileHolder);
}

View File

@ -59,4 +59,9 @@ public interface IPath
static string GetDirectory(string sourceDirectory, int level, string directoryName) =>
XPath.GetDirectory(sourceDirectory, level, directoryName);
Dictionary<string, string[]> TestStatic_GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory) =>
GetKeyValuePairs(resultAllInOne, resultsFullGroupDirectory);
static Dictionary<string, string[]> GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory) =>
XPath.GetKeyValuePairs(resultAllInOne, resultsFullGroupDirectory);
}

View File

@ -257,4 +257,31 @@ internal abstract class XPath
}
}
internal static Dictionary<string, string[]> GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory)
{
Dictionary<string, string[]> results = new();
string checkDirectory;
List<string> collection = new();
foreach (string key in new string[] { "{}", "()" })
{
if (resultsFullGroupDirectory is null)
continue;
collection.Clear();
for (int i = 0; i < 12; i++)
{
if (i == 10)
checkDirectory = Path.Combine(resultsFullGroupDirectory, key, resultAllInOne, "-");
else if (i == 11)
checkDirectory = Path.Combine(resultsFullGroupDirectory, key, resultAllInOne, "_");
else
checkDirectory = Path.Combine(resultsFullGroupDirectory, key, resultAllInOne, i.ToString());
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
collection.Add(checkDirectory);
}
results.Add(key, collection.ToArray());
}
return results;
}
}

View File

@ -4,7 +4,7 @@
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Shared</PackageId>

View File

@ -41,10 +41,11 @@
<PackageReference Include="Serilog" Version="2.12.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
<ProjectReference Include="..\Property\Property.csproj" />
<ProjectReference Include="..\BlurHash\BlurHash.csproj" />
<ProjectReference Include="..\Metadata\Metadata.csproj" />
<ProjectReference Include="..\Property\Property.csproj" />
<ProjectReference Include="..\Resize\Resize.csproj" />
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\Instance\appsettings.json">

View File

@ -174,6 +174,8 @@ public class UnitTestResize
if (property is null || item.Property is null)
throw new NullReferenceException(nameof(property));
resizedFileHolder = resize.GetResizedFileHolder(item);
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_Configuration.PropertyConfiguration.ResultAllInOne, resultsFullGroupDirectory: null);
_ = blurHasher.Encode(resizedFileHolder);
item.SetResizedFileHolder(resize.FileNameExtension, resizedFileHolder);
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, mappingFromItem);