From 727aa333181bf8022cd55d44a387ed3771054e47 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 16 Nov 2026 18:16:17 +0200 Subject: [PATCH] Formats code comments as sentences in the production sources. Capitalizes the first word and adds the terminal period across the domain, application, data access, infrastructure, API and web layers and the plugins. No comment is reworded. The change also normalizes the TODO bodies to lowercase, leaves commented-out code untouched, corrects the Threat/Treat typo and the dangling hyphen in the exception middleware, and collapses two accidental repeated terminal periods. --- .../Core/CalibreArtworkProvider.cs | 2 +- .../Core/Opf/OpfReader.cs | 4 +-- .../Core/OpenLibraryBookMetadataProvider.cs | 10 +++--- .../Core/Pdf/PdfDocumentParser.cs | 2 +- .../BookLibrary/BookEntity.cs | 4 +-- .../Validation/ValidationRule.cs | 4 +-- .../Validation/ValidationRuleForEach.cs | 4 +-- .../MusicLibrary/Tracks/TrackEntityMapping.cs | 2 +- .../MediaLibrary/Management/LibraryMapping.cs | 2 +- .../BookLibrary/Books/BookEntityMapping.cs | 2 +- .../Telemetry/ApplicationHandlerTelemetry.cs | 2 +- ...canJobProgressChangedDomainEventHandler.cs | 2 +- ...ryScanProgressChangedDomainEventHandler.cs | 2 +- .../GetThemeAssetQueryHandler.cs | 2 +- .../RecoverPasswordCommandHandler.cs | 2 +- .../RegisterUserCommandHandler.cs | 2 +- .../RegisterUserCommandValidator.cs | 2 +- ...eUserRoleAndPermissionsCommandValidator.cs | 2 +- .../Configuration/AlbumConfiguration.cs | 4 +-- .../AlbumContributorConfiguration.cs | 4 +-- .../Configuration/ArtistConfiguration.cs | 6 ++-- .../ArtistContributorConfiguration.cs | 4 +-- .../Configuration/BookArtworkConfiguration.cs | 4 +-- .../Common/Configuration/BookConfiguration.cs | 10 +++--- .../BookContributorConfiguration.cs | 4 +-- .../DirectoryScanFingerprintConfiguration.cs | 6 ++-- .../Configuration/FavoriteConfiguration.cs | 2 +- ...aryBookReaderConfigurationConfiguration.cs | 4 +-- .../Configuration/LibraryConfiguration.cs | 14 ++++---- .../Configuration/LibraryScanConfiguration.cs | 14 ++++---- .../LibraryScanResultConfiguration.cs | 8 ++--- .../LibraryScanSnapshotConfiguration.cs | 8 ++--- .../LibraryScanStagingResultsConfiguration.cs | 6 ++-- .../MediaConsumptionRecordConfiguration.cs | 2 +- .../MediaContributorConfiguration.cs | 4 +-- .../MediaResumePointConfiguration.cs | 2 +- .../MusicArtworkConfiguration.cs | 4 +-- ...sicLibraryScanItemMetadataConfiguration.cs | 4 +-- .../Configuration/PermissionConfiguration.cs | 2 +- .../Configuration/PlaylistConfiguration.cs | 2 +- .../Configuration/PluginConfiguration.cs | 4 +-- .../Common/Configuration/RoleConfiguration.cs | 2 +- .../RolePermissionConfiguration.cs | 16 ++++----- .../ScheduledJobConfiguration.cs | 2 +- ...chedulerDisplayPreferencesConfiguration.cs | 2 +- .../Configuration/ThemeConfiguration.cs | 8 ++--- .../Configuration/TrackConfiguration.cs | 6 ++-- .../TrackContributorConfiguration.cs | 4 +-- .../Common/Configuration/UserConfiguration.cs | 12 +++---- .../UserPermissionConfiguration.cs | 16 ++++----- .../Configuration/UserRoleConfiguration.cs | 16 ++++----- .../UserSettingsConfiguration.cs | 8 ++--- .../DataAccessLayerServices.cs | 2 +- .../UpdateAuditableEntitiesInterceptor.cs | 8 ++--- ...IndependentMetadataAndArtworkEnrichment.cs | 4 +-- .../DirectoryScanFingerprintRepository.cs | 6 ++-- .../LibraryScanSnapshotRepository.cs | 14 ++++---- .../LibraryScanStagingResultsRepository.cs | 10 +++--- .../MediaContributorRepository.cs | 2 +- .../Playlists/PlaylistRepository.cs | 4 +-- .../ArtworkProviderConfigurationRepository.cs | 2 +- ...MetadataProviderConfigurationRepository.cs | 2 +- src/Lumina.DataAccess/Core/UoW/UnitOfWork.cs | 4 +-- .../Common/Enums/BookLibrary/IsbnFormat.cs | 4 +-- .../Common/Enums/Common/SortOrder.cs | 2 +- .../ValueObjects/Metadata/ReleaseInfo.cs | 2 +- .../MusicLibraryAggregate/Entities/Album.cs | 6 ++-- .../MusicLibraryAggregate/Entities/Track.cs | 10 +++--- .../Entities/File.cs | 4 +-- .../Entities/WindowsRootItem.cs | 4 +-- .../Services/DirectoryProviderService.cs | 2 +- .../Services/FileSystemPermissionsService.cs | 6 ++-- .../Services/FileTypeService.cs | 32 ++++++++--------- .../Strategies/Path/IPathStrategy.cs | 2 +- .../LibraryAggregate/Library.cs | 2 +- .../ValueObjects/LibraryPathPart.cs | 4 +-- .../Jobs/MediaLibraryScanJobFactory.cs | 2 +- .../ValueObjects/ParsedLibraryPath.cs | 2 +- .../ValueObjects/MediaContributorId.cs | 4 +-- .../MovieLibraryAggregate/Movie.cs | 4 +-- .../ValueObjects/MovieId.cs | 4 +-- .../ValueObjects/EpisodeId.cs | 4 +-- .../ValueObjects/SeasonId.cs | 4 +-- .../ValueObjects/TvShowId.cs | 4 +-- .../Entities/BookSeries.cs | 4 +-- .../SharedConfiguration.cs | 4 +-- .../Common/Utilities/ExceptionUtilities.cs | 8 ++--- .../OptionsBuilderValidationUtilities.cs | 2 +- .../Common/Validation/ValidationOptions.cs | 12 +++---- .../Validators/CorsSettingsDtoValidator.cs | 2 +- .../Core/Authentication/JwtTokenGenerator.cs | 2 +- .../Core/Authentication/QRCodeGenerator.cs | 10 +++--- .../Core/Authentication/TokenGenerator.cs | 6 ++-- .../Core/Authentication/TotpTokenGenerator.cs | 4 +-- .../Playback/TrackNormalizationService.cs | 2 +- .../MediaLibrariesScanCancellationTracker.cs | 4 +-- .../BooksMediaLibraryScanMetadataEnricher.cs | 2 +- .../Core/Plugins/PluginInstaller.cs | 2 +- .../Core/Plugins/PluginLoadContext.cs | 4 +-- .../Core/Security/CryptographyService.cs | 24 ++++++------- .../Core/Security/PasswordHashService.cs | 20 +++++------ .../Core/Themes/ThemeService.cs | 26 +++++++------- .../Core/Time/DateTimeProvider.cs | 2 +- .../PresentationApiLayerConfiguration.cs | 2 +- .../PresentationApiLayerServices.cs | 6 ++-- .../Routes/UsersManagement/ApiRoutes.Users.cs | 2 +- .../Core/Endpoints/Common/BaseEndpoint.cs | 20 +++++------ .../InstallPlugin/InstallPluginEndpoint.cs | 2 +- .../InstallTheme/InstallThemeEndpoint.cs | 2 +- .../GetCurrentThemeEndpoint.cs | 2 +- .../GetThemeSettingsEndpoint.cs | 2 +- .../GetThemeTemplateEndpoint.cs | 2 +- .../Authorization/AuthorizationService.cs | 2 +- .../Authorization/InitializationHandler.cs | 4 +-- .../Common/DTO/Common/ReleaseInfoDto.cs | 2 +- .../DTO/FileSystemManagement/FileDto.cs | 2 +- .../BookLibrary/BookDto.cs | 2 +- .../PresentationWebLayerConfiguration.cs | 4 +-- .../PresentationWebLayerServices.cs | 2 +- .../Common/Enums/BookLibrary/IsbnFormat.cs | 4 +-- .../Common/Http/RazorViewResult.cs | 12 +++---- .../Middlewares/CultureRedirectMiddleware.cs | 10 +++--- .../ExceptionHandlingMiddleware.cs | 22 ++++++------ .../Middlewares/NotFoundRedirectMiddleware.cs | 2 +- .../Common/Security/CryptographyService.cs | 8 ++--- .../Services/CachedAuthorizationHandler.cs | 18 +++++----- .../Common/Services/ScriptIdentifierHelper.cs | 2 +- .../OptionsBuilderValidationUtilities.cs | 2 +- .../Common/Validation/ValidationOptions.cs | 12 +++---- .../Common/Validation/ValidationRule.cs | 4 +-- .../Validation/ValidationRuleForEach.cs | 2 +- .../SetLanguage/SetLanguageEndpoint.cs | 2 +- .../Authentication/Login/LoginEndpoint.cs | 4 +-- .../Core/Themes/RazorViewToStringRenderer.cs | 2 +- .../Themes/ThemeFileSystemBrowserBuilder.cs | 2 +- .../Themes/ThemeFileSystemBrowserRenderer.cs | 10 +++--- .../Core/Themes/ThemeLayoutRenderer.cs | 8 ++--- .../Core/Themes/ThemePageDataFactory.cs | 2 +- .../Core/Themes/ThemePageRenderer.cs | 4 +-- .../Core/Themes/ThemeTemplateEngine.cs | 6 ++-- .../FileSystemBrowserViewComponent.cs | 2 +- src/Lumina.Presentation.Web/Program.cs | 36 +++++++++---------- 142 files changed, 403 insertions(+), 403 deletions(-) diff --git a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs index 557bf102..000ed3e7 100644 --- a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs +++ b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs @@ -53,7 +53,7 @@ internal sealed class CalibreArtworkProvider : IArtworkProvider>([]); - // the cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed + // The cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed. string coverFileName = Path.GetFileName(document.CoverHref); if (coverFileName != document.CoverHref || Path.IsPathRooted(document.CoverHref)) return Task.FromResult>([]); diff --git a/plugins/Lumina.Plugins.Calibre/Core/Opf/OpfReader.cs b/plugins/Lumina.Plugins.Calibre/Core/Opf/OpfReader.cs index cb776e35..2ae3f677 100644 --- a/plugins/Lumina.Plugins.Calibre/Core/Opf/OpfReader.cs +++ b/plugins/Lumina.Plugins.Calibre/Core/Opf/OpfReader.cs @@ -34,7 +34,7 @@ internal static class OpfReader try { using FileStream fileStream = File.OpenRead(opfFilePath); - // the OPF file is untrusted XML, so DTD processing and external entity resolution are disabled, and the document size is bounded + // The OPF file is untrusted XML, so DTD processing and external entity resolution are disabled, and the document size is bounded. XmlReaderSettings xmlReaderSettings = new() { DtdProcessing = DtdProcessing.Prohibit, @@ -48,7 +48,7 @@ internal static class OpfReader } catch (XmlException) { - // a malformed OPF file must not prevent the enrichment of the book from proceeding + // A malformed OPF file must not prevent the enrichment of the book from proceeding. } return document; diff --git a/plugins/Lumina.Plugins.OpenLibrary/Core/OpenLibraryBookMetadataProvider.cs b/plugins/Lumina.Plugins.OpenLibrary/Core/OpenLibraryBookMetadataProvider.cs index 98d728ed..15bebde1 100644 --- a/plugins/Lumina.Plugins.OpenLibrary/Core/OpenLibraryBookMetadataProvider.cs +++ b/plugins/Lumina.Plugins.OpenLibrary/Core/OpenLibraryBookMetadataProvider.cs @@ -104,7 +104,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider searchResults = await _openLibraryHttpClient.SearchAsync(bookMetadataLookup, 1, cancellationToken).ConfigureAwait(false); @@ -143,7 +143,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider 0) openLibraryEditionResponse = await _openLibraryHttpClient.GetEditionAsync(searchResults[0].EditionKeys[0], cancellationToken).ConfigureAwait(false); } - // if by this time we still have no result, let's forget it... + // If by this time we still have no result, let's forget it... if (openLibraryEditionResponse is null && openLibraryWorkResponse is null && openLibrarySearchDocumentResponse is null) return null; @@ -208,7 +208,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider string.Equals(SafeNormalizeIsbn(value), wantedIsbn, StringComparison.OrdinalIgnoreCase))) score += 10_000; diff --git a/plugins/Lumina.Plugins.Pdf/Core/Pdf/PdfDocumentParser.cs b/plugins/Lumina.Plugins.Pdf/Core/Pdf/PdfDocumentParser.cs index 36168e6b..5d8f87c8 100644 --- a/plugins/Lumina.Plugins.Pdf/Core/Pdf/PdfDocumentParser.cs +++ b/plugins/Lumina.Plugins.Pdf/Core/Pdf/PdfDocumentParser.cs @@ -248,7 +248,7 @@ internal static class PdfDocumentParser } catch (Exception) { - // The bookmarks of a malformed PDF are best effort, so the table of contents is skipped instead of failing the book; the pages themselves are still readable + // The bookmarks of a malformed PDF are best effort, so the table of contents is skipped instead of failing the book; the pages themselves are still readable. return []; } } diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs index 31c03f4c..39b29f1b 100644 --- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs +++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs @@ -73,7 +73,7 @@ public class BookEntity : IStorageEntity, IAuditableEntity public ReleaseCountry? ReleaseCountry { get; set; } /// - /// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0") + /// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0"). /// public string? ReleaseVersion { get; set; } @@ -141,7 +141,7 @@ public class BookEntity : IStorageEntity, IAuditableEntity /// Gets or sets the volume or book number in the series, if applicable. /// public float? VolumeNumber { get; set; } - // TODO: uncomment when series is implemented + // TODO: uncomment when series is implemented. /// /// Gets or sets the series id, if the book is part of a series. /// diff --git a/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRule.cs b/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRule.cs index 86111ef8..0e65d0ea 100644 --- a/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRule.cs +++ b/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRule.cs @@ -21,7 +21,7 @@ internal sealed class ValidationRule : IValidationRule> _predicates = []; private readonly List _predicateErrors = []; - // instance-aware predicates get their own separate pair of lists instead of being merged into the + // Instance-aware predicates get their own separate pair of lists instead of being merged into the // lists above, because they have a different delegate signature (TRequest, TProperty) vs (TProperty). // Keeping them separate avoids wrapping every plain predicate in an adapter, just to fit one shape. private readonly List> _instanceAwarePredicates = []; @@ -132,7 +132,7 @@ internal sealed class ValidationRule : IValidationRuleThe of every predicate that fails; empty if the rule passes. public IEnumerable Validate(TRequest instance) { - // evaluate the condition first, if it returns false, skip validation entirely. + // Evaluate the condition first, if it returns false, skip validation entirely. if (condition is not null && !condition(instance)) yield break; diff --git a/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRuleForEach.cs b/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRuleForEach.cs index 2ae08150..ae33f3ef 100644 --- a/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRuleForEach.cs +++ b/src/Lumina.Application/Common/Infrastructure/Validation/ValidationRuleForEach.cs @@ -76,7 +76,7 @@ internal sealed class ValidationRuleForEach : IValidationRuleThe current instance for method chaining. public IRuleBuilder WithError(Error error) { - // validation rules always produce validation errors, regardless of the error type of the source error + // Validation rules always produce validation errors, regardless of the error type of the source error. Error validationError = Error.Validation(description: error.Description); currentError = validationError; if (isLastAddedPredicateInstanceAware && _instanceAwarePredicateErrors.Count > 0) @@ -106,7 +106,7 @@ internal sealed class ValidationRuleForEach : IValidationRuleOne per failing predicate, per item; empty if every item passes. public IEnumerable Validate(TRequest instance) { - // evaluate the condition first, if it returns false, skip validation entirely. + // Evaluate the condition first, if it returns false, skip validation entirely. if (condition is not null && !condition(instance)) yield break; diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackEntityMapping.cs index 286bb68b..a6ed176d 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackEntityMapping.cs @@ -218,7 +218,7 @@ public static class TrackEntityMapping repositoryEntity.ReleaseCountry, repositoryEntity.ReleaseVersion ); - // language and original language make sense only if their subproperties have values + // Language and original language make sense only if their subproperties have values. LanguageInfoDto? languageInfo = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) || !string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) || !string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName) diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs index 9d61a1b1..4987539a 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs @@ -48,7 +48,7 @@ public static class LibraryMapping { Id = scanId.Value, LibraryId = domainEntity.Id.Value, - UserId = domainEntity.UserId.Value, // rest of properties will be populated by EF Core + UserId = domainEntity.UserId.Value, // Rest of properties will be populated by EF Core. Status = default, User = null!, Library = null!, diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs index 40441872..d09aa5bf 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs @@ -199,7 +199,7 @@ public static class BookEntityMapping repositoryEntity.ReleaseCountry, repositoryEntity.ReleaseVersion ); - // language and original language make sense only if their subproperties have values + // Language and original language make sense only if their subproperties have values. LanguageInfoDto? languageInfoEntity = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) || !string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) || !string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName) diff --git a/src/Lumina.Application/Common/Telemetry/ApplicationHandlerTelemetry.cs b/src/Lumina.Application/Common/Telemetry/ApplicationHandlerTelemetry.cs index 369ec505..493723db 100644 --- a/src/Lumina.Application/Common/Telemetry/ApplicationHandlerTelemetry.cs +++ b/src/Lumina.Application/Common/Telemetry/ApplicationHandlerTelemetry.cs @@ -65,7 +65,7 @@ internal static class ApplicationHandlerTelemetry { activity?.SetStatus(ActivityStatusCode.Error, error); RecordOutcome(activity, handlerName, handlerType, duration, isSuccess: false); - // business-rule failures are routine outcomes (e.g. failed logins), so log at Debug to avoid noise from high-frequency handlers + // Business-rule failures are routine outcomes (e.g. failed logins), so log at Debug to avoid noise from high-frequency handlers. logger.LogDebug("Failed handling {HandlerType} {HandlerName} in {DurationMs}ms: {Error}", handlerType, handlerName, duration.TotalMilliseconds, error); } diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanJobProgressChangedDomainEventHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanJobProgressChangedDomainEventHandler.cs index e0bd68b4..c346627c 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanJobProgressChangedDomainEventHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanJobProgressChangedDomainEventHandler.cs @@ -38,7 +38,7 @@ public class LibraryScanJobProgressChangedDomainEventHandler : IDomainEventHandl public async ValueTask HandleAsync(LibraryScanJobProgressChangedDomainEvent domainEvent, CancellationToken cancellationToken) { _mediaLibrariesScanProgressTracker.UpdateScanJobProgress(domainEvent.LibraryId, domainEvent.MediaLibraryScanCompositeId, domainEvent.Progress); - // notify SignalR clients that the library scan progress changed + // Notify SignalR clients that the library scan progress changed. await _debouncedLibraryScanProgressNotifier.SendLibraryProgressUpdateEventAsync(domainEvent.MediaLibraryScanCompositeId, cancellationToken).ConfigureAwait(false); } } diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanProgressChangedDomainEventHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanProgressChangedDomainEventHandler.cs index 2934a173..2a487d76 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanProgressChangedDomainEventHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryScanProgressChangedDomainEventHandler.cs @@ -38,7 +38,7 @@ public class LibraryScanProgressChangedDomainEventHandler : IDomainEventHandler< public async ValueTask HandleAsync(LibraryScanProgressChangedDomainEvent domainEvent, CancellationToken cancellationToken) { _mediaLibrariesScanProgressTracker.UpdateScanProgress(domainEvent.LibraryId, domainEvent.MediaLibraryScanCompositeId); - // notify SignalR clients that the library scan progress changed + // Notify SignalR clients that the library scan progress changed. await _debouncedLibraryScanProgressNotifier.SendLibraryProgressUpdateEventAsync(domainEvent.MediaLibraryScanCompositeId, cancellationToken).ConfigureAwait(false); } } diff --git a/src/Lumina.Application/Core/Themes/Management/Queries/GetThemeAsset/GetThemeAssetQueryHandler.cs b/src/Lumina.Application/Core/Themes/Management/Queries/GetThemeAsset/GetThemeAssetQueryHandler.cs index 9f69ce6a..6d2b4474 100644 --- a/src/Lumina.Application/Core/Themes/Management/Queries/GetThemeAsset/GetThemeAssetQueryHandler.cs +++ b/src/Lumina.Application/Core/Themes/Management/Queries/GetThemeAsset/GetThemeAssetQueryHandler.cs @@ -63,7 +63,7 @@ public class GetThemeAssetQueryHandler : IQueryHandler assetResult = await _themeService.GetAssetAsync(theme.ThemeId, query.AssetPath!, cancellationToken).ConfigureAwait(false); if (assetResult.IsFailure) { - // the stored files of a bundled theme removed externally are restored, so its assets keep being served + // The stored files of a bundled theme removed externally are restored, so its assets keep being served. if (theme.InstallSource == ThemeInstallSource.Bundled) { Result restoreResult = await _themeService.RestoreBundledThemeAsync(theme.ThemeId, cancellationToken).ConfigureAwait(false); diff --git a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs index 28c7d4ca..5d08231b 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs @@ -84,7 +84,7 @@ public class RecoverPasswordCommandHandler : ICommandHandler command.Password) diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs index 6798fc77..6f1dd7d6 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs @@ -24,7 +24,7 @@ public class UpdateUserRoleAndPermissionsCommandValidator : AbstractValidator id != Guid.Empty) .WithError(DomainErrors.Users.UserIdCannotBeEmpty); - // validate each permission Id when the list is provided + // Validate each permission Id when the list is provided. RuleForEach(command => command.Permissions) .NotEmpty() .WithError(ApplicationErrors.Authorization.PermissionIdCannotBeEmpty) diff --git a/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs index 845ddd36..0a940eb7 100644 --- a/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs @@ -142,8 +142,8 @@ public class AlbumConfiguration : IEntityTypeConfiguration .HasForeignKey(album => album.ArtistId) .OnDelete(DeleteBehavior.Cascade); - // since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, - // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key + // Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, + // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key. builder.HasMany(album => album.Tags) .WithMany() .UsingEntity>( diff --git a/src/Lumina.DataAccess/Common/Configuration/AlbumContributorConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/AlbumContributorConfiguration.cs index 01eb1bcf..dc8fea1b 100644 --- a/src/Lumina.DataAccess/Common/Configuration/AlbumContributorConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/AlbumContributorConfiguration.cs @@ -20,7 +20,7 @@ public class AlbumContributorConfiguration : IEntityTypeConfiguration albumContributor.Id); builder.Property(albumContributor => albumContributor.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(albumContributor => albumContributor.AlbumId) @@ -35,7 +35,7 @@ public class AlbumContributorConfiguration : IEntityTypeConfiguration albumContributor.CreatedOnUtc) .IsRequired() .HasColumnOrder(4); diff --git a/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs index b6ecfb88..6d438db3 100644 --- a/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs @@ -24,7 +24,7 @@ public class ArtistConfiguration : IEntityTypeConfiguration builder.ToTable("Artists"); builder.HasKey(artist => artist.Id); builder.Property(artist => artist.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(artist => artist.LibraryId) @@ -143,8 +143,8 @@ public class ArtistConfiguration : IEntityTypeConfiguration .HasMaxLength(20); }); - // since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, - // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key + // Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, + // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key. builder.HasMany(artist => artist.Tags) .WithMany() .UsingEntity>( diff --git a/src/Lumina.DataAccess/Common/Configuration/ArtistContributorConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/ArtistContributorConfiguration.cs index b07ec32a..4fc665a2 100644 --- a/src/Lumina.DataAccess/Common/Configuration/ArtistContributorConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/ArtistContributorConfiguration.cs @@ -20,7 +20,7 @@ public class ArtistContributorConfiguration : IEntityTypeConfiguration artistContributor.Id); builder.Property(artistContributor => artistContributor.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(artistContributor => artistContributor.ArtistId) @@ -35,7 +35,7 @@ public class ArtistContributorConfiguration : IEntityTypeConfiguration artistContributor.CreatedOnUtc) .IsRequired() .HasColumnOrder(4); diff --git a/src/Lumina.DataAccess/Common/Configuration/BookArtworkConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/BookArtworkConfiguration.cs index 4152a5a2..72a5b01d 100644 --- a/src/Lumina.DataAccess/Common/Configuration/BookArtworkConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/BookArtworkConfiguration.cs @@ -20,7 +20,7 @@ public class BookArtworkConfiguration : IEntityTypeConfiguration bookArtwork.Id); builder.Property(bookArtwork => bookArtwork.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(bookArtwork => bookArtwork.BookId) .IsRequired() @@ -49,7 +49,7 @@ public class BookArtworkConfiguration : IEntityTypeConfiguration bookArtwork.LastUpdateUtc) .HasColumnOrder(8); - // audit + // Audit. builder.Property(bookArtwork => bookArtwork.CreatedOnUtc) .IsRequired() .HasColumnOrder(9); diff --git a/src/Lumina.DataAccess/Common/Configuration/BookConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/BookConfiguration.cs index 506a50d7..13191ea4 100644 --- a/src/Lumina.DataAccess/Common/Configuration/BookConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/BookConfiguration.cs @@ -23,7 +23,7 @@ public class BookConfiguration : IEntityTypeConfiguration builder.ToTable("Books"); builder.HasKey(book => book.Id); builder.Property(book => book.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(book => book.Title) @@ -62,8 +62,8 @@ public class BookConfiguration : IEntityTypeConfiguration .HasColumnOrder(14); builder.Property(book => book.OriginalLanguageNativeName) .HasColumnOrder(15); - // since Tag is a Domain ValueObject (no identity), but we also don't want to have duplicates, - // we need to configure it as a many-to-many relationship, where the tag itself is the primary key + // Since Tag is a Domain ValueObject (no identity), but we also don't want to have duplicates, + // we need to configure it as a many-to-many relationship, where the tag itself is the primary key. builder.HasMany(book => book.Tags) .WithMany() .UsingEntity>( @@ -213,7 +213,7 @@ public class BookConfiguration : IEntityTypeConfiguration .IsRequired(); }); - // audit + // Audit. builder.Property(book => book.CreatedOnUtc) .IsRequired() .HasColumnOrder(32); @@ -231,7 +231,7 @@ public class BookConfiguration : IEntityTypeConfiguration .HasColumnOrder(35); builder.HasIndex(book => new { book.LibraryId, book.Path }) - .IsUnique(); // the same physical book on disk cannot appear twice in the same library + .IsUnique(); // The same physical book on disk cannot appear twice in the same library. builder.HasIndex(book => new { book.LibraryId, book.MetadataStatus }); // The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the // index follows the same order and no temporary B-tree is needed for the sort. diff --git a/src/Lumina.DataAccess/Common/Configuration/BookContributorConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/BookContributorConfiguration.cs index 62fa6705..94205bb0 100644 --- a/src/Lumina.DataAccess/Common/Configuration/BookContributorConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/BookContributorConfiguration.cs @@ -20,7 +20,7 @@ public class BookContributorConfiguration : IEntityTypeConfiguration bookContributor.Id); builder.Property(bookContributor => bookContributor.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(bookContributor => bookContributor.BookId) @@ -35,7 +35,7 @@ public class BookContributorConfiguration : IEntityTypeConfiguration bookContributor.CreatedOnUtc) .IsRequired() .HasColumnOrder(4); diff --git a/src/Lumina.DataAccess/Common/Configuration/DirectoryScanFingerprintConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/DirectoryScanFingerprintConfiguration.cs index 5b411119..bc98cfb4 100644 --- a/src/Lumina.DataAccess/Common/Configuration/DirectoryScanFingerprintConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/DirectoryScanFingerprintConfiguration.cs @@ -18,10 +18,10 @@ public class DirectoryScanFingerprintConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("DirectoryScanFingerprints"); - // composite key, so that each directory scan fingerprint is uniquely identified within its library by its path + // Composite key, so that each directory scan fingerprint is uniquely identified within its library by its path. builder.HasKey(directoryScanFingerprint => new { directoryScanFingerprint.LibraryId, directoryScanFingerprint.Path }); - // one library with many directory scan fingerprints + // One library with many directory scan fingerprints. builder.HasOne() .WithMany() .HasForeignKey(directoryScanFingerprint => directoryScanFingerprint.LibraryId) @@ -41,7 +41,7 @@ public class DirectoryScanFingerprintConfiguration : IEntityTypeConfiguration directoryScanFingerprint.LibraryId); } } diff --git a/src/Lumina.DataAccess/Common/Configuration/FavoriteConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/FavoriteConfiguration.cs index 6e3c4449..96d9251e 100644 --- a/src/Lumina.DataAccess/Common/Configuration/FavoriteConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/FavoriteConfiguration.cs @@ -21,7 +21,7 @@ public class FavoriteConfiguration : IEntityTypeConfiguration builder.ToTable("Favorites"); builder.HasKey(favorite => favorite.Id); builder.Property(favorite => favorite.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); // A favorite belongs to the user that created it, and it is removed with that user. diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryBookReaderConfigurationConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryBookReaderConfigurationConfiguration.cs index 81a5b821..63d9c5cc 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryBookReaderConfigurationConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryBookReaderConfigurationConfiguration.cs @@ -20,7 +20,7 @@ public class LibraryBookReaderConfigurationConfiguration : IEntityTypeConfigurat builder.ToTable("LibraryBookReaderConfigurations"); builder.HasKey(configuration => configuration.Id); builder.Property(configuration => configuration.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(configuration => configuration.LibraryId) .IsRequired() @@ -32,7 +32,7 @@ public class LibraryBookReaderConfigurationConfiguration : IEntityTypeConfigurat .IsRequired() .HasColumnOrder(3); - // audit + // Audit. builder.Property(configuration => configuration.CreatedOnUtc) .IsRequired() .HasColumnOrder(4); diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs index 3f768e45..c594ec4f 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs @@ -21,7 +21,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration builder.ToTable("Libraries"); builder.HasKey(library => library.Id); builder.Property(library => library.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(library => library.Title) @@ -83,19 +83,19 @@ public class LibraryConfiguration : IEntityTypeConfiguration .HasDefaultValue(false) .HasColumnOrder(18); - // one user with many libraries + // One user with many libraries. builder.HasOne(library => library.User) .WithMany(user => user.Libraries) .HasForeignKey(library => library.UserId) .IsRequired(); - // one library with many scans + // One library with many scans. builder.HasMany(library => library.LibraryScans) .WithOne(libraryScan => libraryScan.Library) .HasForeignKey(libraryScan => libraryScan.LibraryId) - .OnDelete(DeleteBehavior.Cascade); // deleting a library deletes library scans + .OnDelete(DeleteBehavior.Cascade); // Deleting a library deletes library scans. - // using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library + // Using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library. builder.OwnsMany(library => library.ContentLocations, contentLocationBuilder => { contentLocationBuilder.ToTable("LibraryContentLocations"); @@ -112,7 +112,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration .IsRequired(); }); - // the path template parts are ordered, so their position is stored explicitly and part of a unique index together with the library + // The path template parts are ordered, so their position is stored explicitly and part of a unique index together with the library. builder.OwnsMany(library => library.PathTemplateParts, partBuilder => { partBuilder.ToTable("LibraryPathTemplateParts"); @@ -139,7 +139,7 @@ public class LibraryConfiguration : IEntityTypeConfiguration .IsRequired(); }); - // audit + // Audit. builder.Property(library => library.CreatedOnUtc) .IsRequired() .HasColumnOrder(12); diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryScanConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryScanConfiguration.cs index 3765248c..c3136856 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryScanConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryScanConfiguration.cs @@ -21,16 +21,16 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration library.Id); builder.Property(library => library.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); - // one user with many library scans + // One user with many library scans. builder.HasOne(libraryScan => libraryScan.User) .WithMany(user => user.LibraryScans) .HasForeignKey(libraryScan => libraryScan.UserId) .IsRequired(); - // one library with many library scans + // One library with many library scans. builder.HasOne(libraryScan => libraryScan.Library) .WithMany(library => library.LibraryScans) .HasForeignKey(libraryScan => libraryScan.LibraryId) @@ -41,7 +41,7 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration() .HasColumnOrder(1); - // audit + // Audit. builder.Property(libraryScan => libraryScan.CreatedOnUtc) .IsRequired() .HasColumnOrder(2); @@ -58,10 +58,10 @@ public class LibraryScanConfiguration : IEntityTypeConfiguration new { libraryScan.LibraryId, libraryScan.Status, libraryScan.CreatedOnUtc }) - .IsDescending(true, false, true); // CreatedOnUtc DESC + .IsDescending(true, false, true); // CreatedOnUtc DESC. } } diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryScanResultConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryScanResultConfiguration.cs index 5f500424..8c1c0c48 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryScanResultConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryScanResultConfiguration.cs @@ -18,10 +18,10 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("LibraryScanResults"); - // composite key for efficient scan-specific lookups (paths are enforced as UNIQUE within the same scan) + // Composite key for efficient scan-specific lookups (paths are enforced as UNIQUE within the same scan). builder.HasKey(libraryScanResult => new { libraryScanResult.LibraryScanId, libraryScanResult.Path }); - // one library scan with many library scan results + // One library scan with many library scan results. builder.HasOne(libraryScanResult => libraryScanResult.LibraryScan) .WithMany(libraryScan => libraryScan.LibraryScanResults) .HasForeignKey(libraryScanResult => libraryScanResult.LibraryScanId) @@ -38,7 +38,7 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration libraryScanResult.ContentHash) - .HasMaxLength(24) // xxHash128 as Base64 + .HasMaxLength(24) // xxHash128 as Base64. .IsRequired() .HasColumnOrder(2); @@ -56,7 +56,7 @@ public class LibraryScanResultConfiguration : IEntityTypeConfiguration new { libraryScanResult.ContentHash, libraryScanResult.FileSize, libraryScanResult.Path }); builder.HasIndex(libraryScanResult => libraryScanResult.Path); diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryScanSnapshotConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryScanSnapshotConfiguration.cs index 756de536..62197404 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryScanSnapshotConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryScanSnapshotConfiguration.cs @@ -18,10 +18,10 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("LibraryScanSnapshots"); - // composite key, so that each media library scan snapshot item is uniquely identified within its library by its path + // Composite key, so that each media library scan snapshot item is uniquely identified within its library by its path. builder.HasKey(libraryScanSnapshot => new { libraryScanSnapshot.LibraryId, libraryScanSnapshot.Path }); - // one library with many media library scan snapshot items + // One library with many media library scan snapshot items. builder.HasOne(libraryScanSnapshot => libraryScanSnapshot.Library) .WithMany() .HasForeignKey(libraryScanSnapshot => libraryScanSnapshot.LibraryId) @@ -49,7 +49,7 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration libraryScanSnapshot.CreatedOnUtc) .IsRequired() .HasColumnOrder(5); @@ -66,7 +66,7 @@ public class LibraryScanSnapshotConfiguration : IEntityTypeConfiguration libraryScanSnapshot.LibraryId); } } diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryScanStagingResultsConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryScanStagingResultsConfiguration.cs index d5c13f92..a9b0d2f3 100644 --- a/src/Lumina.DataAccess/Common/Configuration/LibraryScanStagingResultsConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/LibraryScanStagingResultsConfiguration.cs @@ -18,10 +18,10 @@ public class LibraryScanStagingResultsConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("LibraryScanStagingResults"); - // composite key, so that each media library scan staging result is uniquely identified within its scan by its path + // Composite key, so that each media library scan staging result is uniquely identified within its scan by its path. builder.HasKey(libraryScanStagingResult => new { libraryScanStagingResult.LibraryScanId, libraryScanStagingResult.Path }); - // one media library scan with many media library scan staging results + // One media library scan with many media library scan staging results. builder.HasOne() .WithMany() .HasForeignKey(libraryScanStagingResult => libraryScanStagingResult.LibraryScanId) @@ -61,7 +61,7 @@ public class LibraryScanStagingResultsConfiguration : IEntityTypeConfiguration new { libraryScanStagingResult.LibraryScanId, libraryScanStagingResult.NeedsRehash }); } } diff --git a/src/Lumina.DataAccess/Common/Configuration/MediaConsumptionRecordConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MediaConsumptionRecordConfiguration.cs index 0282a73f..1ffb4a22 100644 --- a/src/Lumina.DataAccess/Common/Configuration/MediaConsumptionRecordConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/MediaConsumptionRecordConfiguration.cs @@ -21,7 +21,7 @@ public class MediaConsumptionRecordConfiguration : IEntityTypeConfiguration record.Id); builder.Property(record => record.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); // A consumption record belongs to the user that started it, and it is removed with that user. diff --git a/src/Lumina.DataAccess/Common/Configuration/MediaContributorConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MediaContributorConfiguration.cs index 6f5552f1..a4b7c4ae 100644 --- a/src/Lumina.DataAccess/Common/Configuration/MediaContributorConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/MediaContributorConfiguration.cs @@ -20,7 +20,7 @@ public class MediaContributorConfiguration : IEntityTypeConfiguration contributor.Id); builder.Property(contributor => contributor.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(contributor => contributor.DisplayName) .IsRequired() @@ -38,7 +38,7 @@ public class MediaContributorConfiguration : IEntityTypeConfiguration contributor.DateOfDeath) .HasColumnOrder(5); - // audit + // Audit. builder.Property(contributor => contributor.CreatedOnUtc) .IsRequired() .HasColumnOrder(6); diff --git a/src/Lumina.DataAccess/Common/Configuration/MediaResumePointConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MediaResumePointConfiguration.cs index 1a237733..34562506 100644 --- a/src/Lumina.DataAccess/Common/Configuration/MediaResumePointConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/MediaResumePointConfiguration.cs @@ -21,7 +21,7 @@ public class MediaResumePointConfiguration : IEntityTypeConfiguration resumePoint.Id); builder.Property(resumePoint => resumePoint.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); // A resume point belongs to the user that owns it, and it is removed with that user. diff --git a/src/Lumina.DataAccess/Common/Configuration/MusicArtworkConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MusicArtworkConfiguration.cs index 50853c1b..dd7bfc2b 100644 --- a/src/Lumina.DataAccess/Common/Configuration/MusicArtworkConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/MusicArtworkConfiguration.cs @@ -20,7 +20,7 @@ public class MusicArtworkConfiguration : IEntityTypeConfiguration musicArtwork.Id); builder.Property(musicArtwork => musicArtwork.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(musicArtwork => musicArtwork.OwnerType) .IsRequired() @@ -54,7 +54,7 @@ public class MusicArtworkConfiguration : IEntityTypeConfiguration musicArtwork.LastUpdateUtc) .HasColumnOrder(9); - // audit + // Audit. builder.Property(musicArtwork => musicArtwork.CreatedOnUtc) .IsRequired() .HasColumnOrder(10); diff --git a/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs index a7d60eae..192430cc 100644 --- a/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs @@ -20,7 +20,7 @@ public class MusicLibraryScanItemMetadataConfiguration : IEntityTypeConfiguratio builder.ToTable("MusicLibraryScanItemMetadata"); builder.HasKey(musicMetadata => musicMetadata.Id); builder.Property(musicMetadata => musicMetadata.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(musicMetadata => musicMetadata.LibraryScanId) .IsRequired() @@ -103,6 +103,6 @@ public class MusicLibraryScanItemMetadataConfiguration : IEntityTypeConfiguratio .HasColumnOrder(31); builder.HasIndex(musicMetadata => new { musicMetadata.LibraryScanId, musicMetadata.Path }) - .IsUnique(); // the metadata of the same physical file cannot be staged twice during the same scan + .IsUnique(); // The metadata of the same physical file cannot be staged twice during the same scan. } } diff --git a/src/Lumina.DataAccess/Common/Configuration/PermissionConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/PermissionConfiguration.cs index 231a3c56..cfacac4c 100644 --- a/src/Lumina.DataAccess/Common/Configuration/PermissionConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/PermissionConfiguration.cs @@ -29,7 +29,7 @@ public class PermissionConfiguration : IEntityTypeConfiguration permission.CreatedOnUtc) .IsRequired() .HasColumnOrder(3); diff --git a/src/Lumina.DataAccess/Common/Configuration/PlaylistConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/PlaylistConfiguration.cs index b9fb14eb..05d6ab1a 100644 --- a/src/Lumina.DataAccess/Common/Configuration/PlaylistConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/PlaylistConfiguration.cs @@ -21,7 +21,7 @@ public class PlaylistConfiguration : IEntityTypeConfiguration builder.ToTable("Playlists"); builder.HasKey(playlist => playlist.Id); builder.Property(playlist => playlist.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); // A playlist belongs to the user that created it, and it is removed with that user. diff --git a/src/Lumina.DataAccess/Common/Configuration/PluginConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/PluginConfiguration.cs index 7bc598bd..5dd6e559 100644 --- a/src/Lumina.DataAccess/Common/Configuration/PluginConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/PluginConfiguration.cs @@ -20,7 +20,7 @@ public class PluginConfiguration : IEntityTypeConfiguration builder.ToTable("Plugins"); builder.HasKey(plugin => plugin.Id); builder.Property(plugin => plugin.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(plugin => plugin.Name) .IsRequired() @@ -51,7 +51,7 @@ public class PluginConfiguration : IEntityTypeConfiguration .IsRequired() .HasColumnOrder(8); - // audit + // Audit. builder.Property(plugin => plugin.CreatedBy) .IsRequired() .HasColumnOrder(9); diff --git a/src/Lumina.DataAccess/Common/Configuration/RoleConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/RoleConfiguration.cs index b02bf925..a610842a 100644 --- a/src/Lumina.DataAccess/Common/Configuration/RoleConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/RoleConfiguration.cs @@ -28,7 +28,7 @@ public class RoleConfiguration : IEntityTypeConfiguration .HasMaxLength(100) .HasColumnOrder(1); - // audit + // Audit. builder.Property(role => role.CreatedOnUtc) .IsRequired() .HasColumnOrder(3); diff --git a/src/Lumina.DataAccess/Common/Configuration/RolePermissionConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/RolePermissionConfiguration.cs index 8283859e..006e601f 100644 --- a/src/Lumina.DataAccess/Common/Configuration/RolePermissionConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/RolePermissionConfiguration.cs @@ -19,26 +19,26 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration new { rolePermission.RoleId, rolePermission.PermissionId }); - builder.Ignore(rolePermission => rolePermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id + builder.Ignore(rolePermission => rolePermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id. - // foreign key: Role + // Foreign key: Role. builder.HasOne(rolePermission => rolePermission.Role) .WithMany(user => user.RolePermissions) .HasForeignKey(rolePermission => rolePermission.RoleId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a Role deletes associated RolePermission + .OnDelete(DeleteBehavior.Cascade); // Deleting a Role deletes associated RolePermission. - // foreign key: Permission + // Foreign key: Permission. builder.HasOne(rolePermission => rolePermission.Permission) .WithMany(role => role.RolePermissions) .HasForeignKey(rolePermission => rolePermission.PermissionId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a Permission deletes associated RolePermission + .OnDelete(DeleteBehavior.Cascade); // Deleting a Permission deletes associated RolePermission. - // audit + // Audit. builder.Property(rolePermission => rolePermission.CreatedOnUtc) .IsRequired() .HasColumnOrder(1); @@ -55,7 +55,7 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration new { userRole.RoleId, userRole.PermissionId }) .IsUnique(); } diff --git a/src/Lumina.DataAccess/Common/Configuration/ScheduledJobConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/ScheduledJobConfiguration.cs index 84b984f5..37af494b 100644 --- a/src/Lumina.DataAccess/Common/Configuration/ScheduledJobConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/ScheduledJobConfiguration.cs @@ -21,7 +21,7 @@ public class ScheduledJobConfiguration : IEntityTypeConfiguration scheduledJob.Id); builder.Property(scheduledJob => scheduledJob.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(scheduledJob => scheduledJob.Name) diff --git a/src/Lumina.DataAccess/Common/Configuration/SchedulerDisplayPreferencesConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/SchedulerDisplayPreferencesConfiguration.cs index 698aaac7..dcb836c5 100644 --- a/src/Lumina.DataAccess/Common/Configuration/SchedulerDisplayPreferencesConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/SchedulerDisplayPreferencesConfiguration.cs @@ -21,7 +21,7 @@ public class SchedulerDisplayPreferencesConfiguration : IEntityTypeConfiguration builder.ToTable("SchedulerDisplayPreferences"); builder.HasKey(preferences => preferences.Id); builder.Property(preferences => preferences.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(preferences => preferences.UserId) diff --git a/src/Lumina.DataAccess/Common/Configuration/ThemeConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/ThemeConfiguration.cs index 5f36830f..5620c150 100644 --- a/src/Lumina.DataAccess/Common/Configuration/ThemeConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/ThemeConfiguration.cs @@ -21,10 +21,10 @@ public class ThemeConfiguration : IEntityTypeConfiguration builder.ToTable("Themes"); builder.HasKey(theme => theme.Id); builder.Property(theme => theme.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the install, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the install, we need to tell EF not to generate it. .HasColumnOrder(0); - // the manifest id is the business key used by the clients, so it must be unique + // The manifest id is the business key used by the clients, so it must be unique. builder.HasIndex(theme => theme.ThemeId) .IsUnique(); @@ -63,7 +63,7 @@ public class ThemeConfiguration : IEntityTypeConfiguration .HasConversion() .HasColumnOrder(7); - // at most one theme can be current: the filtered unique index guarantees it at the database level, since every row that is not current has a null value here, and nulls are allowed to repeat + // At most one theme can be current: the filtered unique index guarantees it at the database level, since every row that is not current has a null value here, and nulls are allowed to repeat. builder.HasIndex(theme => theme.IsCurrent) .IsUnique() .HasFilter("IsCurrent = 1"); @@ -80,7 +80,7 @@ public class ThemeConfiguration : IEntityTypeConfiguration .IsRequired() .HasColumnOrder(10); - // audit + // Audit. builder.Property(theme => theme.CreatedOnUtc) .IsRequired() .HasColumnOrder(11); diff --git a/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs index 0a23b645..1ea4ccbc 100644 --- a/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs @@ -167,8 +167,8 @@ public class TrackConfiguration : IEntityTypeConfiguration .HasForeignKey(track => track.AlbumId) .OnDelete(DeleteBehavior.Cascade); - // since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, - // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key + // Since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates, + // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key. builder.HasMany(track => track.Tags) .WithMany() .UsingEntity>( @@ -296,7 +296,7 @@ public class TrackConfiguration : IEntityTypeConfiguration builder.HasIndex(track => new { track.AlbumId, track.TrackNumber }); builder.HasIndex(track => new { track.LibraryId, track.Path }) - .IsUnique(); // the same physical track file cannot appear twice in the same library + .IsUnique(); // The same physical track file cannot appear twice in the same library. // The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the // filtered index follows the same order and no temporary B-tree is needed for the sort, while visible rows add no entries to it. builder.HasIndex(track => new { track.LibraryId, track.IsDeleted, track.DeletedOnUtc, track.Title, track.Id }) diff --git a/src/Lumina.DataAccess/Common/Configuration/TrackContributorConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/TrackContributorConfiguration.cs index 6eada74d..6532e9b8 100644 --- a/src/Lumina.DataAccess/Common/Configuration/TrackContributorConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/TrackContributorConfiguration.cs @@ -20,7 +20,7 @@ public class TrackContributorConfiguration : IEntityTypeConfiguration trackContributor.Id); builder.Property(trackContributor => trackContributor.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(trackContributor => trackContributor.TrackId) @@ -35,7 +35,7 @@ public class TrackContributorConfiguration : IEntityTypeConfiguration trackContributor.CreatedOnUtc) .IsRequired() .HasColumnOrder(4); diff --git a/src/Lumina.DataAccess/Common/Configuration/UserConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserConfiguration.cs index a8e2eeca..b25d8dd0 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserConfiguration.cs @@ -21,7 +21,7 @@ public class UserConfiguration : IEntityTypeConfiguration builder.ToTable("Users"); builder.HasKey(user => user.Id); builder.Property(user => user.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); builder.Property(user => user.Username) @@ -45,11 +45,11 @@ public class UserConfiguration : IEntityTypeConfiguration .HasDefaultValue(null) .HasColumnOrder(5); - // relationships + // Relationships. builder.HasMany(user => user.Libraries) .WithOne(library => library.User) .HasForeignKey(library => library.UserId) - .IsRequired() // a library must have a user + .IsRequired() // A library must have a user. .OnDelete(DeleteBehavior.Cascade); builder.HasOne(user => user.UserRole) @@ -63,7 +63,7 @@ public class UserConfiguration : IEntityTypeConfiguration .HasForeignKey(userPermission => userPermission.UserId) .OnDelete(DeleteBehavior.Cascade); - // audit + // Audit. builder.Property(user => user.CreatedOnUtc) .IsRequired() .HasColumnOrder(6); @@ -80,8 +80,8 @@ public class UserConfiguration : IEntityTypeConfiguration .HasDefaultValue(null) .HasColumnOrder(9); - // indexes + // Indexes. builder.HasIndex(user => user.Username) - .IsUnique(); // queried frequently + .IsUnique(); // Queried frequently. } } diff --git a/src/Lumina.DataAccess/Common/Configuration/UserPermissionConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserPermissionConfiguration.cs index deebadf0..6514285f 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserPermissionConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserPermissionConfiguration.cs @@ -19,26 +19,26 @@ public class UserPermissionConfiguration : IEntityTypeConfiguration new { userPermission.UserId, userPermission.PermissionId }); - builder.Ignore(userPermission => userPermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id + builder.Ignore(userPermission => userPermission.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id. - // foreign key: User + // Foreign key: User. builder.HasOne(userPermission => userPermission.User) .WithMany(user => user.UserPermissions) .HasForeignKey(userPermission => userPermission.UserId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserPermissions + .OnDelete(DeleteBehavior.Cascade); // Deleting a User deletes associated UserPermissions. - // foreign key: Permission + // Foreign key: Permission. builder.HasOne(userPermission => userPermission.Permission) .WithMany(role => role.UserPermissions) .HasForeignKey(userPermission => userPermission.PermissionId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a Permission deletes associated UserPermissions + .OnDelete(DeleteBehavior.Cascade); // Deleting a Permission deletes associated UserPermissions. - // audit + // Audit. builder.Property(userPermission => userPermission.CreatedOnUtc) .IsRequired() .HasColumnOrder(1); @@ -55,7 +55,7 @@ public class UserPermissionConfiguration : IEntityTypeConfiguration new { userRole.UserId, userRole.PermissionId }) .IsUnique(); } diff --git a/src/Lumina.DataAccess/Common/Configuration/UserRoleConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserRoleConfiguration.cs index bf639d51..298fb656 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserRoleConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserRoleConfiguration.cs @@ -19,26 +19,26 @@ public class UserRoleConfiguration : IEntityTypeConfiguration { builder.ToTable("UserRoles"); - // primary key + // Primary key. builder.HasKey(userRole => userRole.UserId ); - builder.Ignore(userRole => userRole.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id + builder.Ignore(userRole => userRole.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id. - // foreign key: User (one-to-one relationship) + // Foreign key: User (one-to-one relationship). builder.HasOne(userRole => userRole.User) .WithOne(user => user.UserRole) .HasForeignKey(userRole => userRole.UserId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserRole + .OnDelete(DeleteBehavior.Cascade); // Deleting a User deletes associated UserRole. - // foreign key: Role (many-to-one relationship) + // Foreign key: Role (many-to-one relationship). builder.HasOne(userRole => userRole.Role) .WithMany(role => role.UserRoles) .HasForeignKey(userRole => userRole.RoleId) .IsRequired() - .OnDelete(DeleteBehavior.Cascade); // deleting a Role deletes associated UserRoles + .OnDelete(DeleteBehavior.Cascade); // Deleting a Role deletes associated UserRoles. - // audit + // Audit. builder.Property(userRole => userRole.CreatedOnUtc) .IsRequired() .HasColumnOrder(1); @@ -55,7 +55,7 @@ public class UserRoleConfiguration : IEntityTypeConfiguration .HasDefaultValue(null) .HasColumnOrder(4); - // indexes + // Indexes. builder.HasIndex(userRole => new { userRole.UserId, userRole.RoleId }) .IsUnique(); } diff --git a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs index 864b310d..84851156 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs @@ -20,10 +20,10 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.Id); builder.Property(settings => settings.Id) - .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it + .ValueGeneratedNever() // Because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it. .HasColumnOrder(0); - // one user with one set of settings + // One user with one set of settings. builder.HasOne() .WithOne() .HasForeignKey(settings => settings.UserId) @@ -130,7 +130,7 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.CreatedOnUtc) .IsRequired() .HasColumnOrder(5); @@ -147,7 +147,7 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.UserId) .IsUnique(); } diff --git a/src/Lumina.DataAccess/Common/DependencyInjection/DataAccessLayerServices.cs b/src/Lumina.DataAccess/Common/DependencyInjection/DataAccessLayerServices.cs index 8581aeaa..7142a94c 100644 --- a/src/Lumina.DataAccess/Common/DependencyInjection/DataAccessLayerServices.cs +++ b/src/Lumina.DataAccess/Common/DependencyInjection/DataAccessLayerServices.cs @@ -15,7 +15,7 @@ using System.Reflection; namespace Lumina.DataAccess.Common.DependencyInjection; /// -/// Utility class for registering the services of the Data Access layer into the Dependency Injection container.. +/// Utility class for registering the services of the Data Access layer into the Dependency Injection container. /// [ExcludeFromCodeCoverage] public static class DataAccessLayerServices diff --git a/src/Lumina.DataAccess/Common/Interceptors/UpdateAuditableEntitiesInterceptor.cs b/src/Lumina.DataAccess/Common/Interceptors/UpdateAuditableEntitiesInterceptor.cs index 8c405acc..695a7f0b 100644 --- a/src/Lumina.DataAccess/Common/Interceptors/UpdateAuditableEntitiesInterceptor.cs +++ b/src/Lumina.DataAccess/Common/Interceptors/UpdateAuditableEntitiesInterceptor.cs @@ -68,7 +68,7 @@ public sealed class UpdateAuditableEntitiesInterceptor : SaveChangesInterceptor Guid? userId = _currentUserService.UserId; DateTime utcNow = _dateTimeProvider.UtcNow; - // retrieve all entities implementing IAuditableEntity that are being tracked and have either Added or Modified state + // Retrieve all entities implementing IAuditableEntity that are being tracked and have either Added or Modified state. foreach (EntityEntry entry in context.ChangeTracker.Entries()) { if (entry.State == EntityState.Added) @@ -100,12 +100,12 @@ public sealed class UpdateAuditableEntitiesInterceptor : SaveChangesInterceptor /// The current UTC timestamp. private static void SetModificationProperties(EntityEntry entry, Guid? userId, DateTime utcNow) { - // prevent modification of creation properties + // Prevent modification of creation properties. entry.Property(auditableEntity => auditableEntity.CreatedOnUtc).IsModified = false; entry.Property(auditableEntity => auditableEntity.CreatedBy).IsModified = false; - // set modification properties + // Set modification properties. entry.Entity.UpdatedOnUtc = utcNow; - entry.Entity.UpdatedBy = userId ?? Guid.Parse("11111111-1111-1111-1111-111111111111"); // "SYSTEM" user Id + entry.Entity.UpdatedBy = userId ?? Guid.Parse("11111111-1111-1111-1111-111111111111"); // "SYSTEM" user Id. } } diff --git a/src/Lumina.DataAccess/Common/Migrations/20260826204815_AddsIndependentMetadataAndArtworkEnrichment.cs b/src/Lumina.DataAccess/Common/Migrations/20260826204815_AddsIndependentMetadataAndArtworkEnrichment.cs index a5733aab..5bad5c11 100644 --- a/src/Lumina.DataAccess/Common/Migrations/20260826204815_AddsIndependentMetadataAndArtworkEnrichment.cs +++ b/src/Lumina.DataAccess/Common/Migrations/20260826204815_AddsIndependentMetadataAndArtworkEnrichment.cs @@ -98,8 +98,8 @@ namespace Lumina.DataAccess.Common.Migrations onDelete: ReferentialAction.Cascade); }); - // backfill the artwork of the books that already had a cover, so that the stored covers are preserved as enriched cover artwork - // before the CoverImagePath column is dropped + // Backfill the artwork of the books that already had a cover, so that the stored covers are preserved as enriched cover artwork + // before the CoverImagePath column is dropped. migrationBuilder.Sql(""" INSERT INTO BookArtwork (Id, BookId, ArtworkType, Ordinal, FileName, ContentHash, Status, Provider, LastUpdateUtc, CreatedOnUtc, CreatedBy, UpdatedOnUtc, UpdatedBy) SELECT lower(hex(randomblob(16))), Id, 'Cover', 0, CoverImagePath, 0, 'Enriched', NULL, NULL, datetime('now'), '00000000-0000-0000-0000-000000000000', NULL, NULL diff --git a/src/Lumina.DataAccess/Core/Repositories/Libraries/DirectoryScanFingerprintRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Libraries/DirectoryScanFingerprintRepository.cs index 1a45a198..995ca869 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Libraries/DirectoryScanFingerprintRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Libraries/DirectoryScanFingerprintRepository.cs @@ -22,7 +22,7 @@ namespace Lumina.DataAccess.Core.Repositories.Libraries; /// internal sealed class DirectoryScanFingerprintRepository : IDirectoryScanFingerprintRepository { - private const int UPSERT_BATCH_SIZE = 500; // keeps the number of bound parameters of a single UPSERT statement well under the SQLite parameter limit + private const int UPSERT_BATCH_SIZE = 500; // Keeps the number of bound parameters of a single UPSERT statement well under the SQLite parameter limit. private readonly LuminaDbContext _luminaDbContext; /// @@ -63,14 +63,14 @@ internal sealed class DirectoryScanFingerprintRepository : IDirectoryScanFingerp /// An representing either a successful operation, or an error. public async Task> UpsertRangeAsync(IReadOnlyCollection entities, CancellationToken cancellationToken) { - // nothing to upsert for an empty collection + // Nothing to upsert for an empty collection. if (entities.Count == 0) return Result.Updated; await using SqliteConnection connection = await OpenConnectionAsync(cancellationToken).ConfigureAwait(false); await using DbTransaction transaction = await connection.BeginTransactionAsync(cancellationToken); List remainingEntities = [.. entities]; - // upsert the entities in batches, to keep the number of bound parameters of a single UPSERT statement under the SQLite parameter limit + // Upsert the entities in batches, to keep the number of bound parameters of a single UPSERT statement under the SQLite parameter limit. while (remainingEntities.Count > 0) { cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanSnapshotRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanSnapshotRepository.cs index 8a054f7c..b3975dd5 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanSnapshotRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanSnapshotRepository.cs @@ -103,10 +103,10 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi DateTime nowUtc = DateTime.UtcNow; object parameters = new { libraryId, scanId, userId, nowUtc }; - // the Id of the inserted rows is generated in SQL as a random 16 byte value formatted as upper case hex (hex(randomblob(16))), which the storage layer parses as a Guid; - // generating the Ids in code would defeat the purpose of these single statement bulk inserts + // The Id of the inserted rows is generated in SQL as a random 16 byte value formatted as upper case hex (hex(randomblob(16))), which the storage layer parses as a Guid; + // generating the Ids in code would defeat the purpose of these single statement bulk inserts. - // add an audit entry for every media library scan snapshot item that is no longer present in the current scan, meaning it was deleted from the storage medium + // Add an audit entry for every media library scan snapshot item that is no longer present in the current scan, meaning it was deleted from the storage medium. const string AUDIT_DELETED_SQL = """ INSERT INTO LibraryScanResults (Id, LibraryScanId, Status, Path, ContentHash, FileSize, Ticks) SELECT hex(randomblob(16)), @scanId, 'Deleted', snapshot.Path, snapshot.ContentHash, snapshot.FileSize, snapshot.Ticks @@ -124,7 +124,7 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi await connection.ExecuteAsync(command).ConfigureAwait(false); - // add an audit entry for every new or changed media library scan staging result + // Add an audit entry for every new or changed media library scan staging result. const string AUDIT_CHANGED_SQL = """ INSERT INTO LibraryScanResults (Id, LibraryScanId, Status, Path, ContentHash, FileSize, Ticks) SELECT hex(randomblob(16)), @scanId, CASE WHEN staging.IsNew = 1 THEN 'New' ELSE 'Modified' END, staging.Path, staging.ContentHash, staging.Size, staging.Ticks @@ -137,7 +137,7 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi await connection.ExecuteAsync(command).ConfigureAwait(false); - // delete the media library scan snapshot items that are no longer present in the current scan, meaning they were deleted from the storage medium + // Delete the media library scan snapshot items that are no longer present in the current scan, meaning they were deleted from the storage medium. const string DELETE_MISSING_SQL = """ DELETE FROM LibraryScanSnapshots WHERE LibraryId = @libraryId @@ -153,7 +153,7 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi await connection.ExecuteAsync(command).ConfigureAwait(false); - // upsert the new and changed media library scan staging results into the media library scan snapshot + // Upsert the new and changed media library scan staging results into the media library scan snapshot. const string UPSERT_SQL = """ INSERT INTO LibraryScanSnapshots (Id, LibraryId, Path, ContentHash, FileSize, Ticks, CreatedOnUtc, CreatedBy, UpdatedOnUtc, UpdatedBy) SELECT hex(randomblob(16)), @libraryId, staging.Path, staging.ContentHash, staging.Size, staging.Ticks, @nowUtc, @userId, NULL, NULL @@ -172,7 +172,7 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi await connection.ExecuteAsync(command).ConfigureAwait(false); - // clear the staging results of the current scan, as they have been fully applied to the media library scan snapshot + // Clear the staging results of the current scan, as they have been fully applied to the media library scan snapshot. const string CLEAR_STAGING_SQL = "DELETE FROM LibraryScanStagingResults WHERE LibraryScanId = @scanId;"; command = new(CLEAR_STAGING_SQL, parameters, transaction); diff --git a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanStagingResultsRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanStagingResultsRepository.cs index 8a4ddcef..522e23bc 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanStagingResultsRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryScanStagingResultsRepository.cs @@ -23,7 +23,7 @@ namespace Lumina.DataAccess.Core.Repositories.Libraries; /// internal sealed class LibraryScanStagingResultsRepository : ILibraryScanStagingResultsRepository { - private const int INSERT_BATCH_SIZE = 500; // keeps the number of bound parameters of a single INSERT statement well under the SQLite parameter limit + private const int INSERT_BATCH_SIZE = 500; // Keeps the number of bound parameters of a single INSERT statement well under the SQLite parameter limit. private readonly LuminaDbContext _luminaDbContext; /// @@ -43,14 +43,14 @@ internal sealed class LibraryScanStagingResultsRepository : ILibraryScanStagingR /// An representing either a successful operation, or an error. public async Task> InsertRangeAsync(IReadOnlyCollection entities, CancellationToken cancellationToken) { - // nothing to insert for an empty collection + // Nothing to insert for an empty collection. if (entities.Count == 0) return Result.Created; await using SqliteConnection connection = await OpenConnectionAsync(cancellationToken).ConfigureAwait(false); await using DbTransaction transaction = await connection.BeginTransactionAsync(cancellationToken); List remainingEntities = [.. entities]; - // insert the entities in batches, to keep the number of bound parameters of a single INSERT statement under the SQLite parameter limit + // Insert the entities in batches, to keep the number of bound parameters of a single INSERT statement under the SQLite parameter limit. while (remainingEntities.Count > 0) { cancellationToken.ThrowIfCancellationRequested(); @@ -73,8 +73,8 @@ internal sealed class LibraryScanStagingResultsRepository : ILibraryScanStagingR public async Task> MarkChangesAgainstSnapshotAsync(Guid scanId, Guid libraryId, CancellationToken cancellationToken) { await using SqliteConnection connection = await OpenConnectionAsync(cancellationToken).ConfigureAwait(false); - // compare the discovered file system items against the media library scan snapshot of the previous scan, entirely in the database, so that the snapshot never needs to be loaded into memory: - // an item with no snapshot entry is new, an item with the same size and last write time is unchanged and keeps the stored hash, and everything else changed and needs its content hashed again + // Compare the discovered file system items against the media library scan snapshot of the previous scan, entirely in the database, so that the snapshot never needs to be loaded into memory: + // An item with no snapshot entry is new, an item with the same size and last write time is unchanged and keeps the stored hash, and everything else changed and needs its content hashed again. const string MARK_CHANGES_SQL = """ UPDATE LibraryScanStagingResults AS staging SET ContentHash = COALESCE(snapshot.ContentHash, 0), diff --git a/src/Lumina.DataAccess/Core/Repositories/MediaContributors/MediaContributorRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MediaContributors/MediaContributorRepository.cs index ffac00b5..93fa1f78 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MediaContributors/MediaContributorRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MediaContributors/MediaContributorRepository.cs @@ -65,7 +65,7 @@ internal sealed class MediaContributorRepository : IMediaContributorRepository /// An containing either the existing or newly created , or an error. public async Task> FindOrCreateByDisplayNameAsync(string displayName, string? legalName, CancellationToken cancellationToken) { - // the comparison is case-insensitive, so that "Stephen King" and "stephen king" are never treated as distinct contributors + // The comparison is case-insensitive, so that "Stephen King" and "stephen king" are never treated as distinct contributors. string normalizedDisplayName = displayName.ToLowerInvariant(); // Contributors added earlier in the same unit of work are not returned by a database query, so the change tracker is consulted diff --git a/src/Lumina.DataAccess/Core/Repositories/Playlists/PlaylistRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Playlists/PlaylistRepository.cs index e05a2f0f..1dfec583 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Playlists/PlaylistRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Playlists/PlaylistRepository.cs @@ -997,7 +997,7 @@ internal sealed class PlaylistRepository : IPlaylistRepository /// for a unique constraint violation, otherwise. private static bool IsUniqueConstraintViolation(SqliteException exception) { - return exception.SqliteExtendedErrorCode == 2067; // SQLITE_CONSTRAINT_UNIQUE + return exception.SqliteExtendedErrorCode == 2067; // SQLITE_CONSTRAINT_UNIQUE. } /// @@ -1007,7 +1007,7 @@ internal sealed class PlaylistRepository : IPlaylistRepository /// for a busy or locked database, otherwise. private static bool IsConcurrencyConflict(SqliteException exception) { - return exception.SqliteErrorCode is 5 or 6; // SQLITE_BUSY, SQLITE_LOCKED + return exception.SqliteErrorCode is 5 or 6; // SQLITE_BUSY, SQLITE_LOCKED. } /// diff --git a/src/Lumina.DataAccess/Core/Repositories/Plugins/ArtworkProviderConfigurationRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Plugins/ArtworkProviderConfigurationRepository.cs index 8a98dfeb..449ca81f 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Plugins/ArtworkProviderConfigurationRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Plugins/ArtworkProviderConfigurationRepository.cs @@ -69,7 +69,7 @@ internal sealed class ArtworkProviderConfigurationRepository : IArtworkProviderC _luminaDbContext.LibraryArtworkProviderConfigurations.Add(configuration); else { - // update only the mutable fields, preserving the Id of the existing configuration + // Update only the mutable fields, preserving the Id of the existing configuration. existingConfiguration.LibraryId = configuration.LibraryId; existingConfiguration.PluginId = configuration.PluginId; existingConfiguration.IsEnabled = configuration.IsEnabled; diff --git a/src/Lumina.DataAccess/Core/Repositories/Plugins/LibraryMetadataProviderConfigurationRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Plugins/LibraryMetadataProviderConfigurationRepository.cs index eb54e47d..e575f014 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Plugins/LibraryMetadataProviderConfigurationRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Plugins/LibraryMetadataProviderConfigurationRepository.cs @@ -69,7 +69,7 @@ internal sealed class LibraryMetadataProviderConfigurationRepository : ILibraryM _luminaDbContext.LibraryMetadataProviderConfigurations.Add(configuration); else { - // update only the mutable fields, preserving the Id of the existing configuration + // Update only the mutable fields, preserving the Id of the existing configuration. existingConfiguration.LibraryId = configuration.LibraryId; existingConfiguration.PluginId = configuration.PluginId; existingConfiguration.IsEnabled = configuration.IsEnabled; diff --git a/src/Lumina.DataAccess/Core/UoW/UnitOfWork.cs b/src/Lumina.DataAccess/Core/UoW/UnitOfWork.cs index ee5d81a3..dfa06347 100644 --- a/src/Lumina.DataAccess/Core/UoW/UnitOfWork.cs +++ b/src/Lumina.DataAccess/Core/UoW/UnitOfWork.cs @@ -503,7 +503,7 @@ public class UnitOfWork : IUnitOfWork, IDisposable { // SQLite reports a generic constraint failure code for several constraints, so the extended code is used to tell a unique violation apart. return exception.InnerException is SqliteException sqliteException - && sqliteException.SqliteExtendedErrorCode == 2067; // SQLITE_CONSTRAINT_UNIQUE + && sqliteException.SqliteExtendedErrorCode == 2067; // SQLITE_CONSTRAINT_UNIQUE. } /// @@ -523,7 +523,7 @@ public class UnitOfWork : IUnitOfWork, IDisposable /// if the database is busy or locked, otherwise. private static bool IsSqliteBusyOrLocked(SqliteException exception) { - return exception.SqliteErrorCode is 5 or 6; // SQLITE_BUSY, SQLITE_LOCKED + return exception.SqliteErrorCode is 5 or 6; // SQLITE_BUSY, SQLITE_LOCKED. } /// diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/IsbnFormat.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/IsbnFormat.cs index 436e9f02..3203b942 100644 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/IsbnFormat.cs +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/IsbnFormat.cs @@ -7,13 +7,13 @@ public enum IsbnFormat { /// /// The 10-digit ISBN format used for books published before 2007. - /// Example: 0-306-40615-2 + /// Example: 0-306-40615-2. /// Isbn10, /// /// The 13-digit ISBN format introduced in 2007, now the standard for all new books. - /// Example: 978-0-306-40615-7 + /// Example: 978-0-306-40615-7. /// Isbn13 } diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/Common/SortOrder.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/Common/SortOrder.cs index e8024a7b..6c5037c2 100644 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/Common/SortOrder.cs +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/Common/SortOrder.cs @@ -1,7 +1,7 @@ namespace Lumina.Domain.SharedKernel.Common.Enums.Common; /// -/// Enumeration for the sort order +/// Enumeration for the sort order. /// public enum SortOrder { diff --git a/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs b/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs index a3347b08..a8b8785b 100644 --- a/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs +++ b/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs @@ -42,7 +42,7 @@ public class ReleaseInfo : ValueObject public Optional ReleaseCountry { get; } /// - /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0") + /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0"). /// public Optional ReleaseVersion { get; } diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Album.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Album.cs index 2ed88cf1..07dde681 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Album.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Album.cs @@ -214,7 +214,7 @@ public sealed class Album : Entity contributors, ratings, tracks, - DateTime.UtcNow, // TODO: should be IDateTimeProvider + DateTime.UtcNow, // TODO: should be IDateTimeProvider. Optional.None()); } @@ -315,7 +315,7 @@ public sealed class Album : Entity /// The media contributors of the album. internal void UpdateContributors(IReadOnlyCollection contributors) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _contributors.Clear(); _contributors.AddRange(contributors); } @@ -326,7 +326,7 @@ public sealed class Album : Entity /// The ratings of the album. internal void UpdateRatings(IReadOnlyCollection ratings) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _ratings.Clear(); _ratings.AddRange(ratings); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs index 196f5276..62f00c4c 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs @@ -226,7 +226,7 @@ public sealed class Track : Entity musicBrainzTrackId, contributors, ratings, - DateTime.UtcNow, // TODO: should be IDateTimeProvider + DateTime.UtcNow, // TODO: should be IDateTimeProvider. Optional.None()); } @@ -304,7 +304,7 @@ public sealed class Track : Entity /// The moods of the track. internal void UpdateMoods(IReadOnlyCollection moods) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _moods.Clear(); _moods.AddRange(moods); } @@ -315,7 +315,7 @@ public sealed class Track : Entity /// The ISRCs of the track. internal void UpdateIsrcs(IReadOnlyCollection isrcs) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _isrcs.Clear(); _isrcs.AddRange(isrcs); } @@ -326,7 +326,7 @@ public sealed class Track : Entity /// The media contributors of the track. internal void UpdateContributors(IReadOnlyCollection contributors) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _contributors.Clear(); _contributors.AddRange(contributors); } @@ -337,7 +337,7 @@ public sealed class Track : Entity /// The ratings of the track. internal void UpdateRatings(IReadOnlyCollection ratings) { - // replace the contents of the collection in place, preserving the readonly reference invariants of the entity + // Replace the contents of the collection in place, preserving the readonly reference invariants of the entity. _ratings.Clear(); _ratings.AddRange(ratings); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs index ba433f40..92834db3 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs @@ -67,7 +67,7 @@ public sealed class File : FileSystemItem FileSystemItemStatus status = FileSystemItemStatus.Accessible, bool isHidden = false) { - // TODO: enforce invariants + // TODO: enforce invariants. Result createPathResult = FileSystemPathId.Create(path); if (createPathResult.IsFailure) return createPathResult.Errors; @@ -108,7 +108,7 @@ public sealed class File : FileSystemItem FileSystemItemStatus status = FileSystemItemStatus.Accessible, bool isHidden = false) { - // TODO: enforce invariants + // TODO: enforce invariants. File newFile = new( id, name, diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs index 01165f69..99d20985 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs @@ -45,7 +45,7 @@ public sealed class WindowsRootItem : FileSystemItem string name, FileSystemItemStatus status = FileSystemItemStatus.Accessible) { - // TODO: enforce invariants + // TODO: enforce invariants. Result createPathResult = FileSystemPathId.Create(path); if (createPathResult.IsFailure) return createPathResult.Errors; @@ -72,7 +72,7 @@ public sealed class WindowsRootItem : FileSystemItem string name, FileSystemItemStatus status = FileSystemItemStatus.Accessible) { - // TODO: enforce invariants + // TODO: enforce invariants. WindowsRootItem newFile = new( id, name); diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs index e248cf19..19466afa 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderService.cs @@ -136,7 +136,7 @@ internal class DirectoryProviderService : IDirectoryProviderService /// /// Creates a new directory with the specified name, at the specified path. /// - /// The path where the directory will be created.. + /// The path where the directory will be created. /// The name of the directory that will be created. /// An containing either the path of a created directory, or an error. public Result CreateDirectory(FileSystemPathId path, string name) diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemPermissionsService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemPermissionsService.cs index 8120b5a2..5bcf152f 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemPermissionsService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemPermissionsService.cs @@ -15,7 +15,7 @@ namespace Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext. /// /// Service for file system permissions. /// -internal class FileSystemPermissionsService : IFileSystemPermissionsService // TODO: Refactor towards abstractions that would allow testing. +internal class FileSystemPermissionsService : IFileSystemPermissionsService // TODO: refactor towards abstractions that would allow testing. { private readonly IPlatformContextManager _platformContextManager; @@ -41,9 +41,9 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T if (platformType == PlatformType.Unix) return CanAccessPathUnix(path.Path, accessMode); else if (platformType == PlatformType.Windows) -#pragma warning disable CA1416 // Validate platform compatibility +#pragma warning disable CA1416 // Validate platform compatibility. return CanAccessPathWindows(path.Path, accessMode, isFile); -#pragma warning restore CA1416 // Validate platform compatibility +#pragma warning restore CA1416 // Validate platform compatibility. else throw new PlatformNotSupportedException("Support for this platform is not compiled into this assembly."); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeService.cs index b6f3fd9f..e366b8e7 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeService.cs @@ -22,7 +22,7 @@ public class FileTypeService : IFileTypeService { private readonly IFileSystem _fileSystem; private readonly IFileSystemPermissionsService _fileSystemPermissionsService; - private const int BUFFER_SIZE = 18; // 18 bytes should be more than enough for common images header types + private const int BUFFER_SIZE = 18; // 18 bytes should be more than enough for common images header types. /// /// Initializes a new instance of the class. @@ -96,9 +96,9 @@ public class FileTypeService : IFileTypeService // Read more content from the file. using FileSystemStream stream = _fileSystem.FileStream.New(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); byte[] svgBuffer = new byte[1000]; -#pragma warning disable CA2022 // Avoid inexact read with 'Stream.Read' +#pragma warning disable CA2022 // Avoid inexact read with 'Stream.Read'. stream.Read(svgBuffer, 0, 1000); -#pragma warning restore CA2022 // Avoid inexact read with 'Stream.Read' +#pragma warning restore CA2022 // Avoid inexact read with 'Stream.Read'. string extendedContent = Encoding.UTF8.GetString(svgBuffer); // Check if the extended content contains /// Returns a collection of characters that are invalid for paths. /// - /// A collection of characters that are invalid in the context of paths + /// A collection of characters that are invalid in the context of paths. char[] GetInvalidPathCharsForPlatform(); /// diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs index 95b733fc..5f3d7344 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs @@ -314,7 +314,7 @@ public class Library : AggregateRoot if (!_domainEvents.Any(domainEvent => domainEvent is LibraryDeletedDomainEvent)) _domainEvents.Add(new LibraryDeletedDomainEvent(Guid.NewGuid(), this, DateTime.UtcNow)); - // TODO: Perhaps trigger events for removing content related to the removed library (media metadata, etc.). + // TODO: perhaps trigger events for removing content related to the removed library (media metadata, etc.). return Result.Deleted; } } diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPart.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPart.cs index 7ba12252..68069c3f 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPart.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPart.cs @@ -64,14 +64,14 @@ public class LibraryPathPart : ValueObject /// public static Result Create(LibraryPathPartKind kind, string? representation, bool isOptional) { - // a separator carries no representation, it always renders the platform path separator. + // A separator carries no representation, it always renders the platform path separator. if (kind == LibraryPathPartKind.Separator) return new LibraryPathPart(kind, string.Empty, isOptional); if (string.IsNullOrWhiteSpace(representation)) return DomainErrors.Library.PathTemplateLiteralCannotBeEmpty; - // typed parts must carry exactly one value placeholder, so that the position of the captured value is unambiguous. + // Typed parts must carry exactly one value placeholder, so that the position of the captured value is unambiguous. if (kind != LibraryPathPartKind.Literal && s_placeholderRegex.Matches(representation).Count != 1) return DomainErrors.Library.PathTemplateValuePartMustContainSinglePlaceholder; diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/Jobs/MediaLibraryScanJobFactory.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/Jobs/MediaLibraryScanJobFactory.cs index bf7135bb..3639154c 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/Jobs/MediaLibraryScanJobFactory.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/Jobs/MediaLibraryScanJobFactory.cs @@ -31,7 +31,7 @@ internal class MediaLibraryScanJobFactory : IMediaLibraryScanJobFactory /// Thrown when the type of the requested media library scan job has not been registered. public TJob CreateJob(LibraryId libraryId) where TJob : IMediaLibraryScanJob { - // resolve the job from DI + // Resolve the job from DI. TJob job = _serviceProvider.GetRequiredService() ?? throw new ArgumentException("Job type not registered in the DI system."); job.LibraryId = libraryId; return job; diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/ParsedLibraryPath.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/ParsedLibraryPath.cs index a71096c1..010c6f20 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/ParsedLibraryPath.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/ParsedLibraryPath.cs @@ -79,7 +79,7 @@ public class ParsedLibraryPath : ValueObject /// A list of items defining the equality. public override IEnumerable GetEqualityComponents() { - // the captured values are stored in a dictionary, so they are ordered by their kind to keep equality independent of insertion order. + // The captured values are stored in a dictionary, so they are ordered by their kind to keep equality independent of insertion order. foreach (KeyValuePair capturedValue in _values.OrderBy(capturedValue => capturedValue.Key)) { yield return capturedValue.Key; diff --git a/src/Lumina.Domain/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorId.cs b/src/Lumina.Domain/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorId.cs index 178c7c76..3c4b7a2a 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorId.cs @@ -25,7 +25,7 @@ public sealed class MediaContributorId : EntityId /// The created instance. public static MediaContributorId CreateUnique() { - // TODO: enforce invariants + // TODO: enforce invariants. return new MediaContributorId(Guid.NewGuid()); } @@ -36,7 +36,7 @@ public sealed class MediaContributorId : EntityId /// The created instance. public static MediaContributorId Create(Guid value) { - // TODO: enforce invariants + // TODO: enforce invariants. return new MediaContributorId(value); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/Movie.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/Movie.cs index c2160a53..b6bcf0b6 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/Movie.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/Movie.cs @@ -58,7 +58,7 @@ public sealed class Movie : Entity /// The created . public static Result Create(VideoMetadata metadata, List contributors, List ratings) { - // TODO: enforce invariants + // TODO: enforce invariants. return new Movie(MovieId.CreateUnique(), metadata, contributors, ratings); } @@ -72,7 +72,7 @@ public sealed class Movie : Entity /// The created . public static Result Create(MovieId id, VideoMetadata metadata, List contributors, List ratings) { - // TODO: enforce invariants + // TODO: enforce invariants. return new Movie(id, metadata, contributors, ratings); } } diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/MovieId.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/MovieId.cs index 6dea195c..9ee09dd2 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/MovieId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/MovieId.cs @@ -27,7 +27,7 @@ public sealed class MovieId : EntityId /// The created instance. public static MovieId CreateUnique() { - // TODO: enforce invariants + // TODO: enforce invariants. return new MovieId(Guid.NewGuid()); } @@ -38,7 +38,7 @@ public sealed class MovieId : EntityId /// The created instance. public static MovieId Create(Guid value) { - // TODO: enforce invariants + // TODO: enforce invariants. return new MovieId(value); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/EpisodeId.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/EpisodeId.cs index 7cf86b24..8d24259a 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/EpisodeId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/EpisodeId.cs @@ -25,7 +25,7 @@ public sealed class EpisodeId : EntityId /// The created instance. public static EpisodeId CreateUnique() { - // TODO: enforce invariants + // TODO: enforce invariants. return new EpisodeId(Guid.NewGuid()); } @@ -36,7 +36,7 @@ public sealed class EpisodeId : EntityId /// The created instance. public static EpisodeId Create(Guid value) { - // TODO: enforce invariants + // TODO: enforce invariants. return new EpisodeId(value); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/SeasonId.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/SeasonId.cs index 19112a16..a8796c2d 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/SeasonId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/SeasonId.cs @@ -25,7 +25,7 @@ public sealed class SeasonId : EntityId /// The created instance. public static SeasonId CreateUnique() { - // TODO: enforce invariants + // TODO: enforce invariants. return new SeasonId(Guid.NewGuid()); } @@ -36,7 +36,7 @@ public sealed class SeasonId : EntityId /// The created instance. public static SeasonId Create(Guid value) { - // TODO: enforce invariants + // TODO: enforce invariants. return new SeasonId(value); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/TvShowId.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/TvShowId.cs index 1374dcea..4de48b35 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/TvShowId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/TvShowLibraryAggregate/ValueObjects/TvShowId.cs @@ -25,7 +25,7 @@ public sealed class TvShowId : EntityId /// The created instance. public static TvShowId CreateUnique() { - // TODO: enforce invariants + // TODO: enforce invariants. return new TvShowId(Guid.NewGuid()); } @@ -36,7 +36,7 @@ public sealed class TvShowId : EntityId /// The created instance. public static TvShowId Create(Guid value) { - // TODO: enforce invariants + // TODO: enforce invariants. return new TvShowId(value); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs index 80245f37..5513e01d 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs @@ -64,7 +64,7 @@ public sealed class BookSeries : Entity bool isComplete, List books) { - // TODO: enforce invariants + // TODO: enforce invariants. return new BookSeries( id, metadata, @@ -87,7 +87,7 @@ public sealed class BookSeries : Entity bool isComplete, List books) { - // TODO: enforce invariants + // TODO: enforce invariants. return new BookSeries( BookSeriesId.CreateUnique(), metadata, diff --git a/src/Lumina.Infrastructure/Common/DependencyInjection/SharedConfiguration.cs b/src/Lumina.Infrastructure/Common/DependencyInjection/SharedConfiguration.cs index ce2327d0..f48c4451 100644 --- a/src/Lumina.Infrastructure/Common/DependencyInjection/SharedConfiguration.cs +++ b/src/Lumina.Infrastructure/Common/DependencyInjection/SharedConfiguration.cs @@ -32,9 +32,9 @@ public static class SharedConfiguration configuration.SetBasePath(basePath); configuration.AddJsonFile("appsettings.shared.json", optional: false, reloadOnChange: true); configuration.AddJsonFile("appsettings.shared.development.json", optional: true, reloadOnChange: true); - configuration.AddEnvironmentVariables(); // environment variables should override the configuration files + configuration.AddEnvironmentVariables(); // Environment variables should override the configuration files. - // bind the appsettings sections + // Bind the appsettings sections. services.AddOptions() .Bind(configuration.GetRequiredSection(DatabaseSettingsDto.SECTION_NAME)) .ValidateFluently() diff --git a/src/Lumina.Infrastructure/Common/Utilities/ExceptionUtilities.cs b/src/Lumina.Infrastructure/Common/Utilities/ExceptionUtilities.cs index 95139811..7fc6b065 100644 --- a/src/Lumina.Infrastructure/Common/Utilities/ExceptionUtilities.cs +++ b/src/Lumina.Infrastructure/Common/Utilities/ExceptionUtilities.cs @@ -33,16 +33,16 @@ public static class ExceptionUtilities /// A list of exceptions representing the list of inner exception(s) of . public static IEnumerable GetInnerExceptions(this Exception exception, int maximumDepth = 5) { - // check if there are any more inner exceptions to return + // Check if there are any more inner exceptions to return. if (exception == null || maximumDepth <= 0) yield break; - // yield the current level exception itself + // Yield the current level exception itself. yield return exception; - // if the exception is an AggregateException, treat it differently and get its all exceptions + // If the exception is an AggregateException, treat it differently and get its all exceptions. if (exception is AggregateException aggregateException) foreach (Exception? innerException in aggregateException.InnerExceptions.SelectMany(innerException => innerException.GetInnerExceptions(maximumDepth - 1))) yield return innerException; - // if it's a normal exception, recursively get its list of inner exceptions and yield them + // If it's a normal exception, recursively get its list of inner exceptions and yield them. foreach (Exception innerException in exception.InnerException?.GetInnerExceptions(maximumDepth - 1) ?? []) yield return innerException; } diff --git a/src/Lumina.Infrastructure/Common/Utilities/OptionsBuilderValidationUtilities.cs b/src/Lumina.Infrastructure/Common/Utilities/OptionsBuilderValidationUtilities.cs index 1fdf407f..576c1407 100644 --- a/src/Lumina.Infrastructure/Common/Utilities/OptionsBuilderValidationUtilities.cs +++ b/src/Lumina.Infrastructure/Common/Utilities/OptionsBuilderValidationUtilities.cs @@ -23,7 +23,7 @@ public static class OptionsBuilderValidationUtilities /// The same instance, to allow for chaining. public static OptionsBuilder ValidateFluently(this OptionsBuilder optionsBuilder) where TOptions : class { - // register a singleton instance of IValidateOptions using the validator + // Register a singleton instance of IValidateOptions using the validator. optionsBuilder.Services.AddSingleton>( serviceProvider => new ValidationOptions(optionsBuilder.Name, serviceProvider.GetRequiredService>())); return optionsBuilder; diff --git a/src/Lumina.Infrastructure/Common/Validation/ValidationOptions.cs b/src/Lumina.Infrastructure/Common/Validation/ValidationOptions.cs index e6a87a75..eabe7153 100644 --- a/src/Lumina.Infrastructure/Common/Validation/ValidationOptions.cs +++ b/src/Lumina.Infrastructure/Common/Validation/ValidationOptions.cs @@ -41,22 +41,22 @@ public class ValidationOptions : IValidateOptions where TOpt /// A that indicates whether the validation was successful or not. public ValidateOptionsResult Validate(string? name, TOptions options) { - // check if the name of the options is specified and matches the provided one + // Check if the name of the options is specified and matches the provided one. if (Name is not null && Name != name) return ValidateOptionsResult.Skip; - ArgumentNullException.ThrowIfNull(options, nameof(options)); // don't go further if the options are null + ArgumentNullException.ThrowIfNull(options, nameof(options)); // Don't go further if the options are null. - List validationResult = _validator.Validate(options); // validate the options using the validator + List validationResult = _validator.Validate(options); // Validate the options using the validator. - // return a response based on the validation result + // Return a response based on the validation result. if (validationResult.Count == 0) return ValidateOptionsResult.Success; - // if the validation fails, collect the error messages + // If the validation fails, collect the error messages. string[] errors = [.. validationResult.Select(error => $"Options validation failed for '{error.Code}' with error: '{error.Description}'")]; - // and return them with a failure result + // And return them with a failure result. return ValidateOptionsResult.Fail(errors); } } diff --git a/src/Lumina.Infrastructure/Common/Validators/CorsSettingsDtoValidator.cs b/src/Lumina.Infrastructure/Common/Validators/CorsSettingsDtoValidator.cs index c30a6e07..734383d7 100644 --- a/src/Lumina.Infrastructure/Common/Validators/CorsSettingsDtoValidator.cs +++ b/src/Lumina.Infrastructure/Common/Validators/CorsSettingsDtoValidator.cs @@ -36,7 +36,7 @@ public class CorsSettingsDtoValidator : AbstractValidator private bool BeValidOrigin(string origin) { if (origin == "*") - return true; // wildcard allowed without credentials + return true; // Wildcard allowed without credentials. return Uri.TryCreate(origin, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) && !origin.EndsWith('/'); } } diff --git a/src/Lumina.Infrastructure/Core/Authentication/JwtTokenGenerator.cs b/src/Lumina.Infrastructure/Core/Authentication/JwtTokenGenerator.cs index 17501a2f..6103fd93 100644 --- a/src/Lumina.Infrastructure/Core/Authentication/JwtTokenGenerator.cs +++ b/src/Lumina.Infrastructure/Core/Authentication/JwtTokenGenerator.cs @@ -38,7 +38,7 @@ public class JwtTokenGenerator : IJwtTokenGenerator /// The generated JWT token. public string GenerateToken(string id, string username) { - // use a symmetric key approach + // Use a symmetric key approach. SigningCredentials signingCredentials = new(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettingsModel.SecretKey)), SecurityAlgorithms.HmacSha256); Claim[] claims = [ diff --git a/src/Lumina.Infrastructure/Core/Authentication/QRCodeGenerator.cs b/src/Lumina.Infrastructure/Core/Authentication/QRCodeGenerator.cs index b192fbf7..9451dbbd 100644 --- a/src/Lumina.Infrastructure/Core/Authentication/QRCodeGenerator.cs +++ b/src/Lumina.Infrastructure/Core/Authentication/QRCodeGenerator.cs @@ -22,16 +22,16 @@ public class QRCodeGenerator : IQRCodeGenerator /// Data URI for the QR code. public string GenerateQrCodeDataUri(string username, byte[] secret) { - // convert secret to Base32 + // Convert secret to Base32. string base32Secret = Base32Encoding.ToString(secret); - // build the otpauth URI + // Build the otpauth URI. string otpauthString = $"otpauth://totp/{ISSUER}:{Uri.EscapeDataString(username)}?secret={base32Secret}&issuer={ISSUER}"; - // generate QR Code + // Generate QR Code. QRCoder.QRCodeGenerator qrGenerator = new(); QRCodeData qrData = qrGenerator.CreateQrCode(otpauthString, QRCoder.QRCodeGenerator.ECCLevel.Q); PngByteQRCode qrCode = new(qrData); - // convert QR Code to Data URI - byte[] pngBytes = qrCode.GetGraphic(20); // specify a pixel size if needed + // Convert QR Code to Data URI. + byte[] pngBytes = qrCode.GetGraphic(20); // Specify a pixel size if needed. string dataUri = "data:image/png;base64," + Convert.ToBase64String(pngBytes); return dataUri; } diff --git a/src/Lumina.Infrastructure/Core/Authentication/TokenGenerator.cs b/src/Lumina.Infrastructure/Core/Authentication/TokenGenerator.cs index d3fb139a..24dabe66 100644 --- a/src/Lumina.Infrastructure/Core/Authentication/TokenGenerator.cs +++ b/src/Lumina.Infrastructure/Core/Authentication/TokenGenerator.cs @@ -17,11 +17,11 @@ public class TokenGenerator : ITokenGenerator /// A secure token. public string GenerateToken() { - // allocate an array for the token data + // Allocate an array for the token data. byte[] tokenData = new byte[32]; - // fill the array with a cryptographically strong sequence of random values + // Fill the array with a cryptographically strong sequence of random values. RandomNumberGenerator.Fill(tokenData); - // convert to a Base64 string, but replace URL-unsafe characters '+' and '/' with '-' and '_', and remove padding characters ('=') + // Convert to a Base64 string, but replace URL-unsafe characters '+' and '/' with '-' and '_', and remove padding characters ('='). return Convert.ToBase64String(tokenData).Replace('+', '-').Replace('/', '_').TrimEnd('='); } } diff --git a/src/Lumina.Infrastructure/Core/Authentication/TotpTokenGenerator.cs b/src/Lumina.Infrastructure/Core/Authentication/TotpTokenGenerator.cs index 4bc8e8cc..2129b030 100644 --- a/src/Lumina.Infrastructure/Core/Authentication/TotpTokenGenerator.cs +++ b/src/Lumina.Infrastructure/Core/Authentication/TotpTokenGenerator.cs @@ -16,7 +16,7 @@ public class TotpTokenGenerator : ITotpTokenGenerator /// The generated TOTP secret. public byte[] GenerateSecret() { - return KeyGeneration.GenerateRandomKey(); // generate a random key for TOTP + return KeyGeneration.GenerateRandomKey(); // Generate a random key for TOTP. } /// @@ -28,7 +28,7 @@ public class TotpTokenGenerator : ITotpTokenGenerator public bool ValidateToken(byte[] secret, string token) { Totp totp = new(secret); - // verify the TOTP token, allowing for slight time drifts between server and client + // Verify the TOTP token, allowing for slight time drifts between server and client. return totp.VerifyTotp(token, out _, VerificationWindow.RfcSpecifiedNetworkDelay); } } diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationService.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationService.cs index 1ac540be..e81ff6ac 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationService.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationService.cs @@ -956,7 +956,7 @@ internal sealed class TrackNormalizationService : ITrackNormalizationService, ID FileInfo segmentFile = new(Path.Combine(temporaryPath, fileName)); decimal durationSeconds = endSeconds - startSeconds; - // ffmpeg can append a final segment whose time range is empty when the last frame ends exactly on a segment boundary. That segment is + // FFmpeg can append a final segment whose time range is empty when the last frame ends exactly on a segment boundary. That segment is // discarded after the list is sorted, but a zero duration anywhere else, or a missing or empty segment that is supposed to carry audio, is a malformed production. if (durationSeconds == 0) { diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Cancellation/MediaLibrariesScanCancellationTracker.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Cancellation/MediaLibrariesScanCancellationTracker.cs index e88b8eb5..3526d2d9 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Cancellation/MediaLibrariesScanCancellationTracker.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Cancellation/MediaLibrariesScanCancellationTracker.cs @@ -34,7 +34,7 @@ internal class MediaLibrariesScanCancellationTracker : IMediaLibrariesScanCancel if (_runningScans.TryGetValue(mediaLibraryScanCompositeId, out CancellationTokenSource? scan)) { scan.Cancel(); - // remove and dispose after cancellation + // Remove and dispose after cancellation. if (_runningScans.TryRemove(mediaLibraryScanCompositeId, out CancellationTokenSource? removedScan)) removedScan?.Dispose(); } @@ -61,7 +61,7 @@ internal class MediaLibrariesScanCancellationTracker : IMediaLibrariesScanCancel if (_runningScans.TryGetValue(mediaLibraryScanCompositeId, out CancellationTokenSource? scan)) { scan.Cancel(); - // remove and dispose after cancellation + // Remove and dispose after cancellation. if (_runningScans.TryRemove(mediaLibraryScanCompositeId, out CancellationTokenSource? removedScan)) removedScan?.Dispose(); } diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/WrittenContent/Books/BooksMediaLibraryScanMetadataEnricher.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/WrittenContent/Books/BooksMediaLibraryScanMetadataEnricher.cs index 4f204d21..b569ff8b 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/WrittenContent/Books/BooksMediaLibraryScanMetadataEnricher.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/WrittenContent/Books/BooksMediaLibraryScanMetadataEnricher.cs @@ -205,7 +205,7 @@ internal sealed class BooksMediaLibraryScanMetadataEnricher : IMediaLibraryScanM BookMetadataLookupDto bookMetadataLookup = new( LibraryId: bookEntity.LibraryId, Path: bookEntity.Path, - Isbn: bookEntity.ISBNs.Count > 0 ? bookEntity.ISBNs.Where(isbn => isbn.Value is not null).Select(isbn => isbn.Value!).First() : null, // TODO: This should not take just the first ISBN, it should ask the metadata plugin to retry with the next ISBN, if the first one returned no results. + Isbn: bookEntity.ISBNs.Count > 0 ? bookEntity.ISBNs.Where(isbn => isbn.Value is not null).Select(isbn => isbn.Value!).First() : null, // TODO: this should not take just the first ISBN, it should ask the metadata plugin to retry with the next ISBN, if the first one returned no results. OpenLibraryId: bookEntity.OpenLibraryId, Title: bookEntity.Title, Author: null, diff --git a/src/Lumina.Infrastructure/Core/Plugins/PluginInstaller.cs b/src/Lumina.Infrastructure/Core/Plugins/PluginInstaller.cs index 7e02ce87..57eb588f 100644 --- a/src/Lumina.Infrastructure/Core/Plugins/PluginInstaller.cs +++ b/src/Lumina.Infrastructure/Core/Plugins/PluginInstaller.cs @@ -20,7 +20,7 @@ namespace Lumina.Infrastructure.Core.Plugins; /// internal sealed class PluginInstaller : IPluginInstaller { - // the install mutates the shared plugins directory, so the operations are serialized per resolved directory. + // The install mutates the shared plugins directory, so the operations are serialized per resolved directory. // A per-instance gate is NOT enough: several hosts can run against the same plugins directory at once (for // example the parallel in-memory hosts started by the test factories), so the gate is keyed on the directory. private static readonly ConcurrentDictionary s_pluginDirectoryGates = new(StringComparer.Ordinal); diff --git a/src/Lumina.Infrastructure/Core/Plugins/PluginLoadContext.cs b/src/Lumina.Infrastructure/Core/Plugins/PluginLoadContext.cs index 40a123b6..6af89449 100644 --- a/src/Lumina.Infrastructure/Core/Plugins/PluginLoadContext.cs +++ b/src/Lumina.Infrastructure/Core/Plugins/PluginLoadContext.cs @@ -33,7 +33,7 @@ internal sealed class PluginLoadContext : AssemblyLoadContext if (assemblyName.Name is null) return null; - // try to resolve the assembly from the default context first, so that the plugin shares the host and framework assemblies + // Try to resolve the assembly from the default context first, so that the plugin shares the host and framework assemblies. try { return AssemblyLoadContext.Default.LoadFromAssemblyName(assemblyName); @@ -42,7 +42,7 @@ internal sealed class PluginLoadContext : AssemblyLoadContext { } - // fall back to resolving the assembly from the plugin directory + // Fall back to resolving the assembly from the plugin directory. string dependencyPath = Path.Combine(_pluginDirectory, assemblyName.Name + ".dll"); if (File.Exists(dependencyPath)) return LoadFromAssemblyPath(dependencyPath); diff --git a/src/Lumina.Infrastructure/Core/Security/CryptographyService.cs b/src/Lumina.Infrastructure/Core/Security/CryptographyService.cs index 18b7652e..03f8613f 100644 --- a/src/Lumina.Infrastructure/Core/Security/CryptographyService.cs +++ b/src/Lumina.Infrastructure/Core/Security/CryptographyService.cs @@ -37,7 +37,7 @@ public sealed class CryptographyService : ICryptographyService, IDisposable if (string.IsNullOrEmpty(plaintext)) throw new ArgumentException("Value cannot be null or empty", nameof(plaintext)); - // Generate a new, random 16-byte IV for each encryption to ensure unique ciphertexts + // Generate a new, random 16-byte IV for each encryption to ensure unique ciphertexts. byte[] iv = new byte[16]; using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) rng.GetBytes(iv); @@ -48,21 +48,21 @@ public sealed class CryptographyService : ICryptographyService, IDisposable aes.Mode = CipherMode.CBC; aes.Padding = PaddingMode.PKCS7; - // Encrypt the plaintext + // Encrypt the plaintext. using ICryptoTransform encryptor = aes.CreateEncryptor(); byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext); byte[] ciphertext = encryptor.TransformFinalBlock(plaintextBytes, 0, plaintextBytes.Length); - // Compute SHA-256 checksum of the plaintext + // Compute SHA-256 checksum of the plaintext. byte[] checksum = SHA256.HashData(plaintextBytes); - // Combine IV, ciphertext, and checksum + // Combine IV, ciphertext, and checksum. byte[] combined = new byte[iv.Length + ciphertext.Length + checksum.Length]; Buffer.BlockCopy(iv, 0, combined, 0, iv.Length); Buffer.BlockCopy(ciphertext, 0, combined, iv.Length, ciphertext.Length); Buffer.BlockCopy(checksum, 0, combined, iv.Length + ciphertext.Length, checksum.Length); - // Return the combined data as a Base64-encoded string + // Return the combined data as a Base64-encoded string. return Convert.ToBase64String(combined); } @@ -78,14 +78,14 @@ public sealed class CryptographyService : ICryptographyService, IDisposable if (string.IsNullOrEmpty(ciphertext)) throw new ArgumentException("Value cannot be null or empty", nameof(ciphertext)); - // Decode the combined data (IV + ciphertext + checksum) from Base64 + // Decode the combined data (IV + ciphertext + checksum) from Base64. byte[] combined = Convert.FromBase64String(ciphertext); - // Validate the minimum length (16 bytes for IV + 32 bytes for checksum) + // Validate the minimum length (16 bytes for IV + 32 bytes for checksum). if (combined.Length < 16 + 32) throw new ArgumentException("Invalid ciphertext"); - // Extract IV, ciphertext, and checksum from the combined data + // Extract IV, ciphertext, and checksum from the combined data. byte[] iv = new byte[16]; byte[] checksum = new byte[32]; byte[] encryptedData = new byte[combined.Length - 16 - 32]; @@ -100,18 +100,18 @@ public sealed class CryptographyService : ICryptographyService, IDisposable aes.Mode = CipherMode.CBC; aes.Padding = PaddingMode.PKCS7; - // Decrypt the encrypted data + // Decrypt the encrypted data. using ICryptoTransform decryptor = aes.CreateDecryptor(); byte[] decryptedBytes = decryptor.TransformFinalBlock(encryptedData, 0, encryptedData.Length); - // Compute the checksum of the decrypted data and validate against the provided checksum + // Compute the checksum of the decrypted data and validate against the provided checksum. byte[] computedChecksum = SHA256.HashData(decryptedBytes); - // If checksums do not match, throw a CryptographicException indicating potential corruption + // If checksums do not match, throw a CryptographicException indicating potential corruption. if (!computedChecksum.SequenceEqual(checksum)) throw new CryptographicException("Checksum validation failed. The data may be corrupted."); - // Return the decrypted plaintext as a UTF-8 string + // Return the decrypted plaintext as a UTF-8 string. return Encoding.UTF8.GetString(decryptedBytes); } diff --git a/src/Lumina.Infrastructure/Core/Security/PasswordHashService.cs b/src/Lumina.Infrastructure/Core/Security/PasswordHashService.cs index 7cc5233d..6e108c57 100644 --- a/src/Lumina.Infrastructure/Core/Security/PasswordHashService.cs +++ b/src/Lumina.Infrastructure/Core/Security/PasswordHashService.cs @@ -13,12 +13,12 @@ namespace Lumina.Infrastructure.Core.Security; /// public sealed class PasswordHashService : IPasswordHashService { - // OWASP recommended parameters for Argon2id - private const int MEMORY_SIZE = 19456; // 19 MiB (19 * 1024 = 19456) + // OWASP recommended parameters for Argon2id. + private const int MEMORY_SIZE = 19456; // 19 MiB (19 * 1024 = 19456). private const int ITERATIONS = 2; private const int DEGREE_OF_PARALLELISM = 1; - private const int HASH_SIZE = 32; // 256 bits - private const int SALT_SIZE = 16; // 128 bits + private const int HASH_SIZE = 32; // 256 bits. + private const int SALT_SIZE = 16; // 128 bits. /// /// Creates a hash from a string. @@ -29,7 +29,7 @@ public sealed class PasswordHashService : IPasswordHashService { byte[] salt = new byte[SALT_SIZE]; using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) - rng.GetBytes(salt); // generate a random salt + rng.GetBytes(salt); // Generate a random salt. byte[] hashBytes; using (Argon2id hasher = new(Encoding.UTF8.GetBytes(password))) @@ -40,7 +40,7 @@ public sealed class PasswordHashService : IPasswordHashService hasher.Iterations = ITERATIONS; hashBytes = hasher.GetBytes(HASH_SIZE); } - // concatenate salt and hash and return as a Base64 string + // Concatenate salt and hash and return as a Base64 string. byte[] hashWithSaltBytes = new byte[SALT_SIZE + HASH_SIZE]; Buffer.BlockCopy(salt, 0, hashWithSaltBytes, 0, SALT_SIZE); Buffer.BlockCopy(hashBytes, 0, hashWithSaltBytes, SALT_SIZE, HASH_SIZE); @@ -55,9 +55,9 @@ public sealed class PasswordHashService : IPasswordHashService /// if and the de-hashed versions of are equal, otherwise. public bool CheckStringAgainstHash(string password, string hashedPassword) { - // convert the Base64 string back into a byte array + // Convert the Base64 string back into a byte array. byte[] hashWithSaltBytes = Convert.FromBase64String(hashedPassword); - // validate the length too + // Validate the length too. if (hashWithSaltBytes.Length != SALT_SIZE + HASH_SIZE) return false; @@ -73,10 +73,10 @@ public sealed class PasswordHashService : IPasswordHashService hasher.Iterations = ITERATIONS; hashBytes = hasher.GetBytes(HASH_SIZE); } - // get the stored hash from the stored hashed password + // Get the stored hash from the stored hashed password. byte[] storedHashBytes = new byte[HASH_SIZE]; Buffer.BlockCopy(hashWithSaltBytes, SALT_SIZE, storedHashBytes, 0, HASH_SIZE); - // use constant-time comparison to prevent timing attacks + // Use constant-time comparison to prevent timing attacks. return CryptographicOperations.FixedTimeEquals(hashBytes, storedHashBytes); } } diff --git a/src/Lumina.Infrastructure/Core/Themes/ThemeService.cs b/src/Lumina.Infrastructure/Core/Themes/ThemeService.cs index 27d82266..976b3689 100644 --- a/src/Lumina.Infrastructure/Core/Themes/ThemeService.cs +++ b/src/Lumina.Infrastructure/Core/Themes/ThemeService.cs @@ -53,7 +53,7 @@ public sealed class ThemeService : IThemeService private readonly string _storageRoot; private readonly string _stagingRoot; private readonly string _bundledRoot; - // serializes theme pack mutations, so concurrent installs and deletes cannot race on the same files; the gate is + // Serializes theme pack mutations, so concurrent installs and deletes cannot race on the same files; the gate is // shared by every instance that writes to the same storage root, because several hosts can run against the same // storage directory at once (for example the parallel in-memory hosts started by the test factories). A per-instance // gate is NOT enough: concurrent hosts raced on the shared staging cleanup and one host's directory move failed with @@ -148,7 +148,7 @@ public sealed class ThemeService : IThemeService if (manifestResult.IsFailure) return manifestResult.Errors; - // install means replace: the files of an existing theme with the same manifest id are swapped with the new pack + // Install means replace: the files of an existing theme with the same manifest id are swapped with the new pack. string destination = Path.Combine(_storageRoot, manifestResult.Value.Id); await SwapIntoDestinationAsync(extractionPath, destination, cancellationToken); return manifestResult.Value; @@ -160,8 +160,8 @@ public sealed class ThemeService : IThemeService } catch (IOException exception) { - // the extracted pack could not be moved into place; the install is best effort, so the caller receives an error - // instead of an unhandled exception that would crash the host or fail the request + // The extracted pack could not be moved into place; the install is best effort, so the caller receives an error + // instead of an unhandled exception that would crash the host or fail the request. _logger.LogWarning(exception, "The theme pack could not be installed."); return Errors.Themes.ThemeFilesUnreadable; } @@ -182,17 +182,17 @@ public sealed class ThemeService : IThemeService } catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) { - // a locked staging file must not turn the install into an unhandled exception; the stale staging - // directory is removed on the next install attempt + // A locked staging file must not turn the install into an unhandled exception; the stale staging + // directory is removed on the next install attempt. _logger.LogTrace(exception, "Failed to clean up the theme staging directory."); } } } catch (IOException exception) { - // a file system failure before or during the install (for example a locked storage or staging directory) + // A file system failure before or during the install (for example a locked storage or staging directory) // must not escape as an unhandled exception, which would crash the host or fail the request; the install - // is best effort and returns an error instead + // is best effort and returns an error instead. _logger.LogWarning(exception, "The theme pack could not be installed."); return Errors.Themes.ThemeFilesUnreadable; } @@ -294,7 +294,7 @@ public sealed class ThemeService : IThemeService ? explicitPath : ResolveMirroredTemplatePath(themePath, pageKey); - // a template is used for a page only when the theme provides one explicitly or as a mirrored file + // A template is used for a page only when the theme provides one explicitly or as a mirrored file. if (templatePath is null) return Errors.Themes.ThemeTemplateNotFound; @@ -321,7 +321,7 @@ public sealed class ThemeService : IThemeService string? candidate = pageKey; while (candidate is not null) { - // normalize the mirrored candidate so that malicious page keys cannot escape the theme pack + // Normalize the mirrored candidate so that malicious page keys cannot escape the theme pack. Result normalizedResult = NormalizeRelativePath($"templates/{candidate}.html"); if (normalizedResult.IsSuccess) { @@ -510,7 +510,7 @@ public sealed class ThemeService : IThemeService if (entry.Length > _options.MaxSingleFileBytes) return Error.Validation(code: "Theme.File.TooLarge", description: $"Theme file '{normalizedPath}' is too large."); - // guard the total decompressed size, so a tiny archive cannot expand into a decompression bomb + // Guard the total decompressed size, so a tiny archive cannot expand into a decompression bomb. expandedBytes += entry.Length; if (expandedBytes > _options.MaxExpandedBytes) return Error.Validation(code: "Theme.Archive.ExpandedTooLarge", description: "The expanded theme archive is too large."); @@ -533,7 +533,7 @@ public sealed class ThemeService : IThemeService if (read == 0) break; - // enforce the per-file limit while streaming, because the declared entry size is not trustworthy + // Enforce the per-file limit while streaming, because the declared entry size is not trustworthy. entryBytes += read; if (entryBytes > _options.MaxSingleFileBytes) return Error.Validation(code: "Theme.File.TooLarge", description: $"Theme file '{normalizedPath}' is too large."); @@ -752,7 +752,7 @@ public sealed class ThemeService : IThemeService if (segment is "." or ".." || segment.Length > 80 || segment.EndsWith(' ') || segment.EndsWith('.')) return PackageInvalid($"Theme path segment '{segment}' is invalid."); - // a theme path segment must be already safe, meaning that sanitizing it would leave it unchanged + // A theme path segment must be already safe, meaning that sanitizing it would leave it unchanged. Result sanitizeResult = _pathService.SanitizeSegment(segment); if (sanitizeResult.IsFailure || !string.Equals(sanitizeResult.Value.Name, segment, StringComparison.Ordinal)) return PackageInvalid($"Theme path segment '{segment}' is invalid."); diff --git a/src/Lumina.Infrastructure/Core/Time/DateTimeProvider.cs b/src/Lumina.Infrastructure/Core/Time/DateTimeProvider.cs index 2334c5aa..12bbc0bf 100644 --- a/src/Lumina.Infrastructure/Core/Time/DateTimeProvider.cs +++ b/src/Lumina.Infrastructure/Core/Time/DateTimeProvider.cs @@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis; namespace Lumina.Infrastructure.Core.Time; /// -/// Service for time related concerns +/// Service for time related concerns. /// [ExcludeFromCodeCoverage] public class DateTimeProvider : IDateTimeProvider diff --git a/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerConfiguration.cs b/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerConfiguration.cs index ce6736d7..cdcd7df8 100644 --- a/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerConfiguration.cs +++ b/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerConfiguration.cs @@ -29,7 +29,7 @@ internal static class PresentationApiLayerConfiguration configuration.SetBasePath(basePath); configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true); - configuration.AddEnvironmentVariables(); // environment variables should override the configuration files + configuration.AddEnvironmentVariables(); // Environment variables should override the configuration files. return services; } diff --git a/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerServices.cs b/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerServices.cs index 7a8823db..95b3d951 100644 --- a/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerServices.cs +++ b/src/Lumina.Presentation.Api/Common/DependencyInjection/PresentationApiLayerServices.cs @@ -102,14 +102,14 @@ public static class PresentationApiLayerServices { string clientIp = httpContext.Request.Headers["X-Forwarded-For"] // First check forwarded headers, in case this is behind a reverse proxy. .FirstOrDefault()?.Split(',')[0].Trim() // Take first IP, if multiple available, to avoid IP spoofing attempts, - ?? httpContext.Connection.RemoteIpAddress?.ToString() // then try RemoteIpAddress. + ?? httpContext.Connection.RemoteIpAddress?.ToString() // Then try RemoteIpAddress. ?? "unknown"; // Fallback if both are null. return RateLimitPartition.GetFixedWindowLimiter( partitionKey: $"auth_{clientIp}", factory: _ => new FixedWindowRateLimiterOptions { - PermitLimit = 10, // Allow 10 attempts - Window = TimeSpan.FromMinutes(15), // within 15 minute window. + PermitLimit = 10, // Allow 10 attempts. + Window = TimeSpan.FromMinutes(15), // Within 15 minute window. QueueLimit = 0, // Don't queue requests. AutoReplenishment = true // Automatically reset rate limiter tokens. }); diff --git a/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs b/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs index 3a24a202..5f5fb5e6 100644 --- a/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs +++ b/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs @@ -11,7 +11,7 @@ public static partial class ApiRoutes public static class Users { public const string GET_USER_BY_ID = "/users/{id}"; - public const string GET_USER_SETTINGS = "/users/me/settings"; // uses "me" because it is always for the currently authenticated user + public const string GET_USER_SETTINGS = "/users/me/settings"; // Uses "me" because it is always for the currently authenticated user. public const string UPDATE_USER_SETTINGS = "/users/me/settings"; public const string GET_PLAYBACK_STATE = "/users/me/settings/playback-state"; public const string UPDATE_PLAYBACK_STATE = "/users/me/settings/playback-state"; diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Common/BaseEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Common/BaseEndpoint.cs index fb6404fb..a4f342fa 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Common/BaseEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Common/BaseEndpoint.cs @@ -25,16 +25,16 @@ public abstract class BaseEndpoint : EndpointThe error to handle. protected IResult Problem(List errors) { - if (errors.Count is 0) // if there are no custom errors given, return a generic problem + if (errors.Count is 0) // If there are no custom errors given, return a generic problem. return Results.Problem(); - // try to make the problem type more specific + // Try to make the problem type more specific. if (errors.All(error => error.Type == ErrorType.Validation)) return ValidationProblem(errors); - // here we could handle custom error types, for instance: if (errors.All(error => error.NumericType == 23)), where 23 could be "domain errors" + // Here we could handle custom error types, for instance: if (errors.All(error => error.NumericType == 23)), where 23 could be "domain errors". - // share the list of errors within the scope of this HTTP request + // Share the list of errors within the scope of this HTTP request. HttpContext.Items[HttpContextItemKeys.ERRORS] = errors; - // get a HTTP error status code for the selected domain error type + // Get a HTTP error status code for the selected domain error type. return Problem(errors.First()); } @@ -52,7 +52,7 @@ public abstract class BaseEndpoint : Endpoint StatusCodes.Status400BadRequest, - ErrorType.Unauthorized => StatusCodes.Status403Forbidden, // DO NOT return Status401Unauthorized, that actually means lack of valid authentication credentials (not logged in) + ErrorType.Unauthorized => StatusCodes.Status403Forbidden, // DO NOT return Status401Unauthorized, that actually means lack of valid authentication credentials (not logged in). ErrorType.Failure => StatusCodes.Status403Forbidden, ErrorType.Forbidden => StatusCodes.Status403Forbidden, ErrorType.NotFound => StatusCodes.Status404NotFound, @@ -62,7 +62,7 @@ public abstract class BaseEndpoint : Endpoint : Endpoint errorsDictionary = []; Dictionary extensionsDictionary = []; - // populate the errors dictionary with error codes and their descriptions + // Populate the errors dictionary with error codes and their descriptions. foreach (Error error in errors) if (!errorsDictionary.TryGetValue(error.Code, out string[]? value)) errorsDictionary.Add(error.Code, [error.Description]); @@ -89,10 +89,10 @@ public abstract class BaseEndpoint : EndpointCancellation token that can be used to stop the execution. public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken) { - // a multipart body without any part cannot be parsed as a form, so a malformed upload is treated as a missing archive + // A multipart body without any part cannot be parsed as a form, so a malformed upload is treated as a missing archive. IFormFile? archive = null; if (HttpContext.Request.HasFormContentType) { diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpoint.cs index e43ae08e..905edfc9 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpoint.cs @@ -48,7 +48,7 @@ public class InstallThemeEndpoint : BaseEndpointCancellation token that can be used to stop the execution. public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken) { - // a multipart body without any part cannot be parsed as a form, so a malformed upload is treated as a missing archive + // A multipart body without any part cannot be parsed as a form, so a malformed upload is treated as a missing archive. IFormFile? archive = null; if (HttpContext.Request.HasFormContentType) { diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetCurrentTheme/GetCurrentThemeEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetCurrentTheme/GetCurrentThemeEndpoint.cs index 0c981623..dd802fcd 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetCurrentTheme/GetCurrentThemeEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetCurrentTheme/GetCurrentThemeEndpoint.cs @@ -37,7 +37,7 @@ public class GetCurrentThemeEndpoint : BaseEndpoint Verbs(Http.GET); Routes(ApiRoutes.Themes.GET_CURRENT_THEME); Version(1); - // theme content is public, since the web renders themed pages for anonymous visitors too (i.e.: login page); only install and manage operations are admin-gated + // Theme content is public, since the web renders themed pages for anonymous visitors too (i.e.: login page); only install and manage operations are admin-gated. AllowAnonymous(); DontCatchExceptions(); } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeSettings/GetThemeSettingsEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeSettings/GetThemeSettingsEndpoint.cs index fd6c177d..64c9cf35 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeSettings/GetThemeSettingsEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeSettings/GetThemeSettingsEndpoint.cs @@ -37,7 +37,7 @@ public class GetThemeSettingsEndpoint : BaseEndpoint Verbs(Http.GET); Routes(ApiRoutes.Themes.GET_THEME_SETTINGS); Version(1); - // theme content is public, since the web renders themed pages for anonymous visitors too (i.e.: login page); only install and manage operations are admin-gated + // Theme content is public, since the web renders themed pages for anonymous visitors too (i.e.: login page); only install and manage operations are admin-gated. AllowAnonymous(); DontCatchExceptions(); } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpoint.cs index 10cae257..2d718a62 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpoint.cs @@ -39,7 +39,7 @@ public class GetThemeTemplateEndpoint : BaseEndpointThe user's authorization details. private async Task GetUserAuthorizationAsync(CancellationToken cancellationToken) { - // anonymous users and users without an identifier claim have no role or permissions, so deny without querying the API + // Anonymous users and users without an identifier claim have no role or permissions, so deny without querying the API. string? userId = _httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (string.IsNullOrEmpty(userId)) return new GetAuthorizationResponse(Guid.Empty, string.Empty, []); diff --git a/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs b/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs index b3059e93..13fa36e9 100644 --- a/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs +++ b/src/Lumina.Presentation.Web/Common/Authorization/InitializationHandler.cs @@ -43,11 +43,11 @@ public class InitializationHandler : AuthorizationHandler - /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0") + /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0"). /// public string? ReleaseVersion { get; set; } } diff --git a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs index 690451ea..493ffeab 100644 --- a/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs +++ b/src/Lumina.Presentation.Web/Common/DTO/FileSystemManagement/FileDto.cs @@ -11,7 +11,7 @@ namespace Lumina.Presentation.Web.Common.DTO.FileSystemManagement; public class FileDto : FileSystemItemDto { /// - /// Gets or sets the size of the file, in bytes + /// Gets or sets the size of the file, in bytes. /// public long Size { get; set; } } diff --git a/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs index 17d58a39..ae119295 100644 --- a/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs +++ b/src/Lumina.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDto.cs @@ -71,7 +71,7 @@ public class BookDto public ReleaseCountry? ReleaseCountry { get; init; } /// - /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0") + /// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0"). /// public string? ReleaseVersion { get; init; } diff --git a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs index b99a8a74..7cbe7c9f 100644 --- a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs +++ b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerConfiguration.cs @@ -22,10 +22,10 @@ internal static class PresentationWebLayerConfiguration /// The updated . internal static IServiceCollection BindConfiguration(this IServiceCollection serviceCollection, IConfigurationManager configuration) { - // add the configuration sources to the configuration builder + // Add the configuration sources to the configuration builder. configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); configuration.AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true); - configuration.AddEnvironmentVariables(); // environment variables should override the configuration files + configuration.AddEnvironmentVariables(); // Environment variables should override the configuration files. serviceCollection.AddOptions() .Bind(configuration.GetRequiredSection(ServerConfigurationDto.SECTION_NAME)) diff --git a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs index 8cee852a..c1bd97be 100644 --- a/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs +++ b/src/Lumina.Presentation.Web/Common/DependencyInjection/PresentationWebLayerServices.cs @@ -139,7 +139,7 @@ public static class PresentationWebLayerServices requestLocalizationOptions.RequestCultureProviders = [ routeDataRequestCultureProvider, // Keep route-based culture handling, - new CookieRequestCultureProvider(), // but also add cookie option, so the application "remembers" the last used language the next time it's opened. + new CookieRequestCultureProvider(), // But also add cookie option, so the application "remembers" the last used language the next time it's opened. new AcceptLanguageHeaderRequestCultureProvider() ]; }); diff --git a/src/Lumina.Presentation.Web/Common/Enums/BookLibrary/IsbnFormat.cs b/src/Lumina.Presentation.Web/Common/Enums/BookLibrary/IsbnFormat.cs index 13f9e3b8..5ec7fc06 100644 --- a/src/Lumina.Presentation.Web/Common/Enums/BookLibrary/IsbnFormat.cs +++ b/src/Lumina.Presentation.Web/Common/Enums/BookLibrary/IsbnFormat.cs @@ -7,13 +7,13 @@ public enum IsbnFormat { /// /// The 10-digit ISBN format used for books published before 2007. - /// Example: 0-306-40615-2 + /// Example: 0-306-40615-2. /// Isbn10, /// /// The 13-digit ISBN format introduced in 2007, now the standard for all new books. - /// Example: 978-0-306-40615-7 + /// Example: 978-0-306-40615-7. /// Isbn13 } \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs b/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs index cdb5bd98..717ef757 100644 --- a/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs +++ b/src/Lumina.Presentation.Web/Common/Http/RazorViewResult.cs @@ -45,20 +45,20 @@ public sealed class RazorViewResult : IResult /// The for the current request. public async Task ExecuteAsync(HttpContext httpContext) { - // the only accessible ViewDataDictionary constructors require either a model state or an existing dictionary, so start from an empty one and assign the model + // The only accessible ViewDataDictionary constructors require either a model state or an existing dictionary, so start from an empty one and assign the model // through the Model setter; the setter rebases the model metadata on the runtime type of the value, which is what makes the asp-for tag helpers resolve the - // properties of the actual model type instead of a plain object + // properties of the actual model type instead of a plain object. IModelMetadataProvider metadataProvider = httpContext.RequestServices.GetRequiredService(); ViewDataDictionary viewData = new(metadataProvider, new ModelStateDictionary()) { Model = _model }; foreach ((string key, object? value) in _viewData) viewData[key] = value; - // delegate to the MVC view execution machinery instead of rendering the view manually: it discovers the layout and _ViewStart, evaluates the sections, - // and resolves the view components and tag helpers, none of which the Results class can do since it has no view rendering support + // Delegate to the MVC view execution machinery instead of rendering the view manually: it discovers the layout and _ViewStart, evaluates the sections, + // and resolves the view components and tag helpers, none of which the Results class can do since it has no view rendering support. ViewResult viewResult = new() { ViewName = _viewName, ViewData = viewData }; IActionResultExecutor executor = httpContext.RequestServices.GetRequiredService>(); - // the view engine needs an ActionContext, which FastEndpoints does not provide; synthesize one that carries over the current route data, so that the - // culture route value (and therefore the URL-based localization) keeps working while the view is rendered + // The view engine needs an ActionContext, which FastEndpoints does not provide; synthesize one that carries over the current route data, so that the + // culture route value (and therefore the URL-based localization) keeps working while the view is rendered. ActionContext actionContext = new(httpContext, httpContext.GetRouteData() ?? new RouteData(), new ActionDescriptor()); await executor.ExecuteAsync(actionContext, viewResult).ConfigureAwait(false); } diff --git a/src/Lumina.Presentation.Web/Common/Middlewares/CultureRedirectMiddleware.cs b/src/Lumina.Presentation.Web/Common/Middlewares/CultureRedirectMiddleware.cs index d40cecd0..134b1272 100644 --- a/src/Lumina.Presentation.Web/Common/Middlewares/CultureRedirectMiddleware.cs +++ b/src/Lumina.Presentation.Web/Common/Middlewares/CultureRedirectMiddleware.cs @@ -28,17 +28,17 @@ public class CultureRedirectMiddleware /// The for the current request. public async Task InvokeAsync(HttpContext context) { - // check if the request path starts with "/" and does not contain any culture + // Check if the request path starts with "/" and does not contain any culture. string? path = context.Request.Path.Value?.ToLowerInvariant(); - // redirect routes that would lead to the home page + // Redirect routes that would lead to the home page. if (path == "/" || path == "/home" || path == "/index") { - // try to get the user's preferred culture from cookies + // Try to get the user's preferred culture from cookies. IRequestCultureFeature? feature = context.Features.Get(); string? userCulture = feature?.RequestCulture.Culture.Name; - // if no specific culture is found, use "en-US" as fallback + // If no specific culture is found, use "en-US" as fallback. string redirectCulture = userCulture ?? "en-US"; - // redirect the user to their preferred culture route + // Redirect the user to their preferred culture route. context.Response.Redirect($"/{redirectCulture.ToLower()}/"); return; } diff --git a/src/Lumina.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs b/src/Lumina.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs index f7842e57..6035e7c3 100644 --- a/src/Lumina.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs +++ b/src/Lumina.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs @@ -57,11 +57,11 @@ public class ExceptionHandlingMiddleware // The client went away while its request or response was being processed, so there is nobody left to answer. context.Abort(); } - catch (ApiException apiException) // threat API exceptions differently - they contain Problem Details properties + catch (ApiException apiException) // Treat API exceptions differently - they contain Problem Details properties. { await HandleApiExceptionAsync(context, apiException); } - catch (Exception ex) // other cases - + catch (Exception ex) // Other cases. { _logger.LogError(ex, "Unexpected exception occurred: {Message}", ex.Message); // Once the response has started, its status and headers are already on the wire, so they can no longer be replaced: the connection @@ -104,7 +104,7 @@ public class ExceptionHandlingMiddleware /// private async Task HandleApiExceptionAsync(HttpContext context, ApiException apiException) { - // log all available details for debugging/monitoring + // Log all available details for debugging/monitoring. _logger.LogError( apiException, "API Exception occurred. Status: {StatusCode}, Title: {Title}, Detail: {Detail}, Extensions: {Extensions}", @@ -121,8 +121,8 @@ public class ExceptionHandlingMiddleware return; } - // handle unauthorized errors by prompting the user to re-login - if (apiException.HttpStatusCode == HttpStatusCode.Unauthorized) // HTTP 401 Unauthorized actually means lack of valid authentication credentials (not logged in) + // Handle unauthorized errors by prompting the user to re-login. + if (apiException.HttpStatusCode == HttpStatusCode.Unauthorized) // HTTP 401 Unauthorized actually means lack of valid authentication credentials (not logged in). await HandleUnauthorizedAsync(context); else if (apiException.HttpStatusCode == HttpStatusCode.NotFound) // await HandleNotFoundAsync(context, apiException); @@ -137,8 +137,8 @@ public class ExceptionHandlingMiddleware /// private async Task HandleNotFoundAsync(HttpContext context, ApiException apiException) { - // when the API reports the currently logged-in user no longer exists (404 from the current-user authorization check), - // the stored session is stale: sign out and send the user to the login page instead of the not-found page + // When the API reports the currently logged-in user no longer exists (404 from the current-user authorization check), + // the stored session is stale: sign out and send the user to the login page instead of the not-found page. if (context.User?.Identity?.IsAuthenticated == true && IsCurrentUserAuthorizationCheck(apiException)) { await HandleUnauthorizedAsync(context).ConfigureAwait(false); @@ -161,7 +161,7 @@ public class ExceptionHandlingMiddleware string culture = context.Request.RouteValues["culture"]?.ToString()?.ToLower() ?? "en-us"; string notFoundUrl = $"/{culture}/not-found"; _logger.LogInformation("Redirecting user to NotFound url"); - context.Response.Redirect(notFoundUrl); // force an entire refresh of the current location, so that header and footer are re-rendered too + context.Response.Redirect(notFoundUrl); // Force an entire refresh of the current location, so that header and footer are re-rendered too. } else await WriteStatusOnlyResponseAsync(context, (int)HttpStatusCode.NotFound).ConfigureAwait(false); @@ -265,7 +265,7 @@ public class ExceptionHandlingMiddleware /// private async Task HandleUnauthorizedAsync(HttpContext context) { - // when API JWT tokens expire, the client app is still logged in, so, sign out the user and delete the authentication cookie and token + // When API JWT tokens expire, the client app is still logged in, so, sign out the user and delete the authentication cookie and token. await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme).ConfigureAwait(false); context.Response.Cookies.Delete("Token"); @@ -284,7 +284,7 @@ public class ExceptionHandlingMiddleware string returnUrl = $"{context.Request.Path}{context.Request.QueryString}"; string loginUrl = $"/{culture}/auth/login?returnUrl={Uri.EscapeDataString(returnUrl)}"; _logger.LogInformation("Redirecting unauthorized user to {Url}", loginUrl); - context.Response.Redirect(loginUrl); // force an entire refresh of the current location, so that header and footer are re-rendered too + context.Response.Redirect(loginUrl); // Force an entire refresh of the current location, so that header and footer are re-rendered too. } else await WriteStatusOnlyResponseAsync(context, (int)HttpStatusCode.Unauthorized).ConfigureAwait(false); @@ -299,7 +299,7 @@ public class ExceptionHandlingMiddleware if (apiException.ProblemDetails is not null) { - // only show the meaningful error message to the user + // Only show the meaningful error message to the user. if (!string.IsNullOrEmpty(apiException.ProblemDetails.Detail)) errorMessage.AppendLine($"{_stringLocalizer[apiException.ProblemDetails.Detail]}
"); else if (!string.IsNullOrEmpty(apiException.ProblemDetails.Title)) diff --git a/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs b/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs index efd0e9f3..20738062 100644 --- a/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs +++ b/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs @@ -40,7 +40,7 @@ public class NotFoundRedirectMiddleware context.Features.Get()?.RequestCulture.Culture.Name?.ToLower() ?? "en-us"; - // re-execute the request so the user gets the error page + // Re-execute the request so the user gets the error page. string? originalPath = context.Request.Path.Value; context.Items["originalPath"] = originalPath; _logger.LogInformation("Redirecting user to NotFound url"); diff --git a/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs b/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs index ac298e1f..761b14a8 100644 --- a/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs +++ b/src/Lumina.Presentation.Web/Common/Security/CryptographyService.cs @@ -35,7 +35,7 @@ public sealed class CryptographyService : ICryptographyService, IDisposable if (string.IsNullOrEmpty(plaintext)) throw new ArgumentException("Value cannot be null or empty", nameof(plaintext)); - // generate a new, random 16-byte IV for each encryption to ensure unique ciphertexts + // Generate a new, random 16-byte IV for each encryption to ensure unique ciphertexts. byte[] iv = new byte[16]; using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) rng.GetBytes(iv); @@ -50,7 +50,7 @@ public sealed class CryptographyService : ICryptographyService, IDisposable byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext); byte[] ciphertext = encryptor.TransformFinalBlock(plaintextBytes, 0, plaintextBytes.Length); - // combine IV and ciphertext + // Combine IV and ciphertext. byte[] combined = new byte[iv.Length + ciphertext.Length]; Buffer.BlockCopy(iv, 0, combined, 0, iv.Length); Buffer.BlockCopy(ciphertext, 0, combined, iv.Length, ciphertext.Length); @@ -69,13 +69,13 @@ public sealed class CryptographyService : ICryptographyService, IDisposable if (string.IsNullOrEmpty(ciphertext)) throw new ArgumentException("Value cannot be null or empty", nameof(ciphertext)); - // decode the combined data (IV + ciphertext) from Base64 + // Decode the combined data (IV + ciphertext) from Base64. byte[] combined = Convert.FromBase64String(ciphertext); if (combined.Length < 16) throw new ArgumentException("Invalid ciphertext"); - // extract IV and ciphertext + // Extract IV and ciphertext. byte[] iv = new byte[16]; byte[] encryptedData = new byte[combined.Length - 16]; Buffer.BlockCopy(combined, 0, iv, 0, 16); diff --git a/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs b/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs index da8a46b5..27a0f4ea 100644 --- a/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs +++ b/src/Lumina.Presentation.Web/Common/Services/CachedAuthorizationHandler.cs @@ -41,25 +41,25 @@ public class CachedAuthorizationHandler : DelegatingHandler /// The HTTP response message from either the cache or the original API call. protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { - // get the called API endpoint + // Get the called API endpoint. string requestPath = request.RequestUri!.AbsolutePath; string cacheKey = GetAuthorizationCacheKey(); - // if it's any endpoint other than the one for the authorization request, fire it away towards the original API service + // If it's any endpoint other than the one for the authorization request, fire it away towards the original API service. if (!requestPath.EndsWith(AUTHORIZATION_ENDPOINT, StringComparison.OrdinalIgnoreCase)) { - if (requestPath.EndsWith(LOGIN_ENDPOINT)) // if login endpoint was hit, a new user is now present, delete previous cached permissions + if (requestPath.EndsWith(LOGIN_ENDPOINT)) // If login endpoint was hit, a new user is now present, delete previous cached permissions. await _hybridCache.RemoveAsync(cacheKey, cancellationToken).ConfigureAwait(false); return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); } - // otherwise, check the hybrid cache to see if there is a cached authorization + // Otherwise, check the hybrid cache to see if there is a cached authorization. CachedResponse response = await _hybridCache.GetOrCreateAsync( cacheKey, async (cancellationToken) => { - // perform the actual API call if cache is empty or expired + // Perform the actual API call if cache is empty or expired. HttpResponseMessage result = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); string content = await result.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - // cache both status code and content + // Cache both status code and content. return new CachedResponse { Content = content, @@ -68,11 +68,11 @@ public class CachedAuthorizationHandler : DelegatingHandler }, new HybridCacheEntryOptions() { - Expiration = TimeSpan.FromMinutes(5) // cache for the next five minutes + Expiration = TimeSpan.FromMinutes(5) // Cache for the next five minutes. }, cancellationToken: cancellationToken ); - // if the API returned 401 Unauthorized (i.e. token expired), DO NOT cache this response - it will be used for authorization endpoints even after successful login, + // If the API returned 401 Unauthorized (i.e. token expired), DO NOT cache this response - it will be used for authorization endpoints even after successful login, // resulting in incorrect login redirection cycles! if (response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.NotFound) await _hybridCache.RemoveAsync(cacheKey, cancellationToken).ConfigureAwait(false); @@ -88,7 +88,7 @@ public class CachedAuthorizationHandler : DelegatingHandler /// The cache key for the currently authenticated user's authorization response. private string GetAuthorizationCacheKey() { - // key the cache entry by the authenticated user's id to prevent one user's authorization response from being served to another user + // Key the cache entry by the authenticated user's id to prevent one user's authorization response from being served to another user. string? userId = _httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; return userId is null ? AUTHORIZATION_ENDPOINT : $"{AUTHORIZATION_ENDPOINT}:{userId}"; } diff --git a/src/Lumina.Presentation.Web/Common/Services/ScriptIdentifierHelper.cs b/src/Lumina.Presentation.Web/Common/Services/ScriptIdentifierHelper.cs index 5a277908..3bcdd366 100644 --- a/src/Lumina.Presentation.Web/Common/Services/ScriptIdentifierHelper.cs +++ b/src/Lumina.Presentation.Web/Common/Services/ScriptIdentifierHelper.cs @@ -18,7 +18,7 @@ public static class ScriptIdentifierHelper /// /// Generates a unique script identifier using a GUID. /// - /// A unique identifier in format "script_{guid}" + /// A unique identifier in format "script_{guid}". /// Thrown if a duplicate identifier is detected. public static string GenerateScriptId() { diff --git a/src/Lumina.Presentation.Web/Common/Utilities/OptionsBuilderValidationUtilities.cs b/src/Lumina.Presentation.Web/Common/Utilities/OptionsBuilderValidationUtilities.cs index 38684c4d..d5bcfd53 100644 --- a/src/Lumina.Presentation.Web/Common/Utilities/OptionsBuilderValidationUtilities.cs +++ b/src/Lumina.Presentation.Web/Common/Utilities/OptionsBuilderValidationUtilities.cs @@ -22,7 +22,7 @@ public static class OptionsBuilderValidationUtilities /// The same instance, to allow for chaining. public static OptionsBuilder ValidateFluently(this OptionsBuilder optionsBuilder) where TOptions : class { - // register a singleton instance of IValidateOptions using the validator + // Register a singleton instance of IValidateOptions using the validator. optionsBuilder.Services.AddSingleton>( serviceProvider => new ValidationOptions(optionsBuilder.Name, serviceProvider.GetRequiredService>())); return optionsBuilder; diff --git a/src/Lumina.Presentation.Web/Common/Validation/ValidationOptions.cs b/src/Lumina.Presentation.Web/Common/Validation/ValidationOptions.cs index d1632065..49cca889 100644 --- a/src/Lumina.Presentation.Web/Common/Validation/ValidationOptions.cs +++ b/src/Lumina.Presentation.Web/Common/Validation/ValidationOptions.cs @@ -40,22 +40,22 @@ public class ValidationOptions : IValidateOptions where TOpt /// A that indicates whether the validation was successful or not. public ValidateOptionsResult Validate(string? name, TOptions options) { - // check if the name of the options is specified and matches the provided one + // Check if the name of the options is specified and matches the provided one. if (Name is not null && Name != name) return ValidateOptionsResult.Skip; - ArgumentNullException.ThrowIfNull(options, nameof(options)); // don't go further if the options are null + ArgumentNullException.ThrowIfNull(options, nameof(options)); // Don't go further if the options are null. - List validationResult = _validator.Validate(options); // validate the options using the validator + List validationResult = _validator.Validate(options); // Validate the options using the validator. - // return a response based on the validation result + // Return a response based on the validation result. if (validationResult.Count == 0) return ValidateOptionsResult.Success; - // if the validation fails, collect the error messages + // If the validation fails, collect the error messages. string[] errors = [.. validationResult.Select(error => $"Options validation failed for '{error.Code}' with error: '{error.Description}'")]; - // and return them with a failure result + // And return them with a failure result. return ValidateOptionsResult.Fail(errors); } } diff --git a/src/Lumina.Presentation.Web/Common/Validation/ValidationRule.cs b/src/Lumina.Presentation.Web/Common/Validation/ValidationRule.cs index 79595a26..9a970e14 100644 --- a/src/Lumina.Presentation.Web/Common/Validation/ValidationRule.cs +++ b/src/Lumina.Presentation.Web/Common/Validation/ValidationRule.cs @@ -21,7 +21,7 @@ internal sealed class ValidationRule : IValidationRule> _predicates = []; private readonly List _predicateErrors = []; - // instance-aware predicates get their own separate pair of lists instead of being merged into the + // Instance-aware predicates get their own separate pair of lists instead of being merged into the // lists above, because they have a different delegate signature (TRequest, TProperty) vs (TProperty). // Keeping them separate avoids wrapping every plain predicate in an adapter, just to fit one shape. private readonly List> _instanceAwarePredicates = []; @@ -132,7 +132,7 @@ internal sealed class ValidationRule : IValidationRuleThe of every predicate that fails; empty if the rule passes. public IEnumerable Validate(TRequest instance) { - // evaluate the condition first, if it returns false, skip validation entirely. + // Evaluate the condition first, if it returns false, skip validation entirely. if (condition is not null && !condition(instance)) yield break; diff --git a/src/Lumina.Presentation.Web/Common/Validation/ValidationRuleForEach.cs b/src/Lumina.Presentation.Web/Common/Validation/ValidationRuleForEach.cs index 58b4d427..f6228f4e 100644 --- a/src/Lumina.Presentation.Web/Common/Validation/ValidationRuleForEach.cs +++ b/src/Lumina.Presentation.Web/Common/Validation/ValidationRuleForEach.cs @@ -106,7 +106,7 @@ internal sealed class ValidationRuleForEach : IValidationRuleOne per failing predicate, per item; empty if every item passes. public IEnumerable Validate(TRequest instance) { - // Evaluate the condition first, if it returns false, skip validation entirely.. + // Evaluate the condition first, if it returns false, skip validation entirely. if (condition is not null && !condition(instance)) yield break; diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs index 62d3cba0..18125e4b 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs @@ -47,7 +47,7 @@ public class SetLanguageEndpoint : BaseEndpoint Expires = DateTimeOffset.UtcNow.AddYears(1), IsEssential = true, SameSite = SameSiteMode.Lax, - Path = "/" // ensure the cookie works across all paths + Path = "/" // Ensure the cookie works across all paths. } ); // Determine the URL to return to, defaulting to the localized home page when no return URL is supplied. diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs index 404582fc..666c8dfb 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs @@ -93,7 +93,7 @@ public class LoginEndpoint : BaseEndpoint string currentCulture = Culture; // Handle ReturnUrl and ensure it includes the correct culture. string redirectUrl; - if (!string.IsNullOrEmpty(request.ReturnUrl) && IsLocalUrl(request.ReturnUrl)) // ensure that return URL contains the correct culture + if (!string.IsNullOrEmpty(request.ReturnUrl) && IsLocalUrl(request.ReturnUrl)) // Ensure that return URL contains the correct culture. redirectUrl = request.ReturnUrl.StartsWith($"/{currentCulture}/") ? request.ReturnUrl : $"/{currentCulture}{request.ReturnUrl}"; else { @@ -123,7 +123,7 @@ public class LoginEndpoint : BaseEndpoint if (error.Value.ValueKind == JsonValueKind.Array) foreach (JsonElement errorValue in error.Value.EnumerateArray()) if (errorValue.ValueKind == JsonValueKind.String && errorValue.GetString() == "InvalidTotpCode" && string.IsNullOrEmpty(request.TotpCode)) - return JsonSuccess(new { isTotpRequired = true }); // only get here when user did not enter a TOTP code at all, otherwise rethrow the validation error + return JsonSuccess(new { isTotpRequired = true }); // Only get here when user did not enter a TOTP code at all, otherwise rethrow the validation error. throw; } } diff --git a/src/Lumina.Presentation.Web/Core/Themes/RazorViewToStringRenderer.cs b/src/Lumina.Presentation.Web/Core/Themes/RazorViewToStringRenderer.cs index 7961f07f..f99f3e7e 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/RazorViewToStringRenderer.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/RazorViewToStringRenderer.cs @@ -49,7 +49,7 @@ public sealed class RazorViewToStringRenderer /// The rendered HTML of the partial. public async Task RenderPartialAsync(string partialName, CancellationToken cancellationToken = default) { - // the theme shell reuses the application's Razor chrome as strings, so the same markup stays in one place + // The theme shell reuses the application's Razor chrome as strings, so the same markup stays in one place. HttpContext httpContext = _httpContextAccessor.HttpContext ?? throw new InvalidOperationException("The current HTTP context is unavailable."); ActionContext actionContext = new(httpContext, httpContext.GetRouteData() ?? new RouteData(), new ActionDescriptor()); IView view = _viewEngine.FindView(actionContext, partialName, isMainPage: false).View diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserBuilder.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserBuilder.cs index 1160cb46..f5e567f4 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserBuilder.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserBuilder.cs @@ -12,7 +12,7 @@ namespace Lumina.Presentation.Web.Core.Themes; ///
public sealed class ThemeFileSystemBrowserBuilder { - // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Shared.Components.FileSystemBrowser.Default"; private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserRenderer.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserRenderer.cs index 1acedba3..cfca6270 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserRenderer.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemeFileSystemBrowserRenderer.cs @@ -14,7 +14,7 @@ namespace Lumina.Presentation.Web.Core.Themes; ///
public class ThemeFileSystemBrowserRenderer { - // the page keys mirror the template files of the theme packs, pinned in each theme manifest so that a missing sub template does not resolve to the component shell template + // The page keys mirror the template files of the theme packs, pinned in each theme manifest so that a missing sub template does not resolve to the component shell template. private const string SHELL_PAGE_KEY = "shared/file-system-browser"; private const string TREE_NODE_PAGE_KEY = "shared/file-system-browser/tree-node"; private const string EXPLORER_ITEM_PAGE_KEY = "shared/file-system-browser/explorer-item"; @@ -73,7 +73,7 @@ public class ThemeFileSystemBrowserRenderer } catch (Exception) { - // the file system browser is best effort: when the component template of the active theme cannot be loaded or rendered, the application Razor fallback is rendered instead + // The file system browser is best effort: when the component template of the active theme cannot be loaded or rendered, the application Razor fallback is rendered instead. return Error.NotFound(code: "Theme.Template.Unavailable", description: "The file system browser theme template could not be loaded."); } } @@ -91,8 +91,8 @@ public class ThemeFileSystemBrowserRenderer try { ThemeRenderDocumentDto document = await _themeService.GetRenderDocumentAsync(pageKey, themeId, cancellationToken).ConfigureAwait(false); - // when the theme does not ship the sub template, the mirrored template resolution walks up the path scopes - // and returns the component shell template instead, which the client script must not render as dynamic content + // When the theme does not ship the sub template, the mirrored template resolution walks up the path scopes + // and returns the component shell template instead, which the client script must not render as dynamic content. if (string.Equals(document.Template, shellTemplate, StringComparison.Ordinal)) return string.Empty; @@ -104,7 +104,7 @@ public class ThemeFileSystemBrowserRenderer } catch (Exception) { - // each sub template is best effort: when the theme omits one, the client script renders that part with its built-in markup instead + // Each sub template is best effort: when the theme omits one, the client script renders that part with its built-in markup instead. return string.Empty; } } diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemeLayoutRenderer.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemeLayoutRenderer.cs index 480cc1b0..a80bfae2 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemeLayoutRenderer.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemeLayoutRenderer.cs @@ -16,7 +16,7 @@ namespace Lumina.Presentation.Web.Core.Themes; /// public class ThemeLayoutRenderer { - // the page keys mirror the paths of the corresponding Razor views under Core/Views, so that theme templates can override them at the page, section or default scope + // The page keys mirror the paths of the corresponding Razor views under Core/Views, so that theme templates can override them at the page, section or default scope. private const string LAYOUT_PAGE_KEY = "shared/layout"; private const string NAV_PAGE_KEY = "shared/nav-menu"; private const string SERVER_UNREACHABLE_BANNER_PAGE_KEY = "shared/server-unreachable-banner"; @@ -101,7 +101,7 @@ public class ThemeLayoutRenderer } catch (Exception) { - // the themed shell is best effort: when the active theme cannot be loaded, the application layout renders the + // The themed shell is best effort: when the active theme cannot be loaded, the application layout renders the // page instead. The exception must not propagate, otherwise the exception handling middleware turns the page // into a JSON error instead of the fallback layout, so any page breaks whenever the theme API is unavailable. return Error.NotFound(code: "Theme.Template.Unavailable", description: "The active theme could not be loaded."); @@ -130,8 +130,8 @@ public class ThemeLayoutRenderer } catch (Exception) { - // the navigation menu is best effort: when the theme navigation template cannot be loaded or rendered, - // the application navigation menu is rendered instead, keeping the themed shell of the page intact + // The navigation menu is best effort: when the theme navigation template cannot be loaded or rendered, + // the application navigation menu is rendered instead, keeping the themed shell of the page intact. } return await _viewRenderer.RenderPartialAsync("_NavMenu", cancellationToken); diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemePageDataFactory.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemePageDataFactory.cs index 25f752fc..d294fc34 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemePageDataFactory.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemePageDataFactory.cs @@ -17,7 +17,7 @@ public static class ThemePageDataFactory /// The localized strings keyed by their resource names. public static Dictionary CreateLocalizedStrings(IStringLocalizer localizer) { - // expose the page's full resource set, so templates can pull any localized string without the page enumerating keys + // Expose the page's full resource set, so templates can pull any localized string without the page enumerating keys. Dictionary strings = []; foreach (LocalizedString localizedString in localizer.GetAllStrings(includeParentCultures: true)) strings[localizedString.Name] = localizedString.Value; diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemePageRenderer.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemePageRenderer.cs index 2dc72ac6..c7d62467 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemePageRenderer.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemePageRenderer.cs @@ -43,7 +43,7 @@ public class ThemePageRenderer model.ThemeId = document.Theme.Id; model.AssetBase = $"/theme-assets/{document.Theme.Id}/assets"; - // a fresh script id per render lets the AJAX navigator unload this view's script when navigating away + // A fresh script id per render lets the AJAX navigator unload this view's script when navigating away. model.ScriptId = ScriptIdentifierHelper.GenerateScriptId(); return _templateEngine.RenderPage(document.Template, model); @@ -54,7 +54,7 @@ public class ThemePageRenderer } catch (Exception) { - // themed rendering is best effort: when the active theme cannot be loaded, the caller falls back to the Razor + // Themed rendering is best effort: when the active theme cannot be loaded, the caller falls back to the Razor // view. The exception must not propagate, otherwise the exception handling middleware turns the page into a // JSON error instead of the Razor fallback, so any themed page breaks whenever the theme API is unavailable. return Error.NotFound(code: "Theme.Template.Unavailable", description: "The active theme could not be loaded."); diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemeTemplateEngine.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemeTemplateEngine.cs index 25d516d9..016ae3ea 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemeTemplateEngine.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemeTemplateEngine.cs @@ -18,7 +18,7 @@ namespace Lumina.Presentation.Web.Core.Themes; /// public sealed class ThemeTemplateEngine { - // bound template nesting and rendered output, so a single theme cannot exhaust the server memory + // Bound template nesting and rendered output, so a single theme cannot exhaust the server memory. private const int MAX_NESTING_DEPTH = 32; private const int MAX_RENDERED_CHARACTERS = 4 * 1024 * 1024; @@ -42,9 +42,9 @@ public sealed class ThemeTemplateEngine if (parseResult.IsFailure) return parseResult.Errors; - // the reserved top-level 'scripts' section holds the script of the page and is rendered separately, mirroring the + // The reserved top-level 'scripts' section holds the script of the page and is rendered separately, mirroring the // 'Scripts' section of a Razor view, so that the layout can host it in the scripts container of the navigator; - // every other top-level node is the content of the page section + // every other top-level node is the content of the page section. List contentNodes = []; ThemeSectionNodeDto? scriptsSection = null; foreach (ThemeTemplateNodeDto node in parseResult.Value) diff --git a/src/Lumina.Presentation.Web/Core/ViewComponents/FileSystemBrowserViewComponent.cs b/src/Lumina.Presentation.Web/Core/ViewComponents/FileSystemBrowserViewComponent.cs index 99dfd237..cc5f39ad 100644 --- a/src/Lumina.Presentation.Web/Core/ViewComponents/FileSystemBrowserViewComponent.cs +++ b/src/Lumina.Presentation.Web/Core/ViewComponents/FileSystemBrowserViewComponent.cs @@ -35,7 +35,7 @@ public class FileSystemBrowserViewComponent : ViewComponent public async Task InvokeAsync() { ThemeFileSystemBrowserConfigurationDto configuration = new( - ClientBasePath: "http://localhost:5012/", // TODO: take from appsettings or environment + ClientBasePath: "http://localhost:5012/", // TODO: take from appsettings or environment. Path: RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? @"/" : @"C:\Users\", ViewMode: FileSystemViewMode.List.ToString().ToLower(), IconSize: FileSystemIconSize.Large.ToString().ToLower()); diff --git a/src/Lumina.Presentation.Web/Program.cs b/src/Lumina.Presentation.Web/Program.cs index b55c76c9..d891a08e 100644 --- a/src/Lumina.Presentation.Web/Program.cs +++ b/src/Lumina.Presentation.Web/Program.cs @@ -42,19 +42,19 @@ public class Program builder.Services.AddHealthChecks() .AddCheck("api", HealthStatus.Unhealthy, ["ready"]); - // determine log path based on environment + // Determine log path based on environment. string logPath; if (Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER") == "true") { - logPath = Environment.GetEnvironmentVariable("LOG_PATH") ?? "/logs"; // use docker volume path - builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(5012)); // HTTP only + logPath = Environment.GetEnvironmentVariable("LOG_PATH") ?? "/logs"; // Use docker volume path. + builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(5012)); // HTTP only. } else - logPath = Path.Combine(AppContext.BaseDirectory, "logs"); // use local binary path + logPath = Path.Combine(AppContext.BaseDirectory, "logs"); // Use local binary path. Directory.CreateDirectory(logPath); if (!logPath.EndsWith(Path.DirectorySeparatorChar.ToString())) logPath = logPath += Path.DirectorySeparatorChar; - // set environment variable for Serilog configuration + // Set environment variable for Serilog configuration. Environment.SetEnvironmentVariable("LOG_PATH", logPath); builder.Host.UseSerilog((context, services, configuration) => @@ -70,7 +70,7 @@ public class Program app.UseRequestLocalization(); app.UseSerilogRequestLogging(); - // configure the HTTP request pipeline. + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment() && Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER") != "true") { app.UseExceptionHandler("/home/error"); @@ -83,33 +83,33 @@ public class Program { OnPrepareResponse = staticFileResponseContext => { - // disable static file caching during development + // Disable static file caching during development. if (app.Environment.IsDevelopment()) { staticFileResponseContext.Context.Response.Headers.Append("Cache-Control", "no-cache, no-store"); staticFileResponseContext.Context.Response.Headers.Append("Expires", "-1"); } }, - // prevent static files from being processed by routing + // Prevent static files from being processed by routing. ServeUnknownFileTypes = true }); - app.UseCultureRedirect(); // if the user attempts to go to a localized route without providing a culture, redirect to default culture - app.UseApiExceptionHandling(); // handle any problem details returned by the API + app.UseCultureRedirect(); // If the user attempts to go to a localized route without providing a culture, redirect to default culture. + app.UseApiExceptionHandling(); // Handle any problem details returned by the API. app.UseRouting(); - app.UseRequestLocalization(); // set the culture from the localized routes - // restore the Cache-Control chosen by the endpoint after the antiforgery and session middlewares overwrite it + app.UseRequestLocalization(); // Set the culture from the localized routes. + // Restore the Cache-Control chosen by the endpoint after the antiforgery and session middlewares overwrite it. app.UseCacheControlHeader(); app.UseSession(); app.UseAuthentication(); app.UseAuthorization(); // The rate limiting policies are evaluated after authentication, because the track stream limit is partitioned per authenticated user. app.UseRateLimiter(); - // validate the antiforgery token after authentication, because the token is bound to the authenticated user and - // validating it before the user is known would reject every request made by a logged-in user + // Validate the antiforgery token after authentication, because the token is bound to the authenticated user and + // validating it before the user is known would reject every request made by a logged-in user. app.UseAntiforgeryFE(additionalContentTypes: ["application/json"]); app.UseForwardedHeaders(); - // handle path base from reverse proxies + // Handle path base from reverse proxies. app.Use((context, next) => { context.Response.Headers["X-Content-Type-Options"] = "nosniff"; @@ -121,7 +121,7 @@ public class Program app.UseFastEndpoints(); - // add API documentation (OpenApi/Scalar), so that the endpoints exposed by the web application are discoverable and their contracts are visible + // Add API documentation (OpenApi/Scalar), so that the endpoints exposed by the web application are discoverable and their contracts are visible. app.MapOpenApi(); app.UseOpenApi(openApiDocumentMiddlewareSettings => openApiDocumentMiddlewareSettings.Path = "/openapi/{documentName}.json"); app.MapScalarApiReference(scalarOptions => @@ -132,8 +132,8 @@ public class Program .WithDotNetFlag(true); }); - // liveness and readiness probes, probed by container orchestrators and load balancers; the readiness probe also - // verifies that the API is reachable, so the web application is only reported ready when it can actually serve requests + // Liveness and readiness probes, probed by container orchestrators and load balancers; the readiness probe also + // verifies that the API is reachable, so the web application is only reported ready when it can actually serve requests. app.MapHealthChecks("/health/live", new HealthCheckOptions { Predicate = _ => false }); app.MapHealthChecks("/health/ready", new HealthCheckOptions { Predicate = healthCheck => healthCheck.Tags.Contains("ready") });