eliminates region sections

This commit is contained in:
BinaryAlley committed 2024-10-12 22:03:57 +03:00
1 parent 705c02b90d
commit 405fc1ff9a
370 files changed
+47 -1618

No files matched your search

@@ -16,7 +16,6 @@ namespace Lumina.Domain.Common.DependencyInjection;
/// </summary>
public static class DomainLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the services of the Domain layer into the dependency injection container.
/// </summary>
@@ -44,5 +43,4 @@ public static class DomainLayerServices
services.AddSingleton<IFileSystem, FileSystem>();
return services;
}
#endregion
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class FileManagement
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error ParentNodeCannotBeNull => Error.Failure(nameof(ParentNodeCannotBeNull));
public static Error FileCopyError => Error.Failure(nameof(FileCopyError));
public static Error FileMoveError => Error.Failure(nameof(FileMoveError));
@@ -29,6 +28,5 @@ public static partial class Errors
public static Error FileAlreadyExists => Error.Conflict(nameof(FileAlreadyExists));
public static Error DirectoryNotFound => Error.NotFound(nameof(DirectoryNotFound));
public static Error DirectoryAlreadyExists => Error.Conflict(nameof(DirectoryAlreadyExists));
#endregion
}
}
}
@@ -10,9 +10,7 @@ namespace Lumina.Domain.Common.Errors;
public static partial class Errors
{
public static class MediaContributor
{
#region ==================================================================== PROPERTIES =================================================================================
{
public static Error ContributorsListCannotBeNull => Error.Validation(nameof(ContributorsListCannotBeNull));
public static Error ContributorNameCannotBeEmpty => Error.Validation(nameof(ContributorNameCannotBeEmpty));
public static Error ContributorDisplayNameCannotBeEmpty => Error.Validation(nameof(ContributorDisplayNameCannotBeEmpty));
@@ -23,6 +21,5 @@ public static partial class Errors
public static Error RoleCategoryCannotBeEmpty => Error.Validation(nameof(RoleCategoryCannotBeEmpty));
public static Error RoleCategoryMustBeMaximum50CharactersLong => Error.Validation(nameof(RoleCategoryMustBeMaximum50CharactersLong));
public static Error ContributorRoleCannotBeNull => Error.Validation(nameof(ContributorRoleCannotBeNull));
#endregion
}
}
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class Metadata
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error MetadataCannotBeNull => Error.Validation(nameof(MetadataCannotBeNull));
public static Error TitleCannotBeEmpty => Error.Validation(nameof(TitleCannotBeEmpty));
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(nameof(TitleMustBeMaximum255CharactersLong));
@@ -43,6 +42,5 @@ public static partial class Errors
public static Error RatingVoteCountMustBePositive => Error.Validation(nameof(RatingVoteCountMustBePositive));
public static Error RatingsListCannotBeNull => Error.Validation(nameof(RatingsListCannotBeNull));
public static Error InvalidIsoCode => Error.Validation(nameof(InvalidIsoCode));
#endregion
}
}
}
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using ErrorOr;
#endregion
@@ -11,8 +11,6 @@ public static partial class Errors
{
public static class Permission
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error UnauthorizedAccess => Error.Failure(nameof(UnauthorizedAccess));
#endregion
}
}
}
@@ -11,9 +11,7 @@ public static partial class Errors
{
public static class Thumbnails
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
#endregion
}
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class WrittenContent
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error BookAlreadyExists => Error.Conflict(nameof(BookAlreadyExists));
public static Error IsbnValueCannotBeEmpty => Error.Validation(nameof(IsbnValueCannotBeEmpty));
public static Error IsbnListCannotBeNull => Error.Validation(nameof(IsbnListCannotBeNull));
@@ -36,6 +35,5 @@ public static partial class Errors
public static Error UnknownBookFormat => Error.Validation(nameof(UnknownBookFormat));
public static Error EditionMustBeMaximum50CharactersLong => Error.Validation(nameof(EditionMustBeMaximum50CharactersLong));
public static Error VolumeNumberMustBeGreaterThanZero => Error.Validation(nameof(VolumeNumberMustBeGreaterThanZero));
#endregion
}
}
}
@@ -9,7 +9,6 @@ namespace Lumina.Domain.Common.Events;
/// </summary>
public interface IDomainEvent
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the id of the domain event.
/// </summary>
@@ -19,5 +18,4 @@ public interface IDomainEvent
/// Gets the date and time when the domain event occurred.
/// </summary>
DateTime OccurredOn { get; }
#endregion
}
@@ -6,7 +6,6 @@
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
@@ -25,5 +24,4 @@ public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
}
#pragma warning restore CS8618
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Common.Models.Core;
/// <typeparam name="TId">The type representing the unique identifier for the Entity. It should be a non-nullable type.</typeparam>
public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the unique identifier of the entity.
/// </summary>
@@ -25,9 +24,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
/// Gets the date and time when the entity was last updated.
/// </summary>
public DateTime? Updated { get; set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
@@ -46,9 +43,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
@@ -99,5 +94,4 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
return Id.GetHashCode();
}
#endregion
}
@@ -12,14 +12,11 @@ namespace Lumina.Domain.Common.Models.Core;
[DebuggerDisplay("{Value}")]
public abstract class EntityId<TId> : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value representing the entity identifier.
/// </summary>
public TId Value { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="EntityId{TId}"/> class.
/// </summary>
@@ -37,9 +34,7 @@ public abstract class EntityId<TId> : ValueObject
{
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
@@ -57,5 +52,4 @@ public abstract class EntityId<TId> : ValueObject
{
return Value?.ToString() ?? base.ToString();
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Common.Models.Core;
/// </summary>
public abstract class ValueObject : IEquatable<ValueObject>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
@@ -72,5 +71,4 @@ public abstract class ValueObject : IEquatable<ValueObject>
return GetEqualityComponents().Select(x => x?.GetHashCode() ?? 0)
.Aggregate((x, y) => x ^ y);
}
#endregion
}
@@ -7,11 +7,8 @@ namespace Lumina.Domain.Common.Primitives;
/// <typeparam name="TValue">The type of the value represented by this structure.</typeparam>
public readonly struct Optional<TValue>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly TValue? _value;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets a value indicating whether this structure has a value.
/// </summary>
@@ -21,9 +18,7 @@ public readonly struct Optional<TValue>
/// Gets the value represented by this structure.
/// </summary>
public TValue Value => HasValue ? _value! : default!;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Optional{TValue}"/> structure.
/// </summary>
@@ -34,9 +29,7 @@ public readonly struct Optional<TValue>
_value = value;
HasValue = hasValue;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Custom implementation operator for converting <paramref name="value"/> to an <see cref="Optional{TValue}"/>.
/// </summary>
@@ -94,5 +87,4 @@ public readonly struct Optional<TValue>
{
return HasValue ? Value?.ToString()! : string.Empty;
}
#endregion
}
@@ -14,12 +14,9 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Title}")]
public abstract class BaseMetadata : ValueObject
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<Tag> _tags;
private readonly List<Genre> _genres;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the title of the media item.
/// </summary>
@@ -59,9 +56,7 @@ public abstract class BaseMetadata : ValueObject
/// Gets the list of genres associated with the media item.
/// </summary>
public IReadOnlyCollection<Genre> Genres => _genres.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BaseMetadata"/> class.
/// </summary>
@@ -93,9 +88,7 @@ public abstract class BaseMetadata : ValueObject
Language = language;
OriginalLanguage = originalLanguage;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <inheritdoc/>
public override IEnumerable<object> GetEqualityComponents()
{
@@ -110,5 +103,4 @@ public abstract class BaseMetadata : ValueObject
yield return Language;
yield return OriginalLanguage;
}
#endregion
}
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Name}")]
public class Genre : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the genre element of the media item.
/// </summary>
public string Name { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Genre"/> class.
/// </summary>
@@ -29,9 +26,7 @@ public class Genre : ValueObject
{
Name = name.Trim();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Genre"/> class.
/// </summary>
@@ -60,5 +55,4 @@ public class Genre : ValueObject
{
return Name;
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{LanguageCode}")]
public class LanguageInfo : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the ISO 639-1 two-letter language code.
/// </summary>
@@ -29,9 +28,7 @@ public class LanguageInfo : ValueObject
/// Gets an optional native name of the language.
/// </summary>
public Optional<string> NativeName { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="LanguageInfo"/> class.
/// </summary>
@@ -44,9 +41,7 @@ public class LanguageInfo : ValueObject
LanguageName = languageName;
NativeName = nativeName;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="LanguageInfo"/> class.
/// </summary>
@@ -83,5 +78,4 @@ public class LanguageInfo : ValueObject
{
return $"{LanguageCode} - {LanguageName}";
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Value}/{MaxValue}")]
public abstract class Rating : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the numeric value of the rating.
/// </summary>
@@ -27,9 +26,7 @@ public abstract class Rating : ValueObject
/// Gets the optional number of votes or reviews this rating is based on.
/// </summary>
public Optional<int> VoteCount { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
@@ -42,9 +39,7 @@ public abstract class Rating : ValueObject
MaxValue = maxValue;
VoteCount = voteCount;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Returns the rating as a percentage.
/// </summary>
@@ -53,5 +48,4 @@ public abstract class Rating : ValueObject
{
return Value / MaxValue * 100;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{ReleaseYear}")]
public class ReleaseInfo : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the optional original release date of the media item.
/// </summary>
@@ -46,9 +45,7 @@ public class ReleaseInfo : ValueObject
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
/// </summary>
public Optional<string> ReleaseVersion { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ReleaseInfo"/> class.
/// </summary>
@@ -73,9 +70,7 @@ public class ReleaseInfo : ValueObject
ReleaseCountry = releaseCountry;
ReleaseVersion = releaseVersion;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="ReleaseInfo"/> class.
/// </summary>
@@ -117,5 +112,4 @@ public class ReleaseInfo : ValueObject
yield return ReleaseCountry;
yield return ReleaseVersion;
}
#endregion
}
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Name}")]
public class Tag : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the tag element of the media item.
/// </summary>
public string Name { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Tag"/> class.
/// </summary>
@@ -29,9 +26,7 @@ public class Tag : ValueObject
{
Name = name.Trim();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Tag"/> class.
/// </summary>
@@ -60,5 +55,4 @@ public class Tag : ValueObject
{
return Name;
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.AudioLibrary.AudioLibraryAggregate.Value
[DebuggerDisplay("{Title}")]
public class AudioMetadata : BaseMetadata
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the duration of the video in seconds.
/// </summary>
@@ -44,9 +43,7 @@ public class AudioMetadata : BaseMetadata
/// Gets the bitrate of the audio in kbps.
/// </summary>
public Optional<int> Bitrate { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AudioMetadata"/> class.
/// </summary>
@@ -87,9 +84,7 @@ public class AudioMetadata : BaseMetadata
AudioCodec = audioCodec;
Bitrate = bitrate;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="AudioMetadata"/> class.
/// </summary>
@@ -155,5 +150,4 @@ public class AudioMetadata : BaseMetadata
yield return AudioCodec;
yield return Bitrate;
}
#endregion
}
@@ -16,11 +16,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
[DebuggerDisplay("{Id.Path}")]
public sealed class Directory : FileSystemItem
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<FileSystemItem> _items = [];
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the creation date of the file system item. Can be optional if the information is not available.
/// </summary>
@@ -35,9 +32,7 @@ public sealed class Directory : FileSystemItem
/// Gets the collection of file system items that are children to the current directory entity.
/// </summary>
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Directory"/> class.
/// </summary>
@@ -50,9 +45,7 @@ public sealed class Directory : FileSystemItem
DateCreated = dateCreated;
DateModified = dateModified;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Directory"/> class.
/// </summary>
@@ -146,5 +139,4 @@ public sealed class Directory : FileSystemItem
_items.Remove(item);
return Result.Updated;
}
#endregion
}
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
[DebuggerDisplay("{Id.Path}")]
public sealed class File : FileSystemItem
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the creation date of the file system item. Can be optional if the information is not available.
/// </summary>
@@ -31,9 +30,7 @@ public sealed class File : FileSystemItem
/// Gets or sets the size in bytes of the current file entity.
/// </summary>
public long Size { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="File"/> class.
/// </summary>
@@ -48,9 +45,7 @@ public sealed class File : FileSystemItem
DateModified = dateModified;
Size = size;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="File"/> class.
/// </summary>
@@ -153,5 +148,4 @@ public sealed class File : FileSystemItem
Name = newName;
return Result.Updated;
}
#endregion
}
@@ -14,19 +14,14 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
[DebuggerDisplay("{Id.Path}")]
public sealed class UnixRootItem : FileSystemItem
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<FileSystemItem> _items = [];
private const string PATH = "/";
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of file system items that are children to the current file system root entity.
/// </summary>
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="UnixRootItem"/> class.
/// </summary>
@@ -35,9 +30,7 @@ public sealed class UnixRootItem : FileSystemItem
private UnixRootItem(FileSystemPathId id, string name) : base(id, name, FileSystemItemType.Root)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="UnixRootItem"/> class.
/// </summary>
@@ -59,5 +52,4 @@ public sealed class UnixRootItem : FileSystemItem
return setStatusResult.Errors;
return newRoot;
}
#endregion
}
@@ -14,18 +14,13 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
[DebuggerDisplay("{Id.Path}")]
public sealed class WindowsRootItem : FileSystemItem
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<FileSystemItem> _items = [];
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of file system items that are children to the current file system root entity.
/// </summary>
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="WindowsRootItem"/> class.
/// </summary>
@@ -34,9 +29,7 @@ public sealed class WindowsRootItem : FileSystemItem
private WindowsRootItem(FileSystemPathId id, string name) : base(id, name, FileSystemItemType.Root)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="WindowsRootItem"/> class.
/// </summary>
@@ -87,5 +80,4 @@ public sealed class WindowsRootItem : FileSystemItem
return setStatusResult.Errors;
return newFile;
}
#endregion
}
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
[DebuggerDisplay("{Name}")]
public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the name of the file system item.
/// </summary>
@@ -36,9 +35,7 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
/// Gets or sets the tpe of the file system item.
/// </summary>
public FileSystemItemType Type { get; protected set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemItem"/> class.
/// </summary>
@@ -50,9 +47,7 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
Name = name;
Type = fileSystemItemType;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Sets the status of the filesystem item.
/// </summary>
@@ -77,5 +72,4 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
return Errors.FileManagement.ParentNodeCannotBeNull;
return Result.Updated;
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
internal class DirectoryProviderService : IDirectoryProviderService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DirectoryProviderService"/> class.
/// </summary>
@@ -34,9 +31,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
_fileSystem = fileSystem;
_fileSystemPermissionsService = fileSystemPermissionsService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves a list of subdirectory paths from the specified path.
/// </summary>
@@ -322,5 +317,4 @@ internal class DirectoryProviderService : IDirectoryProviderService
_fileSystem.DirectoryInfo.New(path.Path).Delete(true);
return Result.Deleted;
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class DirectoryService : IDirectoryService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContext _platformContext;
private readonly IEnvironmentContext _environmentContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DirectoryService"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class DirectoryService : IDirectoryService
_platformContext = platformContextManager.GetCurrentContext();
_environmentContext = environmentContext;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves subdirectories for the specified string path.
/// </summary>
@@ -336,5 +331,4 @@ public class DirectoryService : IDirectoryService
{
return _environmentContext.DirectoryProviderService.DeleteDirectory(path);
}
#endregion
}
@@ -15,12 +15,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class DriveService : IDriveService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
private readonly IPlatformContext _platformContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DriveService"/> class.
/// </summary>
@@ -30,9 +27,7 @@ public class DriveService : IDriveService
_fileSystem = fileSystem;
_platformContext = platformContextManager.GetCurrentContext();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves the list of drives.
/// </summary>
@@ -64,5 +59,4 @@ public class DriveService : IDriveService
.Select(errorOrDrive => errorOrDrive.Value)
.AsEnumerable());
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
internal class FileProviderService : IFileProviderService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileProviderService"/> class.
/// </summary>
@@ -34,9 +31,7 @@ internal class FileProviderService : IFileProviderService
_fileSystem = fileSystem;
_fileSystemPermissionsService = fileSystemPermissionsService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves a list of file paths at the specified path.
/// </summary>
@@ -284,5 +279,4 @@ internal class FileProviderService : IFileProviderService
_fileSystem.File.Delete(path.Path);
return Result.Deleted;
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class FileService : IFileService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContext _platformContext;
private readonly IEnvironmentContext _environmentContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileService"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class FileService : IFileService
_platformContext = platformContextManager.GetCurrentContext();
_environmentContext = environmentContext;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves files for the specified string path.
/// </summary>
@@ -327,5 +322,4 @@ public class FileService : IFileService
{
return true;
}
#endregion
}
@@ -18,11 +18,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
internal class FileSystemPermissionsService : IFileSystemPermissionsService // TODO: refactor towards abstractions that could allow testing
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContextManager _platformContextManager;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemPermissionsService"/> class.
/// </summary>
@@ -31,9 +28,7 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
{
_platformContextManager = platformContextManager;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> can be accessed.
/// </summary>
@@ -209,5 +204,4 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
}
return allowAccess;
}
#endregion
}
@@ -20,13 +20,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class FileTypeService : IFileTypeService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
private const int BUFFER_SIZE = 18; // 18 bytes should be more than enough for common images header types
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileTypeService"/> class.
/// </summary>
@@ -37,9 +34,7 @@ public class FileTypeService : IFileTypeService
_fileSystem = fileSystem;
_fileSystemPermissionsService = fileSystemPermissionsService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Determines if <paramref name="file"/> is of type image or not, and returns its type.
/// </summary>
@@ -159,5 +154,4 @@ public class FileTypeService : IFileTypeService
return ImageType.WEBP; // WEBP
return ImageType.None;
}
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IDirectoryProviderService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves a list of subdirectory paths from the specified path.
/// </summary>
@@ -91,5 +90,4 @@ public interface IDirectoryProviderService
/// <param name="path">The path of the directory to be deleted.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a directory, or an error.</returns>
ErrorOr<Deleted> DeleteDirectory(FileSystemPathId path);
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IDirectoryService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves subdirectories for the specified string path.
/// </summary>
@@ -77,5 +76,4 @@ public interface IDirectoryService
/// <param name="path">String representation of the directory path.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a directory, or an error.</returns>
ErrorOr<Deleted> DeleteDirectory(string path);
#endregion
}
@@ -10,11 +10,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IDriveService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves the list of drives.
/// </summary>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of drives or an error.</returns>
ErrorOr<IEnumerable<FileSystemItem>> GetDrives();
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IFileProviderService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves a list of files at the specified path.
/// </summary>
@@ -96,5 +95,4 @@ public interface IFileProviderService
/// <param name="path">The path of the file to be deleted.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a file, or an error.</returns>
ErrorOr<Deleted> DeleteFile(FileSystemPathId path);
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IFileService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Retrieves files for the specified string path.
/// </summary>
@@ -69,5 +68,4 @@ public interface IFileService
/// <param name="path">String representation of the file path.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a file, or an error.</returns>
ErrorOr<Deleted> DeleteFile(string path);
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IFileSystemPermissionsService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> can be accessed.
/// </summary>
@@ -19,5 +18,4 @@ public interface IFileSystemPermissionsService
/// <param name="isFile">Indicates whether the path represents a file or directory.</param>
/// <returns><see langword="true"/>, if <paramref name="path"/> can be accessed, <see langword="false"/> otherwise.</returns>
bool CanAccessPath(FileSystemPathId path, FileAccessMode accessMode, bool isFile = true);
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IFileTypeService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Determines if <paramref name="file"/> is of type image or not, and returns its type.
/// </summary>
@@ -30,5 +29,4 @@ public interface IFileTypeService
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the type of image or an error.</returns>
Task<ErrorOr<ImageType>> GetImageTypeAsync(FileSystemPathId path, CancellationToken cancellationToken);
#endregion
}
@@ -11,14 +11,11 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IPathService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the character used to separate path segments.
/// </summary>
char PathSeparator { get; }
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> is a valid path.
/// </summary>
@@ -68,5 +65,4 @@ public interface IPathService
/// <param name="path">The path for which to get the root.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
ErrorOr<PathSegment> GetPathRoot(string path);
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IThumbnailService
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the thumbnail of a file at the specified path.
/// </summary>
@@ -30,5 +29,4 @@ public interface IThumbnailService
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of bytes representing the thumbnail of the file at the specified path or an error.</returns>
Task<ErrorOr<Thumbnail>> GetThumbnailAsync(FileSystemPathId path, int quality, CancellationToken cancellationToken);
#endregion
}
@@ -13,18 +13,13 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class PathService : IPathService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContext _platformContext;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the character used to separate path segments.
/// </summary>
public char PathSeparator => _platformContext.PathStrategy.PathSeparator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PathService"/> class.
/// </summary>
@@ -33,9 +28,7 @@ public class PathService : IPathService
{
_platformContext = platformContextManager.GetCurrentContext();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> is a valid path.
/// </summary>
@@ -129,5 +122,4 @@ public class PathService : IPathService
return newPathResult.Errors;
return _platformContext.PathStrategy.GetPathRoot(newPathResult.Value);
}
#endregion
}
@@ -21,11 +21,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class ThumbnailService : IThumbnailService
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IEnvironmentContext _environmentContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailService"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class ThumbnailService : IThumbnailService
{
_environmentContext = environmentContext;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the thumbnail of a file at the specified path.
/// </summary>
@@ -191,5 +186,4 @@ public class ThumbnailService : IThumbnailService
{
return ((value - fromSource) * (toTarget - fromTarget) / (toSource - fromSource)) + fromTarget;
}
#endregion
}
@@ -9,7 +9,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
internal class EnvironmentContext : IEnvironmentContext
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for identifying and handling different file types.
/// </summary>
@@ -24,9 +23,7 @@ internal class EnvironmentContext : IEnvironmentContext
/// Gets the service for performing directory-related operations.
/// </summary>
public IDirectoryProviderService DirectoryProviderService { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="EnvironmentContext"/> class.
/// </summary>
@@ -39,5 +36,4 @@ internal class EnvironmentContext : IEnvironmentContext
FileProviderService = fileProviderService;
DirectoryProviderService = directoryProviderService;
}
#endregion
}
@@ -9,7 +9,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IEnvironmentContext
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for identifying and handling different file types.
/// </summary>
@@ -24,5 +23,4 @@ public interface IEnvironmentContext
/// Gets the service for providing file system directories.
/// </summary>
IDirectoryProviderService DirectoryProviderService { get; }
#endregion
}
@@ -11,11 +11,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IPathStrategy
{
#region ==================================================================== PROPERTIES =================================================================================
public char PathSeparator { get; }
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> is a valid path.
/// </summary>
@@ -65,5 +62,4 @@ public interface IPathStrategy
/// <param name="path">The path for which to get the root.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing the root of <paramref name="path"/>, or an error.</returns>
ErrorOr<PathSegment> GetPathRoot(FileSystemPathId path);
#endregion
}
@@ -17,15 +17,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class UnixPathStrategy : IUnixPathStrategy
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
public char PathSeparator => '/';
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="UnixPathStrategy"/> class.
/// </summary>
@@ -34,9 +29,7 @@ public class UnixPathStrategy : IUnixPathStrategy
{
_fileSystem = fileSystem;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> is a valid path.
/// </summary>
@@ -176,5 +169,4 @@ public class UnixPathStrategy : IUnixPathStrategy
return PathSegment.Create(PathSeparator.ToString(), isDirectory: false, isDrive: true);
return Errors.FileManagement.InvalidPath;
}
#endregion
}
@@ -17,15 +17,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class WindowsPathStrategy : IWindowsPathStrategy
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileSystem _fileSystem;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
public char PathSeparator => '\\';
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="WindowsPathStrategy"/> class.
/// </summary>
@@ -34,9 +29,7 @@ public class WindowsPathStrategy : IWindowsPathStrategy
{
_fileSystem = fileSystem;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if <paramref name="path"/> is a valid path.
/// </summary>
@@ -232,5 +225,4 @@ public class WindowsPathStrategy : IWindowsPathStrategy
// if we reach here, the path is neither a valid UNC path nor a valid drive path
return Errors.FileManagement.InvalidPath;
}
#endregion
}
@@ -9,12 +9,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IOperatingSystemInfo
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Determines if the current Operating System plaform is <paramref name="platform"/>.
/// </summary>
/// <param name="platform">The Operating System platform to check against.</param>
/// <returns><see langword="true"/> if tthe current Operating System platform is equal to <paramref name="platform"/>, <see langword="false"/> otherwise.</returns>
bool IsOSPlatform(OSPlatform platform);
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IPlatformContext
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the platform for the current platform context.
/// </summary>
@@ -20,5 +19,4 @@ public interface IPlatformContext
/// Gets the path strategy for the current platform context.
/// </summary>
IPathStrategy PathStrategy { get; }
#endregion
}
@@ -5,12 +5,10 @@
/// </summary>
public interface IPlatformContextFactory
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates and returns the appropriate platform context.
/// </summary>
/// <typeparam name="TIPlatformContext">The type of platform context to create.</typeparam>
/// <returns>The created platform context.</returns>
TIPlatformContext CreateStrategy<TIPlatformContext>() where TIPlatformContext : IPlatformContext;
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public interface IPlatformContextManager
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the current platform context.
/// </summary>
@@ -23,5 +22,4 @@ public interface IPlatformContextManager
/// <param name="platformType">The platform to be set.</param>
/// <exception cref="ArgumentException">Thrown when an unsupported platform type is provided.</exception>
void SetCurrentPlatform(PlatformType platformType);
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
[ExcludeFromCodeCoverage]
internal class OperatingSystemInfo : IOperatingSystemInfo
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Determines if the current Operating System plaform is <paramref name="platform"/>.
/// </summary>
@@ -21,5 +20,4 @@ internal class OperatingSystemInfo : IOperatingSystemInfo
{
return RuntimeInformation.IsOSPlatform(platform);
}
#endregion
}
@@ -10,11 +10,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class PlatformContextFactory : IPlatformContextFactory
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IServiceProvider _serviceProvider;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PlatformContextFactory"/> class.
/// </summary>
@@ -23,9 +20,7 @@ public class PlatformContextFactory : IPlatformContextFactory
{
_serviceProvider = serviceProvider;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates and returns the appropriate platform context.
/// </summary>
@@ -35,5 +30,4 @@ public class PlatformContextFactory : IPlatformContextFactory
{
return _serviceProvider.GetRequiredService<TPlatformContext>() ?? throw new ArgumentException();
}
#endregion
}
@@ -11,13 +11,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class PlatformContextManager : IPlatformContextManager
{
#region ================================================================== FIELD MEMBERS ================================================================================
private IPlatformContext? _currentPlatformContext;
private readonly IPlatformContextFactory _platformContextFactory;
private readonly IOperatingSystemInfo _operatingSystemInfo;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PlatformContextManager"/> class.
/// </summary>
@@ -28,9 +25,7 @@ public class PlatformContextManager : IPlatformContextManager
_platformContextFactory = platformContextFactory;
_operatingSystemInfo = operatingSystemInfo;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the current platform context.
/// </summary>
@@ -63,5 +58,4 @@ public class PlatformContextManager : IPlatformContextManager
_ => throw new ArgumentException($"Unsupported platform type: {platformType}"),
};
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
internal class UnixPlatformContext : IUnixPlatformContext
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the platform type, which is Unix for this context.
/// </summary>
@@ -20,9 +19,7 @@ internal class UnixPlatformContext : IUnixPlatformContext
/// Gets the path strategy for Unix platforms.
/// </summary>
public IPathStrategy PathStrategy { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="UnixPlatformContext"/> class.
/// </summary>
@@ -31,5 +28,4 @@ internal class UnixPlatformContext : IUnixPlatformContext
{
PathStrategy = unixPathStrategy;
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
/// </summary>
public class WindowsPlatformContext : IWindowsPlatformContext
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the platform type, which is Windows for this context.
/// </summary>
@@ -20,9 +19,7 @@ public class WindowsPlatformContext : IWindowsPlatformContext
/// Gets the path strategy for Windows platforms.
/// </summary>
public IPathStrategy PathStrategy { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="WindowsPlatformContext"/> class.
/// </summary>
@@ -31,5 +28,4 @@ public class WindowsPlatformContext : IWindowsPlatformContext
{
PathStrategy = windowsPathStrategy;
}
#endregion
}
@@ -14,14 +14,11 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.V
[DebuggerDisplay("{Path}")]
public sealed class FileSystemPathId : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value of this object.
/// </summary>
public string Path { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemPathId"/> class.
/// </summary>
@@ -30,9 +27,7 @@ public sealed class FileSystemPathId : ValueObject
{
Path = path;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <inheritdoc />
public override IEnumerable<object> GetEqualityComponents()
{
@@ -52,5 +47,4 @@ public sealed class FileSystemPathId : ValueObject
return Errors.FileManagement.InvalidPath;
return new FileSystemPathId(path);
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.V
[DebuggerDisplay("{Name}")]
public class PathSegment : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the path segment.
/// </summary>
@@ -29,9 +28,7 @@ public class PathSegment : ValueObject
/// Gets the value indicating if the current path segment is a file system drive or not.
/// </summary>
public bool IsDrive { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PathSegment"/> class.
/// </summary>
@@ -44,9 +41,7 @@ public class PathSegment : ValueObject
IsDirectory = isDirectory;
IsDrive = isDrive;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="PathSegment"/> class.
/// </summary>
@@ -70,5 +65,4 @@ public class PathSegment : ValueObject
yield return IsDirectory;
yield return IsDrive;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.V
[DebuggerDisplay("{StreamId}")]
public class StreamInfo : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the id of the stream.
/// </summary>
@@ -55,9 +54,7 @@ public class StreamInfo : ValueObject
/// Gets the optional channels of the stream.
/// </summary>
public Optional<int> Channels { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="StreamInfo"/> class.
/// </summary>
@@ -88,9 +85,7 @@ public class StreamInfo : ValueObject
SampleRate = sampleRate;
Channels = channels;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="StreamInfo"/> class.
/// </summary>
@@ -136,5 +131,4 @@ public class StreamInfo : ValueObject
yield return SampleRate;
yield return Channels;
}
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.V
[DebuggerDisplay("{Type}")]
public class Thumbnail : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the type of the image represented by this thumbnail.
/// </summary>
@@ -23,9 +22,7 @@ public class Thumbnail : ValueObject
/// Gets the bytes of the image represented by this thumbnail.
/// </summary>
public byte[] Bytes { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Thumbnail"/> class.
/// </summary>
@@ -36,14 +33,11 @@ public class Thumbnail : ValueObject
Type = type;
Bytes = bytes;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <inheritdoc/>
public override IEnumerable<object> GetEqualityComponents()
{
yield return Type;
yield return Bytes;
}
#endregion
}
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
[DebuggerDisplay("{Id}: {Name}")]
public class MediaContributor : AggregateRoot<MediaContributorId>
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the contributor.
/// </summary>
@@ -41,9 +40,7 @@ public class MediaContributor : AggregateRoot<MediaContributorId>
/// Gets the date of death of the contributor.
/// </summary>
public Optional<DateOnly> DateOfDeath { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaContributor"/> class.
/// </summary>
@@ -65,9 +62,7 @@ public class MediaContributor : AggregateRoot<MediaContributorId>
DateOfBirth = dateOfBirth;
DateOfDeath = dateOfDeath;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="MediaContributor"/> class.
/// </summary>
@@ -95,5 +90,4 @@ public class MediaContributor : AggregateRoot<MediaContributorId>
{
return new MediaContributor(id, name, role, dateOfBirth, dateOfDeath);
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
[DebuggerDisplay("{DisplayName}")]
public sealed class MediaContributorName : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name by which the contributor is popularly known.
/// </summary>
@@ -24,9 +23,7 @@ public sealed class MediaContributorName : ValueObject
/// Gets the legal name of the contributor.
/// </summary>
public Optional<string> LegalName { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaContributorName"/> class.
/// </summary>
@@ -37,9 +34,7 @@ public sealed class MediaContributorName : ValueObject
DisplayName = displayName;
LegalName = legalName;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="MediaContributorName"/> class.
/// </summary>
@@ -58,5 +53,4 @@ public sealed class MediaContributorName : ValueObject
yield return DisplayName;
yield return LegalName;
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
/// </summary>
public sealed class MediaContributorId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaContributorId"/> class.
/// </summary>
@@ -19,9 +18,7 @@ public sealed class MediaContributorId : EntityId<Guid>
private MediaContributorId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="MediaContributorId"/> class.
/// </summary>
@@ -48,5 +45,4 @@ public sealed class MediaContributorId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
[DebuggerDisplay("{DisplayName}")]
public sealed class MediaContributorRole : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value representing this object.
/// </summary>
@@ -22,9 +21,7 @@ public sealed class MediaContributorRole : ValueObject
/// Gets the category of this object.
/// </summary>
public string Category { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaContributorRole"/> class.
/// </summary>
@@ -35,9 +32,7 @@ public sealed class MediaContributorRole : ValueObject
Name = name;
Category = category;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="MediaContributorRole"/> class, from a pre-existing <paramref name="value"/>.
/// </summary>
@@ -56,5 +51,4 @@ public sealed class MediaContributorRole : ValueObject
yield return Name;
yield return Category;
}
#endregion
}
@@ -16,12 +16,9 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.MovieLibraryAggregate;
[DebuggerDisplay("{Id}: {Title}")]
public sealed class Movie : Entity<MovieId>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<MediaContributorId> _contributors;
private readonly List<Rating> _ratings;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the video metadata of the movie.
/// </summary>
@@ -36,9 +33,7 @@ public sealed class Movie : Entity<MovieId>
/// Gets the list of media contributors (actors, directors, etc) starring in this movie.
/// </summary>
public IReadOnlyCollection<MediaContributorId> Contributors => _contributors.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Movie"/> class.
/// </summary>
@@ -63,9 +58,7 @@ public sealed class Movie : Entity<MovieId>
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Movie"/> class.
/// </summary>
@@ -92,5 +85,4 @@ public sealed class Movie : Entity<MovieId>
// TODO: enforce invariants
return new Movie(id, metadata, contributors, ratings);
}
#endregion
}
@@ -9,10 +9,8 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.MovieLibraryAggregate.Servi
/// </summary>
public interface IMovieLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of movies in the library.
/// </summary>
public ICollection<Movie> Movies { get; }
#endregion
}
@@ -10,10 +10,8 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.MovieLibraryAggregate.Servi
/// </summary>
public sealed class MovieLibraryService : IMovieLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of movies in the library.
/// </summary>
public ICollection<Movie> Movies => throw new NotImplementedException();
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.MovieLibraryAggregate.Value
[DebuggerDisplay("{Value}")]
public sealed class MovieId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MovieId"/> class.
/// </summary>
@@ -21,9 +20,7 @@ public sealed class MovieId : EntityId<Guid>
private MovieId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="MovieId"/> class.
/// </summary>
@@ -50,5 +47,4 @@ public sealed class MovieId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.MovieLibraryAggregate.Value
[DebuggerDisplay("{Title}")]
public class VideoMetadata : BaseMetadata
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the duration of the video in seconds.
/// </summary>
@@ -40,9 +39,7 @@ public class VideoMetadata : BaseMetadata
/// Gets the audio codec used.
/// </summary>
public Optional<string> AudioCodec { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="VideoMetadata"/> class.
/// </summary>
@@ -81,9 +78,7 @@ public class VideoMetadata : BaseMetadata
VideoCodec = videoCodec;
AudioCodec = audioCodec;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="VideoMetadata"/> class.
/// </summary>
@@ -133,5 +128,4 @@ public class VideoMetadata : BaseMetadata
yield return VideoCodec;
yield return AudioCodec;
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.Services;
/// </summary>
public interface IVideoLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing a movie library.
/// </summary>
@@ -20,5 +19,4 @@ public interface IVideoLibraryService
/// Gets the service for managing a TV shows library.
/// </summary>
public ITvShowLibraryService TvShowLibraryService { get; }
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.Services;
/// </summary>
public class VideoLibraryService : IVideoLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing a movie library.
/// </summary>
@@ -20,9 +19,7 @@ public class VideoLibraryService : IVideoLibraryService
/// Gets the service for managing a TV shows library.
/// </summary>
public ITvShowLibraryService TvShowLibraryService { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="VideoLibraryService"/> class.
/// </summary>
@@ -33,8 +30,4 @@ public class VideoLibraryService : IVideoLibraryService
MovieLibraryService = movieLibraryService;
TvShowLibraryService = tvShowLibraryService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
#endregion
}
}
@@ -9,10 +9,8 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.TvShowLibraryAggregate.Serv
/// </summary>
public interface ITvShowLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of TV shows in the library.
/// </summary>
public ICollection<TvShow> TvShows { get; }
#endregion
}
@@ -10,10 +10,8 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.TvShowLibraryAggregate.Serv
/// </summary>
public class TvShowLibraryService : ITvShowLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of TV shows in the library.
/// </summary>
public ICollection<TvShow> TvShows => throw new NotImplementedException();
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.TvShowLibraryAggregate.Valu
/// </summary>
public sealed class EpisodeId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeId"/> class.
/// </summary>
@@ -19,9 +18,7 @@ public sealed class EpisodeId : EntityId<Guid>
private EpisodeId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="EpisodeId"/> class.
/// </summary>
@@ -48,5 +45,4 @@ public sealed class EpisodeId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.TvShowLibraryAggregate.Valu
/// </summary>
public sealed class SeasonId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SeasonId"/> class.
/// </summary>
@@ -19,9 +18,7 @@ public sealed class SeasonId : EntityId<Guid>
private SeasonId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="SeasonId"/> class.
/// </summary>
@@ -48,5 +45,4 @@ public sealed class SeasonId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Core.Aggregates.VideoLibrary.TvShowLibraryAggregate.Valu
/// </summary>
public sealed class TvShowId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="TvShowId"/> class.
/// </summary>
@@ -19,9 +18,7 @@ public sealed class TvShowId : EntityId<Guid>
private TvShowId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="TvShowId"/> class.
/// </summary>
@@ -48,5 +45,4 @@ public sealed class TvShowId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -19,13 +19,10 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Id}: {Title}")]
public sealed class Book : AggregateRoot<BookId>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<MediaContributorId> _contributors;
private readonly List<BookRating> _ratings;
private readonly List<Isbn> _isbns;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the written content metadata of the book.
/// </summary>
@@ -110,9 +107,7 @@ public sealed class Book : AggregateRoot<BookId>
/// Gets the list of ratings for this book.
/// </summary>
public IReadOnlyCollection<BookRating> Ratings => _ratings.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Book"/> class.
/// </summary>
@@ -189,9 +184,7 @@ public sealed class Book : AggregateRoot<BookId>
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Book"/> class.
/// </summary>
@@ -329,5 +322,4 @@ public sealed class Book : AggregateRoot<BookId>
contributors,
ratings);
}
#endregion
}
@@ -15,11 +15,8 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Id}: {Title}")]
public sealed class BookSeries : Entity<BookSeriesId>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<Book> _books;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the written content metadata of the book series.
/// </summary>
@@ -34,9 +31,7 @@ public sealed class BookSeries : Entity<BookSeriesId>
/// Gets the collection of books in the series.
/// </summary>
public IReadOnlyCollection<Book> Books => _books.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BookSeries"/> class.
/// </summary>
@@ -52,9 +47,7 @@ public sealed class BookSeries : Entity<BookSeriesId>
IsComplete = isComplete;
_books = books;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="BookSeries"/> class.
/// </summary>
@@ -127,5 +120,4 @@ public sealed class BookSeries : Entity<BookSeriesId>
_books.Remove(book);
return Result.Deleted;
}
#endregion
}
@@ -10,10 +10,8 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
/// </summary>
public sealed class BookLibraryService : IBookLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of books in the library.
/// </summary>
public ICollection<Book> Books => throw new NotImplementedException();
#endregion
}
@@ -9,14 +9,12 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
/// </summary>
public interface IBookLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the collection of books in the library.
/// </summary>
ICollection<Book> Books { get; }
// ICollection<BookSeries> Series { get; }
#endregion
// void AddBook(Book book);
// void RemoveBook(Guid bookId);
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Value}")]
public sealed class BookId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BookId"/> class.
/// </summary>
@@ -21,9 +20,7 @@ public sealed class BookId : EntityId<Guid>
private BookId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="BookId"/> class.
/// </summary>
@@ -48,5 +45,4 @@ public sealed class BookId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Value}")]
public sealed class BookLibraryId : EntityId<Guid>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BookLibraryId"/> class.
/// </summary>
@@ -22,9 +21,7 @@ public sealed class BookLibraryId : EntityId<Guid>
private BookLibraryId(Guid value) : base(value)
{
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="BookLibraryId"/> class.
/// </summary>
@@ -51,5 +48,4 @@ public sealed class BookLibraryId : EntityId<Guid>
{
yield return Value;
}
#endregion
}
@@ -16,14 +16,11 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Value}/{MaxValue}")]
public class BookRating : Rating
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the optional source of the rating (e.g., "Goodreads", "Amazon").
/// </summary>
public Optional<BookRatingSource> Source { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
@@ -36,9 +33,7 @@ public class BookRating : Rating
{
Source = source;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Rating"/> class.
/// </summary>
@@ -80,5 +75,4 @@ public class BookRating : Rating
baseString += $" [{VoteCount.Value} votes]";
return baseString;
}
#endregion
}
@@ -13,11 +13,8 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Value}")]
public sealed class BookSeriesId : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
public Guid Value { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BookSeriesId"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public sealed class BookSeriesId : ValueObject
{
Value = value;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="BookSeriesId"/> class.
/// </summary>
@@ -53,5 +48,4 @@ public sealed class BookSeriesId : ValueObject
{
yield return Value;
}
#endregion
}
@@ -16,12 +16,9 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Value} ({Format})")]
public sealed class Isbn : ValueObject
{
#region ================================================================== FIELD MEMBERS ================================================================================
private static readonly Regex s_isbn10Regex = new(@"^(?:ISBN(?:-10)?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[-\ ]){3})[-\ 0-9X]{13}$)[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9X]$", RegexOptions.Compiled);
private static readonly Regex s_isbn13Regex = new(@"^(?:ISBN(?:-13)?:? )?(?=[0-9]{13}$|(?=(?:[0-9]+[-\ ]){4})[-\ 0-9]{17}$)97[89][-\ ]?[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9]$", RegexOptions.Compiled);
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value of the ISBN.
/// </summary>
@@ -31,9 +28,7 @@ public sealed class Isbn : ValueObject
/// Gets the format of the ISBN.
/// </summary>
public IsbnFormat Format { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Isbn"/> class.
/// </summary>
@@ -44,9 +39,7 @@ public sealed class Isbn : ValueObject
Value = value;
Format = format;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Isbn"/> class.
/// </summary>
@@ -122,5 +115,4 @@ public sealed class Isbn : ValueObject
yield return Value;
yield return Format;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
[DebuggerDisplay("{Title}")]
public class WrittenContentMetadata : BaseMetadata
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the publisher of the written content.
/// </summary>
@@ -25,9 +24,7 @@ public class WrittenContentMetadata : BaseMetadata
/// Gets the number of pages in the written content.
/// </summary>
public Optional<int> PageCount { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="WrittenContentMetadata"/> class.
/// </summary>
@@ -57,9 +54,7 @@ public class WrittenContentMetadata : BaseMetadata
Publisher = publisher;
PageCount = pageCount;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="WrittenContentMetadata"/> class.
/// </summary>
@@ -117,5 +112,4 @@ public class WrittenContentMetadata : BaseMetadata
yield return Publisher;
yield return PageCount;
}
#endregion
}
@@ -9,10 +9,8 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.Services;
/// </summary>
public interface IWrittenContentLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing book libraries.
/// </summary>
public IBookLibraryService BookLibraryService { get; }
#endregion
}
@@ -9,14 +9,11 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.Services;
/// </summary>
public class WrittenContentLibraryService : IWrittenContentLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing book libraries.
/// </summary>
public IBookLibraryService BookLibraryService { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="WrittenContentLibraryService"/> class.
/// </summary>
@@ -25,8 +22,4 @@ public class WrittenContentLibraryService : IWrittenContentLibraryService
{
BookLibraryService = bookLibraryService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
#endregion
}
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Services;
/// </summary>
public interface IMediaLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing a audio library.
/// </summary>
@@ -25,5 +24,4 @@ public interface IMediaLibraryService
/// Gets the service for managing a written content library.
/// </summary>
public IWrittenContentLibraryService WrittenContentLibraryService { get; }
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Core.Services;
/// </summary>
public class MediaLibraryService : IMediaLibraryService
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the service for managing a video library.
/// </summary>
@@ -20,9 +19,7 @@ public class MediaLibraryService : IMediaLibraryService
/// Gets the service for managing a written content library.
/// </summary>
public IWrittenContentLibraryService WrittenContentLibraryService { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaLibraryService"/> class.
/// </summary>
@@ -33,5 +30,4 @@ public class MediaLibraryService : IMediaLibraryService
VideoLibraryService = videoLibraryService;
WrittenContentLibraryService = writtenContentLibraryService;
}
#endregion
}