using System; using System.Threading.Tasks; using CommunityToolkit.Diagnostics; using StrixMusic.Sdk.CoreModels; using StrixMusic.Sdk.FileMetadata.Models; namespace StrixMusic.Cores.Files.Models { /// public sealed class FilesCoreImage : ICoreImage { private readonly ImageMetadata _imageMetadata; /// /// Creates a new instance of . /// /// The source core. /// The image metadata to wrap around. public FilesCoreImage(ICore sourceCore, ImageMetadata imageMetadata) { _imageMetadata = imageMetadata; // Guard.IsNotNull() wasn't working here. Fallback to ThrowHelper. Uri = imageMetadata.Uri ?? ThrowHelper.ThrowArgumentNullException(nameof(imageMetadata.Uri)); Height = (double?)imageMetadata.Height ?? ThrowHelper.ThrowArgumentNullException(nameof(imageMetadata.Height)); Width = (double?)imageMetadata.Width ?? ThrowHelper.ThrowArgumentNullException(nameof(imageMetadata.Width)); SourceCore = sourceCore; } /// public ICore SourceCore { get; } /// public Uri Uri { get; } /// public double Height { get; } /// public double Width { get; } /// public ValueTask DisposeAsync() { return default; } } }