mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 02:11:10 +00:00
Replaces MVC with FastEndpoints in Lumina.Presentation.Api
This commit is contained in:
1 parent
b1a20716df
commit
c7b8bc2f1c
519 files changed
+15329
-8539
No files matched your search
@@ -1,8 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
+18
-18
@@ -9,24 +9,24 @@ namespace Lumina.Domain.Common.Errors;
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
public static class FileManagement
|
||||
public static class FileSystemManagement
|
||||
{
|
||||
public static Error ParentNodeCannotBeNull => Error.Failure(nameof(ParentNodeCannotBeNull));
|
||||
public static Error FileCopyError => Error.Failure(nameof(FileCopyError));
|
||||
public static Error FileMoveError => Error.Failure(nameof(FileMoveError));
|
||||
public static Error DirectoryCopyError => Error.Failure(nameof(DirectoryCopyError));
|
||||
public static Error DirectoryMoveError => Error.Failure(nameof(DirectoryMoveError));
|
||||
public static Error FileNotFound => Error.NotFound(nameof(FileNotFound));
|
||||
public static Error InvalidPath => Error.Validation(nameof(InvalidPath));
|
||||
public static Error PathCannotBeEmpty => Error.Validation(nameof(PathCannotBeEmpty));
|
||||
public static Error ExtensionCannotBeEmpty => Error.Validation(nameof(ExtensionCannotBeEmpty));
|
||||
public static Error StreamIdCannotBeEmpty => Error.Validation(nameof(StreamIdCannotBeEmpty));
|
||||
public static Error CodecCannotBeEmpty => Error.Validation(nameof(CodecCannotBeEmpty));
|
||||
public static Error BitrateMustBeAPositiveNumber => Error.Validation(nameof(BitrateMustBeAPositiveNumber));
|
||||
public static Error CannotNavigateUp => Error.Failure(nameof(CannotNavigateUp));
|
||||
public static Error NameCannotBeEmpty => Error.Validation(nameof(NameCannotBeEmpty));
|
||||
public static Error FileAlreadyExists => Error.Conflict(nameof(FileAlreadyExists));
|
||||
public static Error DirectoryNotFound => Error.NotFound(nameof(DirectoryNotFound));
|
||||
public static Error DirectoryAlreadyExists => Error.Conflict(nameof(DirectoryAlreadyExists));
|
||||
public static Error ParentNodeCannotBeNull => Error.Failure(description: nameof(ParentNodeCannotBeNull));
|
||||
public static Error FileCopyError => Error.Failure(description: nameof(FileCopyError));
|
||||
public static Error FileMoveError => Error.Failure(description: nameof(FileMoveError));
|
||||
public static Error DirectoryCopyError => Error.Failure(description: nameof(DirectoryCopyError));
|
||||
public static Error DirectoryMoveError => Error.Failure(description: nameof(DirectoryMoveError));
|
||||
public static Error FileNotFound => Error.NotFound(description: nameof(FileNotFound));
|
||||
public static Error InvalidPath => Error.Validation(description: nameof(InvalidPath));
|
||||
public static Error PathCannotBeEmpty => Error.Validation(description: nameof(PathCannotBeEmpty));
|
||||
public static Error ExtensionCannotBeEmpty => Error.Validation(description: nameof(ExtensionCannotBeEmpty));
|
||||
public static Error StreamIdCannotBeEmpty => Error.Validation(description: nameof(StreamIdCannotBeEmpty));
|
||||
public static Error CodecCannotBeEmpty => Error.Validation(description: nameof(CodecCannotBeEmpty));
|
||||
public static Error BitrateMustBeAPositiveNumber => Error.Validation(description: nameof(BitrateMustBeAPositiveNumber));
|
||||
public static Error CannotNavigateUp => Error.Failure(description: nameof(CannotNavigateUp));
|
||||
public static Error NameCannotBeEmpty => Error.Validation(description: nameof(NameCannotBeEmpty));
|
||||
public static Error FileAlreadyExists => Error.Conflict(description: nameof(FileAlreadyExists));
|
||||
public static Error DirectoryNotFound => Error.NotFound(description: nameof(DirectoryNotFound));
|
||||
public static Error DirectoryAlreadyExists => Error.Conflict(description: nameof(DirectoryAlreadyExists));
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,15 @@ public static partial class Errors
|
||||
{
|
||||
public static class MediaContributor
|
||||
{
|
||||
public static Error ContributorsListCannotBeNull => Error.Validation(nameof(ContributorsListCannotBeNull));
|
||||
public static Error ContributorNameCannotBeEmpty => Error.Validation(nameof(ContributorNameCannotBeEmpty));
|
||||
public static Error ContributorDisplayNameCannotBeEmpty => Error.Validation(nameof(ContributorDisplayNameCannotBeEmpty));
|
||||
public static Error ContributorDisplayNameMustBeMaximum100CharactersLong => Error.Validation(nameof(ContributorDisplayNameMustBeMaximum100CharactersLong));
|
||||
public static Error ContributorLegalNameMustBeMaximum100CharactersLong => Error.Validation(nameof(ContributorLegalNameMustBeMaximum100CharactersLong));
|
||||
public static Error RoleNameCannotBeEmpty => Error.Validation(nameof(RoleNameCannotBeEmpty));
|
||||
public static Error RoleNameMustBeMaximum50CharactersLong => Error.Validation(nameof(RoleNameMustBeMaximum50CharactersLong));
|
||||
public static Error RoleCategoryCannotBeEmpty => Error.Validation(nameof(RoleCategoryCannotBeEmpty));
|
||||
public static Error RoleCategoryMustBeMaximum50CharactersLong => Error.Validation(nameof(RoleCategoryMustBeMaximum50CharactersLong));
|
||||
public static Error ContributorRoleCannotBeNull => Error.Validation(nameof(ContributorRoleCannotBeNull));
|
||||
public static Error ContributorsListCannotBeNull => Error.Validation(description: nameof(ContributorsListCannotBeNull));
|
||||
public static Error ContributorNameCannotBeEmpty => Error.Validation(description: nameof(ContributorNameCannotBeEmpty));
|
||||
public static Error ContributorDisplayNameCannotBeEmpty => Error.Validation(description: nameof(ContributorDisplayNameCannotBeEmpty));
|
||||
public static Error ContributorDisplayNameMustBeMaximum100CharactersLong => Error.Validation(description: nameof(ContributorDisplayNameMustBeMaximum100CharactersLong));
|
||||
public static Error ContributorLegalNameMustBeMaximum100CharactersLong => Error.Validation(description: nameof(ContributorLegalNameMustBeMaximum100CharactersLong));
|
||||
public static Error RoleNameCannotBeEmpty => Error.Validation(description: nameof(RoleNameCannotBeEmpty));
|
||||
public static Error RoleNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(RoleNameMustBeMaximum50CharactersLong));
|
||||
public static Error RoleCategoryCannotBeEmpty => Error.Validation(description: nameof(RoleCategoryCannotBeEmpty));
|
||||
public static Error RoleCategoryMustBeMaximum50CharactersLong => Error.Validation(description: nameof(RoleCategoryMustBeMaximum50CharactersLong));
|
||||
public static Error ContributorRoleCannotBeNull => Error.Validation(description: nameof(ContributorRoleCannotBeNull));
|
||||
}
|
||||
}
|
||||
@@ -11,36 +11,36 @@ public static partial class Errors
|
||||
{
|
||||
public static class Metadata
|
||||
{
|
||||
public static Error MetadataCannotBeNull => Error.Validation(nameof(MetadataCannotBeNull));
|
||||
public static Error TitleCannotBeEmpty => Error.Validation(nameof(TitleCannotBeEmpty));
|
||||
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(nameof(TitleMustBeMaximum255CharactersLong));
|
||||
public static Error OriginalTitleMustBeMaximum255CharactersLong => Error.Validation(nameof(OriginalTitleMustBeMaximum255CharactersLong));
|
||||
public static Error DescriptionMustBeMaximum2000CharactersLong => Error.Validation(nameof(DescriptionMustBeMaximum2000CharactersLong));
|
||||
public static Error GenresListCannotBeNull => Error.Validation(nameof(GenresListCannotBeNull));
|
||||
public static Error GenreNameCannotBeEmpty => Error.Validation(nameof(GenreNameCannotBeEmpty));
|
||||
public static Error GenreNameMustBeMaximum50CharactersLong => Error.Validation(nameof(GenreNameMustBeMaximum50CharactersLong));
|
||||
public static Error TagsListCannotBeNull => Error.Validation(nameof(TagsListCannotBeNull));
|
||||
public static Error TagNameCannotBeEmpty => Error.Validation(nameof(TagNameCannotBeEmpty));
|
||||
public static Error TagNameMustBeMaximum50CharactersLong => Error.Validation(nameof(TagNameMustBeMaximum50CharactersLong));
|
||||
public static Error LanguageCodeCannotBeEmpty => Error.Validation(nameof(LanguageCodeCannotBeEmpty));
|
||||
public static Error LanguageNameCannotBeEmpty => Error.Validation(nameof(LanguageNameCannotBeEmpty));
|
||||
public static Error LanguageCodeMustBe2CharactersLong => Error.Validation(nameof(LanguageCodeMustBe2CharactersLong));
|
||||
public static Error LanguageNameMustBeMaximum50CharactersLong => Error.Validation(nameof(LanguageNameMustBeMaximum50CharactersLong));
|
||||
public static Error LanguageNativeNameMustBeMaximum50CharactersLong => Error.Validation(nameof(LanguageNativeNameMustBeMaximum50CharactersLong));
|
||||
public static Error OriginalReleaseYearMustBeBetween1And9999 => Error.Validation(nameof(OriginalReleaseYearMustBeBetween1And9999));
|
||||
public static Error ReReleaseYearMustBeBetween1And9999 => Error.Validation(nameof(ReReleaseYearMustBeBetween1And9999));
|
||||
public static Error ReReleaseYearCannotBeEarlierThanOriginalReleaseYear => Error.Validation(nameof(ReReleaseYearCannotBeEarlierThanOriginalReleaseYear));
|
||||
public static Error CountryCodeMustBe2CharactersLong => Error.Validation(nameof(CountryCodeMustBe2CharactersLong));
|
||||
public static Error ReleaseVersionMustBeMaximum50CharactersLong => Error.Validation(nameof(ReleaseVersionMustBeMaximum50CharactersLong));
|
||||
public static Error OriginalReleaseDateAndYearMustMatch => Error.Validation(nameof(OriginalReleaseDateAndYearMustMatch));
|
||||
public static Error ReReleaseDateAndYearMustMatch => Error.Validation(nameof(ReReleaseDateAndYearMustMatch));
|
||||
public static Error ReReleaseDateCannotBeEarlierThanOriginalReleaseDate => Error.Validation(nameof(ReReleaseDateCannotBeEarlierThanOriginalReleaseDate));
|
||||
public static Error ReleaseInfoCannotBeNull => Error.Validation(nameof(ReleaseInfoCannotBeNull));
|
||||
public static Error RatingValueMustBePositive => Error.Validation(nameof(RatingValueMustBePositive));
|
||||
public static Error RatingMaxValueMustBePositive => Error.Validation(nameof(RatingMaxValueMustBePositive));
|
||||
public static Error RatingValueCannotBeGreaterThanMaxValue => Error.Validation(nameof(RatingValueCannotBeGreaterThanMaxValue));
|
||||
public static Error RatingVoteCountMustBePositive => Error.Validation(nameof(RatingVoteCountMustBePositive));
|
||||
public static Error RatingsListCannotBeNull => Error.Validation(nameof(RatingsListCannotBeNull));
|
||||
public static Error InvalidIsoCode => Error.Validation(nameof(InvalidIsoCode));
|
||||
public static Error MetadataCannotBeNull => Error.Validation(description: nameof(MetadataCannotBeNull));
|
||||
public static Error TitleCannotBeEmpty => Error.Validation(description: nameof(TitleCannotBeEmpty));
|
||||
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(description: nameof(TitleMustBeMaximum255CharactersLong));
|
||||
public static Error OriginalTitleMustBeMaximum255CharactersLong => Error.Validation(description: nameof(OriginalTitleMustBeMaximum255CharactersLong));
|
||||
public static Error DescriptionMustBeMaximum2000CharactersLong => Error.Validation(description: nameof(DescriptionMustBeMaximum2000CharactersLong));
|
||||
public static Error GenresListCannotBeNull => Error.Validation(description: nameof(GenresListCannotBeNull));
|
||||
public static Error GenreNameCannotBeEmpty => Error.Validation(description: nameof(GenreNameCannotBeEmpty));
|
||||
public static Error GenreNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(GenreNameMustBeMaximum50CharactersLong));
|
||||
public static Error TagsListCannotBeNull => Error.Validation(description: nameof(TagsListCannotBeNull));
|
||||
public static Error TagNameCannotBeEmpty => Error.Validation(description: nameof(TagNameCannotBeEmpty));
|
||||
public static Error TagNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(TagNameMustBeMaximum50CharactersLong));
|
||||
public static Error LanguageCodeCannotBeEmpty => Error.Validation(description: nameof(LanguageCodeCannotBeEmpty));
|
||||
public static Error LanguageNameCannotBeEmpty => Error.Validation(description: nameof(LanguageNameCannotBeEmpty));
|
||||
public static Error LanguageCodeMustBe2CharactersLong => Error.Validation(description: nameof(LanguageCodeMustBe2CharactersLong));
|
||||
public static Error LanguageNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(LanguageNameMustBeMaximum50CharactersLong));
|
||||
public static Error LanguageNativeNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(LanguageNativeNameMustBeMaximum50CharactersLong));
|
||||
public static Error OriginalReleaseYearMustBeBetween1And9999 => Error.Validation(description: nameof(OriginalReleaseYearMustBeBetween1And9999));
|
||||
public static Error ReReleaseYearMustBeBetween1And9999 => Error.Validation(description: nameof(ReReleaseYearMustBeBetween1And9999));
|
||||
public static Error ReReleaseYearCannotBeEarlierThanOriginalReleaseYear => Error.Validation(description: nameof(ReReleaseYearCannotBeEarlierThanOriginalReleaseYear));
|
||||
public static Error CountryCodeMustBe2CharactersLong => Error.Validation(description: nameof(CountryCodeMustBe2CharactersLong));
|
||||
public static Error ReleaseVersionMustBeMaximum50CharactersLong => Error.Validation(description: nameof(ReleaseVersionMustBeMaximum50CharactersLong));
|
||||
public static Error OriginalReleaseDateAndYearMustMatch => Error.Validation(description: nameof(OriginalReleaseDateAndYearMustMatch));
|
||||
public static Error ReReleaseDateAndYearMustMatch => Error.Validation(description: nameof(ReReleaseDateAndYearMustMatch));
|
||||
public static Error ReReleaseDateCannotBeEarlierThanOriginalReleaseDate => Error.Validation(description: nameof(ReReleaseDateCannotBeEarlierThanOriginalReleaseDate));
|
||||
public static Error ReleaseInfoCannotBeNull => Error.Validation(description: nameof(ReleaseInfoCannotBeNull));
|
||||
public static Error RatingValueMustBePositive => Error.Validation(description: nameof(RatingValueMustBePositive));
|
||||
public static Error RatingMaxValueMustBePositive => Error.Validation(description: nameof(RatingMaxValueMustBePositive));
|
||||
public static Error RatingValueCannotBeGreaterThanMaxValue => Error.Validation(description: nameof(RatingValueCannotBeGreaterThanMaxValue));
|
||||
public static Error RatingVoteCountMustBePositive => Error.Validation(description: nameof(RatingVoteCountMustBePositive));
|
||||
public static Error RatingsListCannotBeNull => Error.Validation(description: nameof(RatingsListCannotBeNull));
|
||||
public static Error InvalidIsoCode => Error.Validation(description: nameof(InvalidIsoCode));
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,6 @@ public static partial class Errors
|
||||
{
|
||||
public static class Permission
|
||||
{
|
||||
public static Error UnauthorizedAccess => Error.Failure(nameof(UnauthorizedAccess));
|
||||
public static Error UnauthorizedAccess => Error.Failure(description: nameof(UnauthorizedAccess));
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public static partial class Errors
|
||||
{
|
||||
public static class Thumbnails
|
||||
{
|
||||
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
|
||||
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
|
||||
public static Error NoThumbnail => Error.Failure(description: nameof(NoThumbnail));
|
||||
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
|
||||
}
|
||||
}
|
||||
@@ -11,29 +11,29 @@ public static partial class Errors
|
||||
{
|
||||
public static class WrittenContent
|
||||
{
|
||||
public static Error BookAlreadyExists => Error.Conflict(nameof(BookAlreadyExists));
|
||||
public static Error IsbnValueCannotBeEmpty => Error.Validation(nameof(IsbnValueCannotBeEmpty));
|
||||
public static Error IsbnListCannotBeNull => Error.Validation(nameof(IsbnListCannotBeNull));
|
||||
public static Error InvalidIsbn10Format => Error.Validation(nameof(InvalidIsbn10Format));
|
||||
public static Error InvalidIsbn13Format => Error.Validation(nameof(InvalidIsbn13Format));
|
||||
public static Error UnknownIsbnFormat => Error.Unexpected(nameof(UnknownIsbnFormat));
|
||||
public static Error TheBookIsAlreadyInTheSeries => Error.Forbidden(nameof(TheBookIsAlreadyInTheSeries));
|
||||
public static Error TheBookIsNotInTheSeries => Error.Forbidden(nameof(TheBookIsNotInTheSeries));
|
||||
public static Error AsinMustBe10CharactersLong => Error.Validation(nameof(AsinMustBe10CharactersLong));
|
||||
public static Error GoodreadsIdMustBeNumeric => Error.Validation(nameof(GoodreadsIdMustBeNumeric));
|
||||
public static Error InvalidLccnFormat => Error.Validation(nameof(InvalidLccnFormat));
|
||||
public static Error InvalidOclcFormat => Error.Validation(nameof(InvalidOclcFormat));
|
||||
public static Error InvalidOpenLibraryId => Error.Validation(nameof(InvalidOpenLibraryId));
|
||||
public static Error LibraryThingIdMustBeMaximum50CharactersLong => Error.Validation(nameof(LibraryThingIdMustBeMaximum50CharactersLong));
|
||||
public static Error GoogleBooksIdMustBe12CharactersLong => Error.Validation(nameof(GoogleBooksIdMustBe12CharactersLong));
|
||||
public static Error InvalidGoogleBooksIdFormat => Error.Validation(nameof(InvalidGoogleBooksIdFormat));
|
||||
public static Error BarnesAndNoblesIdMustBe10CharactersLong => Error.Validation(nameof(BarnesAndNoblesIdMustBe10CharactersLong));
|
||||
public static Error InvalidBarnesAndNoblesIdFormat => Error.Validation(nameof(InvalidBarnesAndNoblesIdFormat));
|
||||
public static Error InvalidAppleBooksIdFormat => Error.Validation(nameof(InvalidAppleBooksIdFormat));
|
||||
public static Error PublisherMustBeMaximum100CharactersLong => Error.Validation(nameof(PublisherMustBeMaximum100CharactersLong));
|
||||
public static Error PageCountMustBeGreaterThanZero => Error.Validation(nameof(PageCountMustBeGreaterThanZero));
|
||||
public static Error UnknownBookFormat => Error.Validation(nameof(UnknownBookFormat));
|
||||
public static Error EditionMustBeMaximum50CharactersLong => Error.Validation(nameof(EditionMustBeMaximum50CharactersLong));
|
||||
public static Error VolumeNumberMustBeGreaterThanZero => Error.Validation(nameof(VolumeNumberMustBeGreaterThanZero));
|
||||
public static Error BookAlreadyExists => Error.Conflict(description: nameof(BookAlreadyExists));
|
||||
public static Error IsbnValueCannotBeEmpty => Error.Validation(description: nameof(IsbnValueCannotBeEmpty));
|
||||
public static Error IsbnListCannotBeNull => Error.Validation(description: nameof(IsbnListCannotBeNull));
|
||||
public static Error InvalidIsbn10Format => Error.Validation(description: nameof(InvalidIsbn10Format));
|
||||
public static Error InvalidIsbn13Format => Error.Validation(description: nameof(InvalidIsbn13Format));
|
||||
public static Error UnknownIsbnFormat => Error.Unexpected(description: nameof(UnknownIsbnFormat));
|
||||
public static Error TheBookIsAlreadyInTheSeries => Error.Forbidden(description: nameof(TheBookIsAlreadyInTheSeries));
|
||||
public static Error TheBookIsNotInTheSeries => Error.Forbidden(description: nameof(TheBookIsNotInTheSeries));
|
||||
public static Error AsinMustBe10CharactersLong => Error.Validation(description: nameof(AsinMustBe10CharactersLong));
|
||||
public static Error GoodreadsIdMustBeNumeric => Error.Validation(description: nameof(GoodreadsIdMustBeNumeric));
|
||||
public static Error InvalidLccnFormat => Error.Validation(description: nameof(InvalidLccnFormat));
|
||||
public static Error InvalidOclcFormat => Error.Validation(description: nameof(InvalidOclcFormat));
|
||||
public static Error InvalidOpenLibraryId => Error.Validation(description: nameof(InvalidOpenLibraryId));
|
||||
public static Error LibraryThingIdMustBeMaximum50CharactersLong => Error.Validation(description: nameof(LibraryThingIdMustBeMaximum50CharactersLong));
|
||||
public static Error GoogleBooksIdMustBe12CharactersLong => Error.Validation(description: nameof(GoogleBooksIdMustBe12CharactersLong));
|
||||
public static Error InvalidGoogleBooksIdFormat => Error.Validation(description: nameof(InvalidGoogleBooksIdFormat));
|
||||
public static Error BarnesAndNoblesIdMustBe10CharactersLong => Error.Validation(description: nameof(BarnesAndNoblesIdMustBe10CharactersLong));
|
||||
public static Error InvalidBarnesAndNoblesIdFormat => Error.Validation(description: nameof(InvalidBarnesAndNoblesIdFormat));
|
||||
public static Error InvalidAppleBooksIdFormat => Error.Validation(description: nameof(InvalidAppleBooksIdFormat));
|
||||
public static Error PublisherMustBeMaximum100CharactersLong => Error.Validation(description: nameof(PublisherMustBeMaximum100CharactersLong));
|
||||
public static Error PageCountMustBeGreaterThanZero => Error.Validation(description: nameof(PageCountMustBeGreaterThanZero));
|
||||
public static Error UnknownBookFormat => Error.Validation(description: nameof(UnknownBookFormat));
|
||||
public static Error EditionMustBeMaximum50CharactersLong => Error.Validation(description: nameof(EditionMustBeMaximum50CharactersLong));
|
||||
public static Error VolumeNumberMustBeGreaterThanZero => Error.Validation(description: nameof(VolumeNumberMustBeGreaterThanZero));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Domain.Common.Models.Core;
|
||||
namespace Lumina.Domain.Common.Models.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all domain Aggregate Roots.
|
||||
@@ -15,7 +15,6 @@ public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
|
||||
Id = id;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
|
||||
/// </summary>
|
||||
@@ -23,5 +22,4 @@ public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
|
||||
{
|
||||
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,12 @@ public abstract class BaseMetadata : ValueObject
|
||||
public string Title { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original title of the media item.
|
||||
/// Gets the original title of the media item, if applicable.
|
||||
/// </summary>
|
||||
public Optional<string> OriginalTitle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional description of the media item.
|
||||
/// Gets the optional description of the media item, if applicable.
|
||||
/// </summary>
|
||||
public Optional<string> Description { get; private set; }
|
||||
|
||||
@@ -38,12 +38,12 @@ public abstract class BaseMetadata : ValueObject
|
||||
public ReleaseInfo ReleaseInfo { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional language of the media item.
|
||||
/// Gets the optional language of the media item, if applicable.
|
||||
/// </summary>
|
||||
public Optional<LanguageInfo> Language { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original language of the media item.
|
||||
/// Gets the optional original language of the media item, if applicable.
|
||||
/// </summary>
|
||||
public Optional<LanguageInfo> OriginalLanguage { get; private set; }
|
||||
|
||||
@@ -61,13 +61,13 @@ public abstract class BaseMetadata : ValueObject
|
||||
/// Initializes a new instance of the <see cref="BaseMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="originalTitle">The optional original title of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="description">The optional description of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="originalTitle">The optional original title of the element to which this metadata object belongs to, if applicable.</param>
|
||||
/// <param name="description">The optional description of the element to which this metadata object belongs to, if applicable.</param>
|
||||
/// <param name="releaseInfo">The optional release information of the media item.</param>
|
||||
/// <param name="genres">The list of genres of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="tags">The list of tags of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="language">The optional language of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the element to which this metadata object belongs to.</param>
|
||||
/// <param name="language">The optional language of the element to which this metadata object belongs to, if applicable.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the element to which this metadata object belongs to, if applicable.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the <see cref="title"/> value is <see langword="null"/></exception>
|
||||
protected BaseMetadata(
|
||||
string title,
|
||||
@@ -103,4 +103,4 @@ public abstract class BaseMetadata : ValueObject
|
||||
yield return Language;
|
||||
yield return OriginalLanguage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class Genre : ValueObject
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="Genre"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<Genre> Create(string name)
|
||||
public static ErrorOr<Genre> Create(string? name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return Errors.Errors.Metadata.GenreNameCannotBeEmpty;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class LanguageInfo : ValueObject
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="LanguageInfo"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<LanguageInfo> Create(string languageCode, string languageName, Optional<string> nativeName)
|
||||
public static ErrorOr<LanguageInfo> Create(string? languageCode, string? languageName, Optional<string> nativeName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(languageCode))
|
||||
return Errors.Errors.Metadata.LanguageCodeCannotBeEmpty;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Tag : ValueObject
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="Tag"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<Tag> Create(string name)
|
||||
public static ErrorOr<Tag> Create(string? name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return Errors.Errors.Metadata.TagNameCannotBeEmpty;
|
||||
|
||||
+3
-2
@@ -2,13 +2,14 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system directory.
|
||||
+4
-3
@@ -3,12 +3,13 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system file.
|
||||
@@ -144,7 +145,7 @@ public sealed class File : FileSystemItem
|
||||
public ErrorOr<Updated> Rename(string newName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(newName))
|
||||
return Errors.FileManagement.NameCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.NameCannotBeEmpty;
|
||||
Name = newName;
|
||||
return Result.Updated;
|
||||
}
|
||||
+4
-7
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system root item on Unix platforms.
|
||||
@@ -38,15 +38,12 @@ public sealed class UnixRootItem : FileSystemItem
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="UnixRootItem"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<UnixRootItem> Create(
|
||||
FileSystemItemStatus status = FileSystemItemStatus.Accessible)
|
||||
public static ErrorOr<UnixRootItem> Create(FileSystemItemStatus status = FileSystemItemStatus.Accessible)
|
||||
{
|
||||
ErrorOr<FileSystemPathId> createPathResult = FileSystemPathId.Create(PATH);
|
||||
if (createPathResult.IsError)
|
||||
return createPathResult.Errors;
|
||||
UnixRootItem newRoot = new(
|
||||
createPathResult.Value,
|
||||
PATH);
|
||||
UnixRootItem newRoot = new(createPathResult.Value, PATH);
|
||||
ErrorOr<Updated> setStatusResult = newRoot.SetStatus(status);
|
||||
if (setStatusResult.IsError)
|
||||
return setStatusResult.Errors;
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a file system root item on Windows platforms.
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing a generic file system element.
|
||||
@@ -69,7 +69,7 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
|
||||
if (parent is not null)
|
||||
Parent = parent;
|
||||
else
|
||||
return Errors.FileManagement.ParentNodeCannotBeNull;
|
||||
return Errors.FileSystemManagement.ParentNodeCannotBeNull;
|
||||
return Result.Updated;
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-9
@@ -3,7 +3,7 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -11,7 +11,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Directory provider for local file systems.
|
||||
@@ -146,7 +146,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
{
|
||||
// check if the source directory exists
|
||||
if (!_fileSystem.Directory.Exists(sourcePath.Path))
|
||||
return Errors.FileManagement.DirectoryNotFound;
|
||||
return Errors.FileSystemManagement.DirectoryNotFound;
|
||||
string destPath = CreateUniqueDirectoryPath(destinationPath.Path);
|
||||
try
|
||||
{
|
||||
@@ -179,7 +179,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Errors.FileManagement.DirectoryCopyError;
|
||||
return Errors.FileSystemManagement.DirectoryCopyError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
{
|
||||
// check if the source directory exists
|
||||
if (!_fileSystem.Directory.Exists(sourcePath.Path))
|
||||
return Errors.FileManagement.DirectoryNotFound;
|
||||
return Errors.FileSystemManagement.DirectoryNotFound;
|
||||
try
|
||||
{
|
||||
// if the destination directory does not exist, perform a simple move
|
||||
@@ -221,7 +221,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Errors.FileManagement.DirectoryMoveError;
|
||||
return Errors.FileSystemManagement.DirectoryMoveError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,6 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
_fileSystem.File.Delete(destFilePath);
|
||||
_fileSystem.File.Move(sourceFilePath, destFilePath);
|
||||
}
|
||||
// otherwise, skip the file
|
||||
}
|
||||
else
|
||||
_fileSystem.File.Move(sourceFilePath, destFilePath); // move the file if it does not exist in the destination directory
|
||||
@@ -298,10 +297,10 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
return newDirectoryPathResult.Value;
|
||||
}
|
||||
else
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
}
|
||||
else
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
+9
-9
@@ -3,15 +3,15 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling directories.
|
||||
@@ -131,7 +131,7 @@ public class DirectoryService : IDirectoryService
|
||||
if (directoryExists.IsError)
|
||||
return directoryExists.Errors;
|
||||
else if (directoryExists.Value == true)
|
||||
return Errors.FileManagement.DirectoryAlreadyExists;
|
||||
return Errors.FileSystemManagement.DirectoryAlreadyExists;
|
||||
else
|
||||
{
|
||||
// create the new directory
|
||||
@@ -195,7 +195,7 @@ public class DirectoryService : IDirectoryService
|
||||
if (directoryExists.IsError)
|
||||
return directoryExists.Errors;
|
||||
else if (directoryExists.Value == false)
|
||||
return Errors.FileManagement.DirectoryNotFound;
|
||||
return Errors.FileSystemManagement.DirectoryNotFound;
|
||||
else
|
||||
{
|
||||
// copy the directory
|
||||
@@ -241,7 +241,7 @@ public class DirectoryService : IDirectoryService
|
||||
if (directoryExists.IsError)
|
||||
return directoryExists.Errors;
|
||||
else if (directoryExists.Value == false)
|
||||
return Errors.FileManagement.DirectoryNotFound;
|
||||
return Errors.FileSystemManagement.DirectoryNotFound;
|
||||
else
|
||||
{
|
||||
// move the directory
|
||||
@@ -281,7 +281,7 @@ public class DirectoryService : IDirectoryService
|
||||
if (directoryExists.IsError)
|
||||
return directoryExists.Errors;
|
||||
else if (directoryExists.Value == true)
|
||||
return Errors.FileManagement.DirectoryAlreadyExists;
|
||||
return Errors.FileSystemManagement.DirectoryAlreadyExists;
|
||||
else
|
||||
{
|
||||
// rename the directory
|
||||
+4
-3
@@ -1,14 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling drives.
|
||||
+13
-17
@@ -3,7 +3,7 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -11,7 +11,7 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// File provider for local file systems.
|
||||
@@ -153,19 +153,17 @@ internal class FileProviderService : IFileProviderService
|
||||
{
|
||||
// check if the source file exists
|
||||
if (!_fileSystem.File.Exists(sourceFilePath.Path))
|
||||
return Errors.FileManagement.FileNotFound;
|
||||
return Errors.FileSystemManagement.FileNotFound;
|
||||
string fileName = _fileSystem.Path.GetFileName(sourceFilePath.Path);
|
||||
string destinationFilePath = _fileSystem.Path.Combine(destinationDirectoryPath.Path, fileName);
|
||||
// when copying a file to the same location, just copy it with a new name
|
||||
if (_fileSystem.Path.GetDirectoryName(sourceFilePath.Path) == destinationDirectoryPath.Path)
|
||||
destinationFilePath = CreateUniqueFilePath(destinationFilePath);
|
||||
else
|
||||
{
|
||||
// check if there is already a file with the same name as the copied file, in the destination directory
|
||||
if (_fileSystem.File.Exists(destinationFilePath))
|
||||
if (!overrideExisting)
|
||||
return Errors.FileManagement.FileAlreadyExists;
|
||||
}
|
||||
if (!overrideExisting)
|
||||
return Errors.FileSystemManagement.FileAlreadyExists;
|
||||
try
|
||||
{
|
||||
_fileSystem.File.Copy(sourceFilePath.Path, destinationFilePath, overrideExisting); // copy the file
|
||||
@@ -174,7 +172,7 @@ internal class FileProviderService : IFileProviderService
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Errors.FileManagement.FileCopyError;
|
||||
return Errors.FileSystemManagement.FileCopyError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +206,7 @@ internal class FileProviderService : IFileProviderService
|
||||
{
|
||||
// check if the source file exists
|
||||
if (!_fileSystem.File.Exists(sourceFilePath.Path))
|
||||
return Errors.FileManagement.FileNotFound;
|
||||
return Errors.FileSystemManagement.FileNotFound;
|
||||
try
|
||||
{
|
||||
string fileName = _fileSystem.Path.GetFileName(sourceFilePath.Path);
|
||||
@@ -217,17 +215,15 @@ internal class FileProviderService : IFileProviderService
|
||||
if (!_fileSystem.File.Exists(destinationFilePath))
|
||||
_fileSystem.File.Move(sourceFilePath.Path, destinationFilePath);
|
||||
else
|
||||
{
|
||||
if (overrideExisting)
|
||||
_fileSystem.File.Move(sourceFilePath.Path, destinationFilePath, overrideExisting);
|
||||
else
|
||||
return Errors.FileManagement.FileAlreadyExists;
|
||||
}
|
||||
_fileSystem.File.Move(sourceFilePath.Path, destinationFilePath, overrideExisting);
|
||||
else
|
||||
return Errors.FileSystemManagement.FileAlreadyExists;
|
||||
return FileSystemPathId.Create(destinationFilePath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Errors.FileManagement.FileMoveError;
|
||||
return Errors.FileSystemManagement.FileMoveError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,10 +256,10 @@ internal class FileProviderService : IFileProviderService
|
||||
return newFilePathResult;
|
||||
}
|
||||
else
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
}
|
||||
else
|
||||
return Errors.FileManagement.CannotNavigateUp;
|
||||
return Errors.FileSystemManagement.CannotNavigateUp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
+10
-10
@@ -3,15 +3,15 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling file system files.
|
||||
@@ -113,7 +113,7 @@ public class FileService : IFileService
|
||||
public ErrorOr<File> CopyFile(string sourceFilePath, string destinationDirectoryPath, bool? overrideExisting)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(destinationDirectoryPath))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// make sure the paths are in the expected format
|
||||
if (!destinationDirectoryPath.EndsWith(_platformContext.PathStrategy.PathSeparator))
|
||||
destinationDirectoryPath += _platformContext.PathStrategy.PathSeparator;
|
||||
@@ -139,7 +139,7 @@ public class FileService : IFileService
|
||||
if (fileExists.IsError)
|
||||
return fileExists.Errors;
|
||||
else if (fileExists.Value == false)
|
||||
return Errors.FileManagement.FileNotFound;
|
||||
return Errors.FileSystemManagement.FileNotFound;
|
||||
else
|
||||
{
|
||||
// copy the file
|
||||
@@ -179,7 +179,7 @@ public class FileService : IFileService
|
||||
public ErrorOr<File> MoveFile(string sourceFilePath, string destinationDirectoryPath, bool? overrideExisting)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(destinationDirectoryPath))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// make sure the paths are in the expected format
|
||||
if (!destinationDirectoryPath.EndsWith(_platformContext.PathStrategy.PathSeparator))
|
||||
destinationDirectoryPath += _platformContext.PathStrategy.PathSeparator;
|
||||
@@ -205,7 +205,7 @@ public class FileService : IFileService
|
||||
if (fileExists.IsError)
|
||||
return fileExists.Errors;
|
||||
else if (fileExists.Value == false)
|
||||
return Errors.FileManagement.FileNotFound;
|
||||
return Errors.FileSystemManagement.FileNotFound;
|
||||
else
|
||||
{
|
||||
// move the file
|
||||
@@ -265,7 +265,7 @@ public class FileService : IFileService
|
||||
if (fileExists.IsError)
|
||||
return fileExists.Errors;
|
||||
else if (fileExists.Value == true)
|
||||
return Errors.FileManagement.FileAlreadyExists;
|
||||
return Errors.FileSystemManagement.FileAlreadyExists;
|
||||
else
|
||||
{
|
||||
// rename the file
|
||||
+19
-27
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
using System;
|
||||
@@ -11,7 +11,7 @@ using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for file system permissions.
|
||||
@@ -129,31 +129,27 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
return HasAccess(FileSystemRights.Modify, parentDirectory, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HasAccess(rights, path, isFile))
|
||||
try
|
||||
{
|
||||
try
|
||||
switch (accessMode)
|
||||
{
|
||||
switch (accessMode)
|
||||
{
|
||||
case FileAccessMode.ReadProperties:
|
||||
// just accessing file info for properties, without opening it
|
||||
FileSystemInfo fileSystemInfo = isFile ? new FileInfo(path) : new DirectoryInfo(path);
|
||||
_ = fileSystemInfo.CreationTime; // trigger potential access denial
|
||||
break;
|
||||
case FileAccessMode.ReadContents:
|
||||
using (FileStream stream = new(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
stream.Close();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
case FileAccessMode.ReadProperties:
|
||||
// just accessing file info for properties, without opening it
|
||||
FileSystemInfo fileSystemInfo = isFile ? new FileInfo(path) : new DirectoryInfo(path);
|
||||
_ = fileSystemInfo.CreationTime; // trigger potential access denial
|
||||
break;
|
||||
case FileAccessMode.ReadContents:
|
||||
using (FileStream stream = new(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
stream.Close();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -186,16 +182,12 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
acl = directoryInfo.GetAccessControl().GetAccessRules(true, true, typeof(SecurityIdentifier));
|
||||
}
|
||||
foreach (FileSystemAccessRule accessRule in acl)
|
||||
{
|
||||
// Check if the current rule applies to the current user or the groups they belong to
|
||||
if (identity?.User?.Equals(accessRule.IdentityReference) == true || principal.IsInRole((SecurityIdentifier)accessRule.IdentityReference))
|
||||
{
|
||||
if (accessRule.AccessControlType.Equals(AccessControlType.Deny) && (accessRule.FileSystemRights & rights) == rights)
|
||||
return false; // if there's a deny rule that matches the specified rights, return false immediately
|
||||
else if (accessRule.AccessControlType.Equals(AccessControlType.Allow) && (accessRule.FileSystemRights & rights) == rights)
|
||||
allowAccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
+3
-3
@@ -3,8 +3,8 @@ using ErrorOr;
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
@@ -13,7 +13,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Class defining methods for handling file-related operations.
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining the directory provider service.
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the service for handling directories.
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the service for handling drives.
|
||||
@@ -15,4 +16,4 @@ public interface IDriveService
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of drives or an error.</returns>
|
||||
ErrorOr<IEnumerable<FileSystemItem>> GetDrives();
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining the file provider service.
|
||||
@@ -95,4 +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);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the service for handling file system files.
|
||||
@@ -68,4 +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);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for file system permission service.
|
||||
@@ -18,4 +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);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Entities;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining methods for handling file-related operations based on different sources.
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the service for handling file system paths.
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the service for handling thumbnails.
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service defining methods for handling path-related operations.
|
||||
@@ -65,7 +65,7 @@ public class PathService : IPathService
|
||||
public ErrorOr<string> CombinePath(string path, string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || string.IsNullOrWhiteSpace(name))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
ErrorOr<FileSystemPathId> newPathResult = FileSystemPathId.Create(path);
|
||||
if (newPathResult.IsError)
|
||||
return newPathResult.Errors;
|
||||
+3
-3
@@ -2,8 +2,8 @@
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.Formats.Png;
|
||||
@@ -14,7 +14,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for handling thumbnails.
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the context for environment-specific operations and services.
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Services;
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Services;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Environment;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Environment;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for defining the contract of an environment-specific context, encapsulating all platform-specific services and strategies.
|
||||
@@ -23,4 +23,4 @@ public interface IEnvironmentContext
|
||||
/// Gets the service for providing file system directories.
|
||||
/// </summary>
|
||||
IDirectoryProviderService DirectoryProviderService { get; }
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining methods for handling path-related operations based on different platforms.
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining methods for handling path-related operations on UNIX platforms.
|
||||
/// </summary>
|
||||
public interface IUnixPathStrategy : IPathStrategy
|
||||
{
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining methods for handling path-related operations on Windows platforms.
|
||||
/// </summary>
|
||||
public interface IWindowsPathStrategy : IPathStrategy
|
||||
{
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -10,7 +10,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Service defining methods for handling path-related operations on UNIX platforms.
|
||||
@@ -83,7 +83,7 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
public ErrorOr<FileSystemPathId> CombinePath(FileSystemPathId path, string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return Errors.FileManagement.NameCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.NameCannotBeEmpty;
|
||||
// trim any directory separator characters from the end of the path
|
||||
string subpath = path.Path.TrimEnd(PathSeparator);
|
||||
// if the name begins with a directory separator, remove it
|
||||
@@ -101,7 +101,7 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
{
|
||||
// if path starts with anything other than '/', it's considered relative and invalid for this parser
|
||||
if (!path.Path.StartsWith(PathSeparator))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// get the path segments
|
||||
List<string> splitSegments = [.. path.Path.Split(new[] { PathSeparator }, StringSplitOptions.RemoveEmptyEntries)];
|
||||
IEnumerable<ErrorOr<PathSegment>> segmentsResults = splitSegments.Select((segment, index) =>
|
||||
@@ -128,7 +128,7 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
{
|
||||
// validation: ensure the path is not null or empty
|
||||
if (!IsValidPath(path))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// trim trailing slash for consistent processing
|
||||
string tempPath = path.Path;
|
||||
if (tempPath.EndsWith('/'))
|
||||
@@ -137,7 +137,7 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
int lastIndex = tempPath.LastIndexOf(PathSeparator);
|
||||
// if there's no slash found (shouldn't happen due to previous steps), or if we are at the root level after trimming, return error
|
||||
if (lastIndex < 0)
|
||||
return Errors.FileManagement.CannotNavigateUp;
|
||||
return Errors.FileSystemManagement.CannotNavigateUp;
|
||||
// return the path up to the last slash, or, if there's only the root slash, return that one instead
|
||||
ErrorOr<FileSystemPathId> newPathResult = FileSystemPathId.Create(lastIndex > 0 ? tempPath[..lastIndex] : tempPath[..1]);
|
||||
if (newPathResult.IsError)
|
||||
@@ -162,11 +162,11 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
public ErrorOr<PathSegment> GetPathRoot(FileSystemPathId path)
|
||||
{
|
||||
if (!IsValidPath(path))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
|
||||
// On Unix-like systems, the root is always "/"
|
||||
if (path.Path.StartsWith(PathSeparator))
|
||||
return PathSegment.Create(PathSeparator.ToString(), isDirectory: false, isDrive: true);
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
}
|
||||
}
|
||||
+16
-18
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -10,7 +10,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Service defining methods for handling path-related operations on Windows platforms.
|
||||
@@ -82,7 +82,7 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
public ErrorOr<FileSystemPathId> CombinePath(FileSystemPathId path, string name)
|
||||
{
|
||||
if (name == null)
|
||||
return Errors.FileManagement.NameCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.NameCannotBeEmpty;
|
||||
// trim any directory separator characters from the end of the path
|
||||
string subpath = path.Path.TrimEnd(PathSeparator);
|
||||
// if the name begins with a directory separator, remove it
|
||||
@@ -100,7 +100,7 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
{
|
||||
// Windows paths usually start with a drive letter and colon, e.g., "C:", or "\\" (UNC paths)
|
||||
if (!(path.Path.StartsWith(@"\\") || (path.Path.Length >= 3 && char.IsLetter(path.Path[0]) && path.Path[1] == ':' && path.Path[2] == PathSeparator)))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
IEnumerable<ErrorOr<PathSegment>> getPathSegmentsResults = GetPathSegments();
|
||||
foreach (ErrorOr<PathSegment> getPathSegmentsResult in getPathSegmentsResults)
|
||||
if (getPathSegmentsResult.IsError)
|
||||
@@ -153,7 +153,7 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
{
|
||||
// validation: ensure the path is not null or empty
|
||||
if (!IsValidPath(path))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// trim trailing backslash for consistent processing
|
||||
string tempPath = path.Path.TrimEnd(PathSeparator);
|
||||
// check for UNC path
|
||||
@@ -161,13 +161,13 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
{
|
||||
string[] parts = tempPath.Split(PathSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length <= 2)
|
||||
return Errors.FileManagement.CannotNavigateUp;
|
||||
return Errors.FileSystemManagement.CannotNavigateUp;
|
||||
// if it's a single-level UNC path, return the UNC root
|
||||
if (parts.Length == 3)
|
||||
return ParsePath(FileSystemPathId.Create($@"\\{parts[0]}\{parts[1]}").Value);
|
||||
} // check for drive root (both with and without trailing backslash)
|
||||
else if ((tempPath.Length == 2 && tempPath[1] == ':') || (tempPath.Length == 3 && tempPath[1] == ':' && tempPath[2] == PathSeparator))
|
||||
return Errors.FileManagement.CannotNavigateUp;
|
||||
return Errors.FileSystemManagement.CannotNavigateUp;
|
||||
// find the last occurrence of a backslash
|
||||
int lastIndex = tempPath.LastIndexOf(PathSeparator);
|
||||
// if there's no backslash found or it's at the root level, return the root
|
||||
@@ -198,14 +198,14 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
public ErrorOr<PathSegment> GetPathRoot(FileSystemPathId path)
|
||||
{
|
||||
if (!IsValidPath(path))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
// handle UNC paths (e.g., \\server\share\folder)
|
||||
if (path.Path.StartsWith(@"\\"))
|
||||
{
|
||||
// find the position of the second backslash (after \\server)
|
||||
int secondBackslash = path.Path.IndexOf('\\', 2);
|
||||
if (secondBackslash == -1)
|
||||
return Errors.FileManagement.InvalidPath; // invalid UNC path, missing server name
|
||||
return Errors.FileSystemManagement.InvalidPath; // invalid UNC path, missing server name
|
||||
// find the position of the third backslash (after \\server\share)
|
||||
int thirdBackslash = path.Path.IndexOf('\\', secondBackslash + 1);
|
||||
if (thirdBackslash == -1)
|
||||
@@ -214,15 +214,13 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
return PathSegment.Create(path.Path[..thirdBackslash] + "\\", isDirectory: true, isDrive: false);
|
||||
}
|
||||
else // handle drive letter paths (e.g., C:\folder)
|
||||
{
|
||||
// check if the path starts with a drive letter followed by a colon (e.g., C:)
|
||||
// path.Path.Length >= 2: Ensure the path is at least 2 characters long
|
||||
// char.IsLetter(path.Path[0]): First character should be a letter
|
||||
// path.Path[1] == ':': Second character should be a colon
|
||||
if (path.Path.Length >= 2 && char.IsLetter(path.Path[0]) && path.Path[1] == ':')
|
||||
return PathSegment.Create(path.Path[..2] + "\\", isDirectory: true, isDrive: true); // return the drive root (e.g., C:\)
|
||||
}
|
||||
// check if the path starts with a drive letter followed by a colon (e.g., C:)
|
||||
// path.Path.Length >= 2: Ensure the path is at least 2 characters long
|
||||
// char.IsLetter(path.Path[0]): First character should be a letter
|
||||
// path.Path[1] == ':': Second character should be a colon
|
||||
if (path.Path.Length >= 2 && char.IsLetter(path.Path[0]) && path.Path[1] == ':')
|
||||
return PathSegment.Create(path.Path[..2] + "\\", isDirectory: true, isDrive: true); // return the drive root (e.g., C:\)
|
||||
// if we reach here, the path is neither a valid UNC path nor a valid drive path
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for checking the type of the current Operating System platform.
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for defining the contract of a platform-specific context.
|
||||
@@ -19,4 +19,4 @@ public interface IPlatformContext
|
||||
/// Gets the path strategy for the current platform context.
|
||||
/// </summary>
|
||||
IPathStrategy PathStrategy { get; }
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining an factory for creating platform contexts.
|
||||
@@ -11,4 +11,4 @@ public interface IPlatformContextFactory
|
||||
/// <typeparam name="TIPlatformContext">The type of platform context to create.</typeparam>
|
||||
/// <returns>The created platform context.</returns>
|
||||
TIPlatformContext CreateStrategy<TIPlatformContext>() where TIPlatformContext : IPlatformContext;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for managing the platform context.
|
||||
@@ -22,4 +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);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining the platform context for UNIX platforms.
|
||||
/// </summary>
|
||||
public interface IUnixPlatformContext : IPlatformContext
|
||||
{
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Interface defining the platform context for Windows platforms.
|
||||
/// </summary>
|
||||
internal interface IWindowsPlatformContext : IPlatformContext
|
||||
{
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Class for checking the type of the current Operating System platform.
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a factory for creating platform contexts.
|
||||
@@ -30,4 +30,4 @@ public class PlatformContextFactory : IPlatformContextFactory
|
||||
{
|
||||
return _serviceProvider.GetRequiredService<TPlatformContext>() ?? throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -4,7 +4,7 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Service for managing the platform context.
|
||||
@@ -34,12 +34,10 @@ public class PlatformContextManager : IPlatformContextManager
|
||||
{
|
||||
// set a default context if none is set
|
||||
if (_currentPlatformContext is null)
|
||||
{
|
||||
if (_operatingSystemInfo.IsOSPlatform(OSPlatform.Linux))
|
||||
SetCurrentPlatform(PlatformType.Unix);
|
||||
else
|
||||
SetCurrentPlatform(PlatformType.Windows);
|
||||
}
|
||||
return _currentPlatformContext!;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Platform context for UNIX platforms.
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.FileSystem;
|
||||
using Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Path;
|
||||
using Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Path;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.Strategies.Platform;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.Strategies.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Platform context for Windows platforms.
|
||||
+2
-2
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Value Object uniquely identifying file system items.
|
||||
@@ -44,7 +44,7 @@ public sealed class FileSystemPathId : ValueObject
|
||||
public static ErrorOr<FileSystemPathId> Create(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return Errors.FileManagement.InvalidPath;
|
||||
return Errors.FileSystemManagement.InvalidPath;
|
||||
return new FileSystemPathId(path);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Value object uniquely identifying path segments.
|
||||
@@ -54,7 +54,7 @@ public class PathSegment : ValueObject
|
||||
public static ErrorOr<PathSegment> Create(string name, bool isDirectory, bool isDrive)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return Errors.FileManagement.NameCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.NameCannotBeEmpty;
|
||||
return new PathSegment(name, isDirectory, isDrive);
|
||||
}
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Value Object for the information about a media stream.
|
||||
@@ -111,11 +111,11 @@ public class StreamInfo : ValueObject
|
||||
Optional<int> channels)
|
||||
{
|
||||
if (streamId is null)
|
||||
return Errors.FileManagement.StreamIdCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.StreamIdCannotBeEmpty;
|
||||
if (codec is null)
|
||||
return Errors.FileManagement.CodecCannotBeEmpty;
|
||||
return Errors.FileSystemManagement.CodecCannotBeEmpty;
|
||||
if (bitrate <= 0)
|
||||
return Errors.FileManagement.BitrateMustBeAPositiveNumber;
|
||||
return Errors.FileSystemManagement.BitrateMustBeAPositiveNumber;
|
||||
return new StreamInfo(streamId, mimeType, bitrate, codec, resolution, frameRate, sampleRate, channels);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Enums.PhotoLibrary;
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.ValueObjects;
|
||||
namespace Lumina.Domain.Core.Aggregates.FileSystemManagement.FileSystemManagementAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Value object for file system thumbnails.
|
||||
@@ -40,4 +40,4 @@ public class Thumbnail : ValueObject
|
||||
yield return Type;
|
||||
yield return Bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -46,7 +46,7 @@ public sealed class Isbn : ValueObject
|
||||
/// <param name="value">The value representing this object.</param>
|
||||
/// <param name="format">The format of the ISBN representing this object.</param>
|
||||
/// <returns>The created <see cref="Isbn"/> instance.</returns>
|
||||
public static ErrorOr<Isbn> Create(string value, IsbnFormat format)
|
||||
public static ErrorOr<Isbn> Create(string? value, IsbnFormat format)
|
||||
{
|
||||
// enforce invariants
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
|
||||
+13
-13
@@ -16,12 +16,12 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
|
||||
public class WrittenContentMetadata : BaseMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the publisher of the written content.
|
||||
/// Gets the publisher of the written content, if applicable.
|
||||
/// </summary>
|
||||
public Optional<string> Publisher { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in the written content.
|
||||
/// Gets the number of pages in the written content, if applicable.
|
||||
/// </summary>
|
||||
public Optional<int> PageCount { get; }
|
||||
|
||||
@@ -29,15 +29,15 @@ public class WrittenContentMetadata : BaseMetadata
|
||||
/// Initializes a new instance of the <see cref="WrittenContentMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title of the written content.</param>
|
||||
/// <param name="originalTitle">The optional original title of the video.</param>
|
||||
/// <param name="description">The description of the written content.</param>
|
||||
/// <param name="originalTitle">The optional original title of the written content, if applicable.</param>
|
||||
/// <param name="description">The description of the written content, if applicable.</param>
|
||||
/// <param name="releaseInfo">The release information of the written content.</param>
|
||||
/// <param name="genres">The genres of the written content.</param>
|
||||
/// <param name="tags">The tags associated with the written content.</param>
|
||||
/// <param name="language">The language of the written content.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the video.</param>
|
||||
/// <param name="publisher">The publisher of the written content.</param>
|
||||
/// <param name="pageCount">The number of pages in the written content.</param>
|
||||
/// <param name="language">The language of the written content, if applicable.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the written content, if applicable.</param>
|
||||
/// <param name="publisher">The publisher of the written content, if applicable.</param>
|
||||
/// <param name="pageCount">The number of pages in the written content, if applicable.</param>
|
||||
private WrittenContentMetadata(
|
||||
string title,
|
||||
Optional<string> originalTitle,
|
||||
@@ -59,15 +59,15 @@ public class WrittenContentMetadata : BaseMetadata
|
||||
/// Creates a new instance of the <see cref="WrittenContentMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title of the written content.</param>
|
||||
/// <param name="originalTitle">The optional original title of the video.</param>
|
||||
/// <param name="description">The description of the written content.</param>
|
||||
/// <param name="originalTitle">The optional original title of the written content, if applicable.</param>
|
||||
/// <param name="description">The description of the written content, if applicable.</param>
|
||||
/// <param name="releaseInfo">The release information of the written content.</param>
|
||||
/// <param name="genres">The genres of the written content.</param>
|
||||
/// <param name="tags">The tags associated with the written content.</param>
|
||||
/// <param name="language">The language of the written content.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the video.</param>
|
||||
/// <param name="publisher">The publisher of the written content.</param>
|
||||
/// <param name="pageCount">The number of pages in the written content.</param>
|
||||
/// <param name="originalLanguage">The optional original language of the written content, if applicable.</param>
|
||||
/// <param name="publisher">The publisher of the written content, if applicable.</param>
|
||||
/// <param name="pageCount">The number of pages in the written content, if applicable.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="WrittenContentMetadata"/>, or an error message.
|
||||
/// </returns>
|
||||
|
||||
Reference in new issue
Block a user