Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/NexusMods.Abstractions.Games/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public static IServiceCollection AddGames(this IServiceCollection services)
{
return services
.AddSingleton<SortOrderManager>()
.AddSortOrderItemModel()
.AddSortOrderQueriesSql()
.AddLoadoutItemGroupPriorityModel();
.AddSortOrderQueriesSql();
}
}
13 changes: 0 additions & 13 deletions src/NexusMods.Abstractions.Loadouts/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ public static IServiceCollection AddLoadoutAbstractions(this IServiceCollection
.AddBindingConverter<LoadoutId, ulong>(l => l.Value.Value)
.AddBindingConverter<LocationId, ushort>(l => l.Value)
.AddValueAdaptor<ushort, LocationId>(LocationId.From)
.AddLoadoutModel()
.AddLoadoutItemModel()
.AddLoadoutItemGroupModel()
.AddLoadoutGameFilesGroupModel()
.AddLoadoutOverridesGroupModel()
.AddLibraryLinkedLoadoutItemModel()
.AddLoadoutItemWithTargetPathModel()
.AddLoadoutFileModel()
.AddLoadoutSnapshotModel()
.AddDeletedFileModel()
.AddCollectionGroupModel()
.AddSortOrderModel()
.AddGameBackedUpFileModel()
.AddLoadoutQueriesSql();
}
}
33 changes: 0 additions & 33 deletions src/NexusMods.Abstractions.NexusModsLibrary/Services.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/NexusMods.App/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public static IServiceCollection AddApp(
if (startupMode.RunAsMain)
{
services
.AddDatabaseModels()
.AddEpicGameStore()
.AddSingleton<TimeProvider>(_ => TimeProvider.System)
.AddDataModel()
.AddLibrary()
.AddLibraryModels()
.AddJobMonitor()
.AddNexusModsCollections()

Expand Down
93 changes: 93 additions & 0 deletions src/NexusMods.Backend/DependencyInjection.Models.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using Microsoft.Extensions.DependencyInjection;
using NexusMods.Abstractions.Collections;
using NexusMods.Abstractions.Games;
using NexusMods.Abstractions.Games.FileHashes.Models;
using NexusMods.Abstractions.Loadouts;
using NexusMods.Abstractions.Loadouts.Synchronizers.Conflicts;
using NexusMods.Abstractions.NexusModsLibrary;
using NexusMods.Abstractions.NexusModsLibrary.Models;
using NexusMods.DataModel.SchemaVersions;
using NexusMods.Networking.GOG.Models;
using NexusMods.Networking.NexusWebApi.Auth;
using NexusMods.Networking.NexusWebApi.UpdateFilters;
using NexusMods.Networking.NexusWebApi.V1Interop;
using NexusMods.Sdk.Games;
using NexusMods.Sdk.Library;
using NexusMods.Sdk.Loadouts;
using NexusMods.Sdk.Resources;

namespace NexusMods.Backend;

public static partial class DependencyInjection
{
/// <summary>
/// Registers all Mnemonic database models
/// </summary>
public static IServiceCollection AddDatabaseModels(this IServiceCollection serviceCollection)
{
// NOTE(erri120): To make merge conflicts easier to handle, please sort this list lexicographically
return serviceCollection
.AddApiKeyModel()
.AddAuthInfoModel()
.AddCollectionCategoryModel()
.AddCollectionDownloadBundledModel()
.AddCollectionDownloadExternalModel()
.AddCollectionDownloadModel()
.AddCollectionDownloadNexusModsModel()
.AddCollectionDownloadRulesModel()
.AddCollectionGroupModel()
.AddCollectionMetadataModel()
.AddCollectionRevisionMetadataModel()
.AddDeletedFileModel()
.AddDirectDownloadLibraryFileModel()
.AddDiskStateEntryModel()
.AddDownloadedFileModel()
.AddEpicGameStoreBuildModel()
.AddGameBackedUpFileModel()
.AddGameDomainToGameIdMappingModel()
.AddGameInstallMetadataModel()
.AddGogBuildModel()
.AddGogDepotModel()
.AddGogManifestModel()
.AddHashRelationModel()
.AddIgnoreFileUpdateModel()
.AddJWTTokenModel()
.AddLibraryArchiveFileEntryModel()
.AddLibraryArchiveModel()
.AddLibraryFileModel()
.AddLibraryItemModel()
.AddLibraryLinkedLoadoutItemModel()
.AddLoadoutFileModel()
.AddLoadoutGameFilesGroupModel()
.AddLoadoutItemGroupModel()
.AddLoadoutItemGroupPriorityModel()
.AddLoadoutItemModel()
.AddLoadoutItemWithTargetPathModel()
.AddLoadoutModel()
.AddLoadoutOverridesGroupModel()
.AddLoadoutSnapshotModel()
.AddLocalFileModel()
.AddManagedCollectionLoadoutGroupModel()
.AddManuallyAddedGameModel()
.AddManuallyCreatedArchiveModel()
.AddMigrationLogItemModel()
.AddNexusCollectionBundledLoadoutGroupModel()
.AddNexusCollectionItemLoadoutGroupModel()
.AddNexusCollectionLoadoutGroupModel()
.AddNexusCollectionReplicatedLoadoutGroupModel()
.AddNexusModsCollectionLibraryFileModel()
.AddNexusModsFileMetadataModel()
.AddNexusModsLibraryItemModel()
.AddNexusModsModPageMetadataModel()
.AddPathHashRelationModel()
.AddPersistedDbResourceModel()
.AddSchemaVersionModel()
.AddSettingModel()
.AddSortOrderItemModel()
.AddSortOrderModel()
.AddSteamManifestModel()
.AddUserModel()
.AddVersionDefinitionModel()
; // NOTE(erri120): kept on a separate line for easier merge conflicts
}
}
3 changes: 3 additions & 0 deletions src/NexusMods.Backend/NexusMods.Backend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<ProjectReference Include="..\NexusMods.Abstractions.Games.FileHashes\NexusMods.Abstractions.Games.FileHashes.csproj" />
<ProjectReference Include="..\NexusMods.Abstractions.Games\NexusMods.Abstractions.Games.csproj" />
<ProjectReference Include="..\NexusMods.Abstractions.Loadouts.Synchronizers\NexusMods.Abstractions.Loadouts.Synchronizers.csproj" />
<ProjectReference Include="..\NexusMods.DataModel.SchemaVersions\NexusMods.DataModel.SchemaVersions.csproj" />
<ProjectReference Include="..\NexusMods.Networking.GOG\NexusMods.Networking.GOG.csproj" />
<ProjectReference Include="..\NexusMods.Networking.NexusWebApi\NexusMods.Networking.NexusWebApi.csproj" />
<ProjectReference Include="..\NexusMods.Sdk\NexusMods.Sdk.csproj" />
<ProjectReference Include="..\NexusMods.UI.Sdk\NexusMods.UI.Sdk.csproj" />
</ItemGroup>
Expand Down
9 changes: 3 additions & 6 deletions src/NexusMods.Backend/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ public static IServiceCollection AddGameServices(this IServiceCollection service
return serviceCollection
.AddSingleton<IGameLocationsService, GameLocationsService>()
.AddSingleton<IGameRegistry, GameRegistry>()
.AddGameInstallMetadataModel()
.AddSettings<GameLocatorSettings>()
.AddSingleton<IGameLocator, ManuallyAddedLocator>()
.AddManuallyAddedGameModel();
.AddSingleton<IGameLocator, ManuallyAddedLocator>();
}

public static IServiceCollection AddOSInterop(this IServiceCollection serviceCollection, IOSInformation? os = null)
Expand Down Expand Up @@ -161,10 +159,9 @@ public static IServiceCollection AddSettingsManager(this IServiceCollection serv
IconFunc: () => IconValues.WarningAmber,
Priority: ushort.MinValue,
Hidden: !ApplicationConstants.IsDebug
))
.AddSettingModel();
));
}

