diff --git a/BlurHash.Core/Core.cs b/BlurHash.Core/Core.cs index 40ea353..d1a3a78 100644 --- a/BlurHash.Core/Core.cs +++ b/BlurHash.Core/Core.cs @@ -12,8 +12,9 @@ public static class Core /// The number of components used on the Y-Axis for the DCT /// An optional progress handler to receive progress updates /// The resulting BlurHash string - public static string Encode(Pixel[,] pixels, int componentsX, int componentsY, IProgress? progressCallback = null) + public static ReadOnlySpan Encode(Pixel[,] pixels, int componentsX, int componentsY, IProgress? progressCallback = null) { + Span 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; } /// /// Decodes a BlurHash string into a 2-dimensional array of pixels /// - /// The blurhash string to decode + /// The blurHash string to decode /// /// A two-dimensional array that will be filled with the pixel data.
/// First dimension is the width, second dimension is the height @@ -133,30 +135,28 @@ public static class Core /// 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. /// An optional progress handler to receive progress updates /// A 2-dimensional array of s - public static void Decode(string blurhash, Pixel[,] pixels, double punch = 1.0, IProgress? progressCallback = null) + public static void Decode(ReadOnlySpan blurHash, Pixel[,] pixels, double punch = 1.0, IProgress? 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 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); } diff --git a/BlurHash.System.Drawing.Common/BlurHasher.cs b/BlurHash.System.Drawing.Common/BlurHasher.cs index a70dd96..883ffe0 100644 --- a/BlurHash.System.Drawing.Common/BlurHasher.cs +++ b/BlurHash.System.Drawing.Common/BlurHasher.cs @@ -15,20 +15,21 @@ public static class BlurHasher /// The number of components used on the X-Axis for the DCT /// The number of components used on the Y-Axis for the DCT /// The resulting BlurHash string - public static string Encode(Image image, int componentsX, int componentsY) => Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY); + public static ReadOnlySpan Encode(Image image, int componentsX, int componentsY) => + Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY); /// /// Decodes a BlurHash string into a System.Drawing.Image /// - /// The blurhash string to decode + /// The blurHash string to decode /// The desired width of the output in pixels /// The desired height of the output in pixels /// 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. /// The decoded preview - public static Image Decode(string blurhash, int outputWidth, int outputHeight, double punch = 1.0) + public static Image Decode(ReadOnlySpan 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); } diff --git a/BlurHash/Models/BlurHasher.cs b/BlurHash/Models/BlurHasher.cs index 51379ec..97df14f 100644 --- a/BlurHash/Models/BlurHasher.cs +++ b/BlurHash/Models/BlurHasher.cs @@ -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 _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 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 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; } diff --git a/Instance/DlibDotNet.cs b/Instance/DlibDotNet.cs index ecd6eca..d83f936 100644 --- a/Instance/DlibDotNet.cs +++ b/Instance/DlibDotNet.cs @@ -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 _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(); _Log = Serilog.Log.ForContext(); - _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> sourceDirectoryChanges, Dictionary> 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(), item.Property.Width.Value, item.Property.Height.Value); - string thumbHashJson = JsonSerializer.Serialize(Array.Empty())[1..^1]; - if (!Regex.Matches(thumbHashJson, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]").Any()) - fileName = Path.Combine(c2ThumbHasherSingletonDirectory, $"{thumbHashJson}.png"); - else - { - // string thumbHash = BitConverter.ToString(Array.Empty()).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(), item.Property.Width.Value, item.Property.Height.Value); + // string thumbHashJson = JsonSerializer.Serialize(Array.Empty())[1..^1]; + // if (!Regex.Matches(thumbHashJson, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]").Any()) + // fileName = Path.Combine(c2HasherSingletonDirectory, $"{thumbHashJson}.png"); + // else + // { + // // string thumbHash = BitConverter.ToString(Array.Empty()).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> 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, diff --git a/Instance/Instance.csproj b/Instance/Instance.csproj index 46cb320..94960c1 100644 --- a/Instance/Instance.csproj +++ b/Instance/Instance.csproj @@ -49,10 +49,11 @@ - + + @@ -60,7 +61,6 @@ - diff --git a/Metadata/Models/B_Metadata.cs b/Metadata/Models/B_Metadata.cs index e517760..04cbf97 100644 --- a/Metadata/Models/B_Metadata.cs +++ b/Metadata/Models/B_Metadata.cs @@ -19,28 +19,13 @@ public class B_Metadata private readonly IReadOnlyDictionary _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(); _PropertiesChangedForMetadata = propertiesChangedForMetadata; _ForceMetadataLastWriteTimeToCreationTime = forceMetadataLastWriteTimeToCreationTime; _WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; - string checkDirectory; - List 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 jsonGroups = new() { { "{}", collection.ToArray() } }; - _JsonGroups = jsonGroups; + _JsonGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(configuration.ResultAllInOne, bResultsFullGroupDirectory); } public override string ToString() diff --git a/Person/Person.csproj b/Person/Person.csproj index d403867..429d869 100644 --- a/Person/Person.csproj +++ b/Person/Person.csproj @@ -5,7 +5,7 @@ enable Exe win-x64;linux-x64 - net6.0 + net7.0 7ca5318a-9332-4217-b9d8-cae696629934 diff --git a/Property/Models/A_Property.cs b/Property/Models/A_Property.cs index 5686c6a..34f4002 100644 --- a/Property/Models/A_Property.cs +++ b/Property/Models/A_Property.cs @@ -39,22 +39,7 @@ public class A_Property _AngleBracketCollection = new List(); _MaxDegreeOfParallelism = maxDegreeOfParallelism; _WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; - string checkDirectory; - List 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 jsonGroups = new() { { "{}", collection.ToArray() } }; - _JsonGroups = jsonGroups; + _JsonGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(configuration.ResultAllInOne, aResultsFullGroupDirectory); } public override string ToString() diff --git a/Property/Property.csproj b/Property/Property.csproj index 3b5eefe..0863b75 100644 --- a/Property/Property.csproj +++ b/Property/Property.csproj @@ -5,7 +5,7 @@ enable library win-x64;linux-x64 - net6.0 + net7.0 Phares.View.by.Distance.Property diff --git a/Shared/Models/Methods/IBlurHasher.cs b/Shared/Models/Methods/IBlurHasher.cs index 138fa9b..e487975 100644 --- a/Shared/Models/Methods/IBlurHasher.cs +++ b/Shared/Models/Methods/IBlurHasher.cs @@ -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); } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPath.cs b/Shared/Models/Stateless/Methods/IPath.cs index 164f727..bbdeca1 100644 --- a/Shared/Models/Stateless/Methods/IPath.cs +++ b/Shared/Models/Stateless/Methods/IPath.cs @@ -59,4 +59,9 @@ public interface IPath static string GetDirectory(string sourceDirectory, int level, string directoryName) => XPath.GetDirectory(sourceDirectory, level, directoryName); + Dictionary TestStatic_GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory) => + GetKeyValuePairs(resultAllInOne, resultsFullGroupDirectory); + static Dictionary GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory) => + XPath.GetKeyValuePairs(resultAllInOne, resultsFullGroupDirectory); + } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/XPath.cs b/Shared/Models/Stateless/Methods/XPath.cs index 61b28e5..ab0c214 100644 --- a/Shared/Models/Stateless/Methods/XPath.cs +++ b/Shared/Models/Stateless/Methods/XPath.cs @@ -257,4 +257,31 @@ internal abstract class XPath } } + internal static Dictionary GetKeyValuePairs(string resultAllInOne, string? resultsFullGroupDirectory) + { + Dictionary results = new(); + string checkDirectory; + List 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; + } + } \ No newline at end of file diff --git a/Shared/View-by-Distance.Shared.csproj b/Shared/View-by-Distance.Shared.csproj index ec0d6dd..3301aeb 100644 --- a/Shared/View-by-Distance.Shared.csproj +++ b/Shared/View-by-Distance.Shared.csproj @@ -4,7 +4,7 @@ 10.0 enable win-x64;linux-x64 - net6.0 + net7.0 Phares.View.by.Distance.Shared diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 4fe1464..95aca58 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -41,10 +41,11 @@ - - + + + diff --git a/Tests/UnitTestResize.cs b/Tests/UnitTestResize.cs index a95925f..c9c6e53 100644 --- a/Tests/UnitTestResize.cs +++ b/Tests/UnitTestResize.cs @@ -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);