/// <summary>
/// Adds file extraction related services to the provided DI container.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions src/NexusMods.Collections/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ public static class Services
public static IServiceCollection AddNexusModsCollections(this IServiceCollection services)
{
return services
.AddManagedCollectionLoadoutGroupModel()
.AddNexusCollectionLoadoutGroupModel()
.AddDirectDownloadLibraryFileModel()
.AddNexusCollectionBundledLoadoutGroupModel()
.AddNexusCollectionItemLoadoutGroupModel()
.AddNexusCollectionReplicatedLoadoutGroupModel()
.AddCollectionVerbs()
.AddSingleton<CollectionDownloader>()
.AddSettings<DownloadSettings>();
Expand Down
2 changes: 0 additions & 2 deletions src/NexusMods.DataModel.SchemaVersions/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public static class Services
{
public static IServiceCollection AddMigrations(this IServiceCollection services)
{
services.AddSchemaVersionModel();
services.AddMigrationLogItemModel();
services.AddTransient<MigrationService>();

// Migrations go here:
Expand Down
4 changes: 0 additions & 4 deletions src/NexusMods.DataModel/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public static IServiceCollection AddDataModel(this IServiceCollection coll)
coll.AddAllSingleton<IToolManager, ToolManager>();

// Disk State and Synchronizer
coll.AddDiskStateEntryModel();
coll.AddAllSingleton<ISynchronizerService, SynchronizerService>();

coll.AddSingleton<ITypeFinder>(_ => new AssemblyTypeFinder(typeof(Services).Assembly));
Expand All @@ -103,9 +102,6 @@ public static IServiceCollection AddDataModel(this IServiceCollection coll)
// GC
coll.AddAllSingleton<IGarbageCollectorRunner, GarbageCollectorRunner>();


coll.AddPersistedDbResourceModel();

// Undo
coll.AddSingleton<UndoService>();

Expand Down
10 changes: 1 addition & 9 deletions src/NexusMods.Games.FileHashes/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ public static class Services
public static IServiceCollection AddFileHashes(this IServiceCollection services)
{
return services.AddFileHashesVerbs()
.AddPathHashRelationModel()
.AddVersionDefinitionModel()
.AddGogBuildModel()
.AddGogDepotModel()
.AddGogManifestModel()
.AddSteamManifestModel()
.AddEpicGameStoreBuildModel()
.AddFileHashesQueriesSql()
.AddSingleton<IFileHashesService, FileHashesService>()
.AddSingleton<IHostedService>(s => (IHostedService)s.GetRequiredService<IFileHashesService>())
.AddSettings<FileHashesServiceSettings>()
.AddHashRelationModel();
.AddSettings<FileHashesServiceSettings>();
}

}
1 change: 0 additions & 1 deletion src/NexusMods.Networking.GOG/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static IServiceCollection AddGOG(this IServiceCollection services)
{
services.AddGOGVerbs();
services.AddSingleton<IClient, Client>();
services.AddAuthInfoModel();
services.AddOptionParser(s => ProductId.From(ulong.Parse(s)));
return services;
}
Expand Down
5 changes: 0 additions & 5 deletions src/NexusMods.Networking.NexusWebApi/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@ public static IServiceCollection AddNexusWebApi(this IServiceCollection collecti
collection.AddSingleton<OAuth>();
collection.AddSingleton<IIDGenerator, IDGenerator>();

collection.AddJWTTokenModel();
collection.AddApiKeyModel();
collection.AddSingleton(TimeProvider.System);
collection.AddIgnoreFileUpdateModel();

collection.AddGameDomainToGameIdMappingModel();
collection.AddSingleton<GameDomainToGameIdMappingCache>();
collection.AddSingleton<IGameDomainToGameIdMappingCache>(serviceProvider =>
{
Expand All @@ -68,7 +64,6 @@ public static IServiceCollection AddNexusWebApi(this IServiceCollection collecti
});

collection
.AddNexusModsLibraryModels()
.AddSingleton<IGraphQlClient, GraphQlClient>()
.AddSingleton<NexusModsLibrary>()
.AddAllSingleton<ILoginManager, LoginManager>()
Expand Down
26 changes: 0 additions & 26 deletions src/NexusMods.Sdk/Library/Services.cs

This file was deleted.

4 changes: 0 additions & 4 deletions src/NexusMods.Sdk/NexusMods.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,4 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Models\Library\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static class DependencyInjectionHelper
.Combine($"NexusMods.Games.TestFramework-{Guid.NewGuid()}") : prefix;

serviceCollection
.AddDatabaseModels()
.AddLogging(builder => builder.AddXunitOutput().SetMinimumLevel(LogLevel.Debug))
.AddSerializationAbstractions()
.AddFileSystem()
Expand All @@ -69,7 +70,6 @@ public static class DependencyInjectionHelper
.AddHttpDownloader()
.AddDataModel()
.AddLibrary()
.AddLibraryModels()
.AddJobMonitor()
.OverrideSettingsForTests<DataModelSettings>(settings => settings with
{
Expand All @@ -88,15 +88,7 @@ public static class DependencyInjectionHelper

if (stubbedFileHashService)
serviceCollection
.AddPathHashRelationModel()
.AddVersionDefinitionModel()
.AddGogBuildModel()
.AddGogDepotModel()
.AddGogManifestModel()
.AddSteamManifestModel()
.AddEpicGameStoreBuildModel()
.AddFileHashesQueriesSql()
.AddHashRelationModel()
.AddSingleton<IFileHashesService, StubbedFileHasherService>();
else
serviceCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
using NexusMods.Backend;
using NexusMods.CrossPlatform;
using NexusMods.DataModel;
using NexusMods.FileExtractor;
using NexusMods.Games.FileHashes;
using NexusMods.Library;
using NexusMods.Networking.HttpDownloader;
using NexusMods.Networking.HttpDownloader.Tests;
using NexusMods.Paths;
using NexusMods.Sdk;
using NexusMods.Sdk.Library;
using NexusMods.Sdk.Settings;
using Xunit.DependencyInjection.Logging;

Expand All @@ -23,6 +21,7 @@ public class Startup
public void ConfigureServices(IServiceCollection services)
{
services
.AddDatabaseModels()
.AddGameServices()
.AddSerializationAbstractions()
.AddFileSystem()
Expand All @@ -37,7 +36,6 @@ public void ConfigureServices(IServiceCollection services)
.AddLoadoutAbstractions()
.AddJobMonitor()
.AddLibrary()
.AddLibraryModels()
.AddFileExtractors()
.AddFileHashes()
.AddDataModel() // this is required because we're also using NMA integration
Expand Down
Loading
Loading