From ea6e0f92ce9f7c02b9999d85fc9c1eec6c494bfb Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 11:34:30 +0200 Subject: [PATCH 01/12] Fix --- .gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 56f19b4302..49a746641d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -36,7 +36,6 @@ *.sln text eol=crlf *.csproj text eol=crlf -*.props text eol=crlf *.targets text eol=crlf *.filters text eol=crlf *.filters text eol=crlf From c3d6525cb33da7bab31eaaf7d6686e6e2bfe5f52 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 11:54:24 +0200 Subject: [PATCH 02/12] Move `ILibraryService` --- NexusMods.App.sln | 9 ++++++- .../ALibraryArchiveInstaller.cs | 2 +- .../ALibraryFileInstaller.cs | 2 +- .../ALibraryItemInstaller.cs | 2 +- .../Extensions.cs | 3 --- .../IArchiveInstaller.cs | 1 - .../ILibraryArchiveInstaller.cs | 2 +- .../ILibraryFileInstaller.cs | 2 +- .../ILibraryItemInstaller.cs | 2 +- .../ModInstallerInfo.cs | 2 -- .../ModInstallerResult.cs | 2 -- .../NexusMods.Abstractions.Installers.csproj | 1 - .../ILibraryService.cs | 15 ++++++++++++ .../NexusMods.Abstractions.Library.csproj | 20 ++-------------- .../LibraryArchive.cs | 2 +- .../LibraryArchiveFileEntry.cs | 2 +- .../LibraryFile.cs | 2 +- .../LibraryItem.cs | 2 +- .../LocalFile.cs | 2 +- ...exusMods.Abstractions.LibraryModels.csproj | 24 +++++++++++++++++++ .../Services.cs | 2 +- .../LibraryLinkedLoadoutItem.cs | 2 +- .../LoadoutItem.cs | 2 +- .../NexusMods.Abstractions.Loadouts.csproj | 2 +- ...sMods.Abstractions.NexusModsLibrary.csproj | 2 +- .../NexusModsLibraryFile.cs | 2 +- src/NexusMods.Library/AddLibraryFileJob.cs | 2 +- .../AddLibraryFileJobWorker.cs | 2 +- .../AddLocalFileJobWorker.cs | 2 +- src/NexusMods.Library/LibraryService.cs | 13 ++++++++++ .../NexusMods.Library.csproj | 1 + 31 files changed, 83 insertions(+), 48 deletions(-) rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/LibraryArchive.cs (94%) rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/LibraryArchiveFileEntry.cs (93%) rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/LibraryFile.cs (94%) rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/LibraryItem.cs (91%) rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/LocalFile.cs (92%) create mode 100644 src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj rename src/Abstractions/{NexusMods.Abstractions.Library => NexusMods.Abstractions.LibraryModels}/Services.cs (92%) diff --git a/NexusMods.App.sln b/NexusMods.App.sln index 5086507845..84d9c404bb 100644 --- a/NexusMods.App.sln +++ b/NexusMods.App.sln @@ -214,7 +214,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interprocess", "Interproces EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Settings.Tests", "tests\NexusMods.Settings.Tests\NexusMods.Settings.Tests.csproj", "{0D289DCE-1B17-4B63-B8B3-47CB852BF5B4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Library", "src\Abstractions\NexusMods.Abstractions.Library\NexusMods.Abstractions.Library.csproj", "{0044D340-E435-489C-A425-139AAB2EA205}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.LibraryModels", "src\Abstractions\NexusMods.Abstractions.LibraryModels\NexusMods.Abstractions.LibraryModels.csproj", "{0044D340-E435-489C-A425-139AAB2EA205}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.NexusModsLibrary", "src\Abstractions\NexusMods.Abstractions.NexusModsLibrary\NexusMods.Abstractions.NexusModsLibrary.csproj", "{5D85EBB2-755F-4148-BFC4-8D2245A3105B}" EndProject @@ -228,6 +228,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Jobs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Jobs.Tests", "tests\NexusMods.Jobs.Tests\NexusMods.Jobs.Tests.csproj", "{01043F6A-121B-4B3C-A694-B823D9CD0BB0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Library", "src\Abstractions\NexusMods.Abstractions.Library\NexusMods.Abstractions.Library.csproj", "{C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -586,6 +588,10 @@ Global {01043F6A-121B-4B3C-A694-B823D9CD0BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU {01043F6A-121B-4B3C-A694-B823D9CD0BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU {01043F6A-121B-4B3C-A694-B823D9CD0BB0}.Release|Any CPU.Build.0 = Release|Any CPU + {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -690,6 +696,7 @@ Global {821C1DA9-040E-44F3-BFCA-BF026C3F254B} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} {D15413CA-E727-40DA-8CD8-29ED052BF427} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} {01043F6A-121B-4B3C-A694-B823D9CD0BB0} = {52AF9D62-7D5B-4AD0-BA12-86F2AA67428B} + {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9F9F8352-34DD-42C0-8564-EE9AF34A3501} diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs index b503cb9e2c..b74f17726f 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs index 601542c220..431d99887d 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs index 58420b4ca2..f268921ada 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/Extensions.cs b/src/Abstractions/NexusMods.Abstractions.Installers/Extensions.cs index 2f4851e77d..c899a23a7e 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/Extensions.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/Extensions.cs @@ -1,9 +1,6 @@ -using System.Collections.Immutable; using NexusMods.Abstractions.FileStore.Trees; using NexusMods.Abstractions.GameLocators; using NexusMods.Abstractions.Loadouts.Files; -using NexusMods.Abstractions.Loadouts.Mods; -using NexusMods.Abstractions.Serialization; using NexusMods.MnemonicDB.Abstractions.Models; using NexusMods.Paths; using NexusMods.Paths.Trees; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/IArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/IArchiveInstaller.cs index c7a1a044df..b7c6dba0ad 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/IArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/IArchiveInstaller.cs @@ -1,7 +1,6 @@ using NexusMods.Abstractions.Activities; using NexusMods.Abstractions.FileStore.Downloads; using NexusMods.Abstractions.Loadouts; -using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; namespace NexusMods.Abstractions.Installers; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs index d5fe51ba66..75013e8c8a 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs index 1128ba3369..7b46719bea 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs index 29d5d73887..c9acdf185d 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerInfo.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerInfo.cs index 0708b0bd80..baa7ad4b11 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerInfo.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerInfo.cs @@ -1,8 +1,6 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.FileStore.ArchiveMetadata; using NexusMods.Abstractions.FileStore.Downloads; using NexusMods.Abstractions.GameLocators; -using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; using ModFileTreeNode = NexusMods.Paths.Trees.KeyedBox; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerResult.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerResult.cs index 4729381f5a..f3cb3d4ac0 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerResult.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ModInstallerResult.cs @@ -1,6 +1,4 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.DataModel.Entities.Sorting; -using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj b/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj index d7cee6417e..77ce4fe2cc 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj @@ -3,7 +3,6 @@ - diff --git a/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs b/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs index 67702580f5..6141e33f20 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs @@ -1,5 +1,8 @@ using JetBrains.Annotations; +using NexusMods.Abstractions.Downloads; using NexusMods.Abstractions.Jobs; +using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Loadouts; using NexusMods.Paths; namespace NexusMods.Abstractions.Library; @@ -10,8 +13,20 @@ namespace NexusMods.Abstractions.Library; [PublicAPI] public interface ILibraryService { + /// + /// Adds a download to the library. + /// + IJob AddDownload(IDownloadJob downloadJob); + /// /// Adds a local file to the library. /// IJob AddLocalFile(AbsolutePath absolutePath); + + /// + /// Installs a library item into a target loadout. + /// + /// The item to install. + /// The target loadout. + IJob InstallItem(LibraryItem.ReadOnly libraryItem, Loadout.ReadOnly targetLoadout); } diff --git a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj index c838fae56b..752ab2ee71 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj @@ -1,25 +1,9 @@  - - - - - - - + + - - - LibraryItem.cs - - - LibraryItem.cs - - - LibraryArchive.cs - - diff --git a/src/Abstractions/NexusMods.Abstractions.Library/LibraryArchive.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs similarity index 94% rename from src/Abstractions/NexusMods.Abstractions.Library/LibraryArchive.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs index 0a4957a5b5..a3ef14de0b 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/LibraryArchive.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Represents an archive in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.Library/LibraryArchiveFileEntry.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs similarity index 93% rename from src/Abstractions/NexusMods.Abstractions.Library/LibraryArchiveFileEntry.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs index 18ca85ec87..2d4f79409f 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/LibraryArchiveFileEntry.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs @@ -3,7 +3,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Represents a file inside a library archive. diff --git a/src/Abstractions/NexusMods.Abstractions.Library/LibraryFile.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs similarity index 94% rename from src/Abstractions/NexusMods.Abstractions.Library/LibraryFile.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs index e5821acc8c..6ebb461cae 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/LibraryFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs @@ -2,7 +2,7 @@ using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Represents a that is a file in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.Library/LibraryItem.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs similarity index 91% rename from src/Abstractions/NexusMods.Abstractions.Library/LibraryItem.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs index 1ebd1c30b0..f31c182ca5 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/LibraryItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Represents an item in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.Library/LocalFile.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs similarity index 92% rename from src/Abstractions/NexusMods.Abstractions.Library/LocalFile.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs index 0b94a808cd..3aedae57ca 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/LocalFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Represents a local file in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj b/src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj new file mode 100644 index 0000000000..b27970d59b --- /dev/null +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + LibraryItem.cs + + + LibraryItem.cs + + + LibraryArchive.cs + + + diff --git a/src/Abstractions/NexusMods.Abstractions.Library/Services.cs b/src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs similarity index 92% rename from src/Abstractions/NexusMods.Abstractions.Library/Services.cs rename to src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs index 33a0624467..b1777170b7 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/Services.cs +++ b/src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using NexusMods.Abstractions.MnemonicDB.Attributes; -namespace NexusMods.Abstractions.Library; +namespace NexusMods.Abstractions.LibraryModels; /// /// Extension methods. diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs b/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs index fcef28fb93..d7502ac7d7 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs b/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs index c0a48596b9..4ad7569047 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj b/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj index 6fa6ed2177..9ba95ef4c9 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj @@ -7,7 +7,7 @@ - + all diff --git a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj index 7fca010760..9ad0fc65af 100644 --- a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj +++ b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs index 27e321daa1..6bad434015 100644 --- a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/NexusMods.Library/AddLibraryFileJob.cs b/src/NexusMods.Library/AddLibraryFileJob.cs index 658245ca14..1385721d40 100644 --- a/src/NexusMods.Library/AddLibraryFileJob.cs +++ b/src/NexusMods.Library/AddLibraryFileJob.cs @@ -1,6 +1,6 @@ using DynamicData.Kernel; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; diff --git a/src/NexusMods.Library/AddLibraryFileJobWorker.cs b/src/NexusMods.Library/AddLibraryFileJobWorker.cs index a7c98227d3..c80beff2f6 100644 --- a/src/NexusMods.Library/AddLibraryFileJobWorker.cs +++ b/src/NexusMods.Library/AddLibraryFileJobWorker.cs @@ -4,7 +4,7 @@ using NexusMods.Abstractions.FileExtractor; using NexusMods.Abstractions.IO.StreamFactories; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Hashing.xxHash64; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; diff --git a/src/NexusMods.Library/AddLocalFileJobWorker.cs b/src/NexusMods.Library/AddLocalFileJobWorker.cs index e5304cabd0..3323094e24 100644 --- a/src/NexusMods.Library/AddLocalFileJobWorker.cs +++ b/src/NexusMods.Library/AddLocalFileJobWorker.cs @@ -1,7 +1,7 @@ using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; namespace NexusMods.Library; diff --git a/src/NexusMods.Library/LibraryService.cs b/src/NexusMods.Library/LibraryService.cs index 4734ecb011..f7fe213195 100644 --- a/src/NexusMods.Library/LibraryService.cs +++ b/src/NexusMods.Library/LibraryService.cs @@ -1,7 +1,10 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using NexusMods.Abstractions.Downloads; using NexusMods.Abstractions.Jobs; using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; @@ -26,6 +29,11 @@ public LibraryService(ILogger logger, IConnection connection, IS _serviceProvider = serviceProvider; } + public IJob AddDownload(IDownloadJob downloadJob) + { + throw new NotImplementedException(); + } + public IJob AddLocalFile(AbsolutePath absolutePath) { var group = new AddLocalFileJob(worker: _serviceProvider.GetRequiredService()) @@ -36,4 +44,9 @@ public IJob AddLocalFile(AbsolutePath absolutePath) return group; } + + public IJob InstallItem(LibraryItem.ReadOnly libraryItem, Loadout.ReadOnly targetLoadout) + { + throw new NotImplementedException(); + } } diff --git a/src/NexusMods.Library/NexusMods.Library.csproj b/src/NexusMods.Library/NexusMods.Library.csproj index f141f3c01f..4f670d18b7 100644 --- a/src/NexusMods.Library/NexusMods.Library.csproj +++ b/src/NexusMods.Library/NexusMods.Library.csproj @@ -3,6 +3,7 @@ + From 87c6513983f8e592a817769c19b9a1271ecf6223 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 12:14:48 +0200 Subject: [PATCH 03/12] Add `IJobMonitor` --- NexusMods.App.sln | 7 +++ .../NexusMods.Abstractions.Jobs/AJob.cs | 5 ++- .../IJobMonitor.cs | 27 ++++++++++++ src/NexusMods.Jobs/JobMonitor.cs | 43 +++++++++++++++++++ src/NexusMods.Jobs/NexusMods.Jobs.csproj | 5 +++ src/NexusMods.Jobs/Services.cs | 12 ++++++ 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 src/Abstractions/NexusMods.Abstractions.Jobs/IJobMonitor.cs create mode 100644 src/NexusMods.Jobs/JobMonitor.cs create mode 100644 src/NexusMods.Jobs/NexusMods.Jobs.csproj create mode 100644 src/NexusMods.Jobs/Services.cs diff --git a/NexusMods.App.sln b/NexusMods.App.sln index 84d9c404bb..ed0637300a 100644 --- a/NexusMods.App.sln +++ b/NexusMods.App.sln @@ -230,6 +230,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Jobs.Tests", "tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Library", "src\Abstractions\NexusMods.Abstractions.Library\NexusMods.Abstractions.Library.csproj", "{C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Jobs", "src\NexusMods.Jobs\NexusMods.Jobs.csproj", "{44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -592,6 +594,10 @@ Global {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Debug|Any CPU.Build.0 = Debug|Any CPU {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Release|Any CPU.ActiveCfg = Release|Any CPU {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0}.Release|Any CPU.Build.0 = Release|Any CPU + {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -697,6 +703,7 @@ Global {D15413CA-E727-40DA-8CD8-29ED052BF427} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} {01043F6A-121B-4B3C-A694-B823D9CD0BB0} = {52AF9D62-7D5B-4AD0-BA12-86F2AA67428B} {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} + {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9} = {E7BAE287-D505-4D6D-A090-665A64309B2D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9F9F8352-34DD-42C0-8564-EE9AF34A3501} diff --git a/src/Abstractions/NexusMods.Abstractions.Jobs/AJob.cs b/src/Abstractions/NexusMods.Abstractions.Jobs/AJob.cs index 26ddaecb4a..53f9b45691 100644 --- a/src/Abstractions/NexusMods.Abstractions.Jobs/AJob.cs +++ b/src/Abstractions/NexusMods.Abstractions.Jobs/AJob.cs @@ -42,7 +42,8 @@ public abstract class AJob : IJobGroup, IDisposable, IAsyncDisposable protected AJob( MutableProgress progress, IJobGroup? group = default, - IJobWorker? worker = default) + IJobWorker? worker = default, + IJobMonitor? monitor = default) { Id = JobId.NewId(); Status = JobStatus.None; @@ -64,6 +65,8 @@ protected AJob( _collection = []; _observableCollection = new ObservableCollection(_collection); ObservableCollection = new ReadOnlyObservableCollection(_observableCollection); + + monitor?.RegisterJob(this); } public IEnumerator GetEnumerator() => _collection.GetEnumerator(); diff --git a/src/Abstractions/NexusMods.Abstractions.Jobs/IJobMonitor.cs b/src/Abstractions/NexusMods.Abstractions.Jobs/IJobMonitor.cs new file mode 100644 index 0000000000..91592501ee --- /dev/null +++ b/src/Abstractions/NexusMods.Abstractions.Jobs/IJobMonitor.cs @@ -0,0 +1,27 @@ +using System.Collections.ObjectModel; +using DynamicData; +using JetBrains.Annotations; + +namespace NexusMods.Abstractions.Jobs; + +/// +/// Represents a monitor for jobs. +/// +[PublicAPI] +public interface IJobMonitor +{ + /// + /// Gets an observable collection containing every job the monitor knows about. + /// + ReadOnlyObservableCollection Jobs { get; } + + /// + /// Gets an observable with changeset for jobs of type . + /// + IObservable> GetObservableChangeSet() where TJob : IJob; + + /// + /// Registers a job with the monitor. + /// + void RegisterJob(IJob job); +} diff --git a/src/NexusMods.Jobs/JobMonitor.cs b/src/NexusMods.Jobs/JobMonitor.cs new file mode 100644 index 0000000000..21a624f12d --- /dev/null +++ b/src/NexusMods.Jobs/JobMonitor.cs @@ -0,0 +1,43 @@ +using System.Collections.ObjectModel; +using System.Reactive.Disposables; +using DynamicData; +using JetBrains.Annotations; +using NexusMods.Abstractions.Jobs; + +namespace NexusMods.Jobs; + +[UsedImplicitly] +public sealed class JobMonitor : IJobMonitor, IDisposable +{ + private readonly SourceCache _jobSourceCache = new(job => job.Id); + private readonly ReadOnlyObservableCollection _jobs; + public ReadOnlyObservableCollection Jobs => _jobs; + + private readonly CompositeDisposable _compositeDisposable = new(); + + public JobMonitor() + { + var disposable = _jobSourceCache + .Connect() + .Bind(out _jobs) + .Subscribe(); + + _compositeDisposable.Add(disposable); + } + + public IObservable> GetObservableChangeSet() where TJob : IJob + { + return _jobSourceCache.Connect().OfType(); + } + + public void RegisterJob(IJob job) + { + _jobSourceCache.AddOrUpdate(job); + } + + public void Dispose() + { + _compositeDisposable.Dispose(); + _jobSourceCache.Dispose(); + } +} diff --git a/src/NexusMods.Jobs/NexusMods.Jobs.csproj b/src/NexusMods.Jobs/NexusMods.Jobs.csproj new file mode 100644 index 0000000000..d341e0f871 --- /dev/null +++ b/src/NexusMods.Jobs/NexusMods.Jobs.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/src/NexusMods.Jobs/Services.cs b/src/NexusMods.Jobs/Services.cs new file mode 100644 index 0000000000..e6c1d012bf --- /dev/null +++ b/src/NexusMods.Jobs/Services.cs @@ -0,0 +1,12 @@ +using Microsoft.Extensions.DependencyInjection; +using NexusMods.Abstractions.Jobs; + +namespace NexusMods.Jobs; + +public static class Services +{ + public static IServiceCollection AddJobMonitor(this IServiceCollection serviceCollection) + { + return serviceCollection.AddSingleton(); + } +} From 6edd98387500cd5db830eb176e317fc2e6bfc1e5 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 12:52:52 +0200 Subject: [PATCH 04/12] Shadow traffic test --- .../NexusMods.Abstractions.Jobs/JobResult.cs | 31 +++++++++++-- src/NexusMods.App/NexusMods.App.csproj | 2 + src/NexusMods.App/Services.cs | 7 +++ src/NexusMods.DataModel/FileOriginRegistry.cs | 46 +++++++++++++++---- .../NexusMods.DataModel.csproj | 1 + .../AddLibraryFileJobWorker.cs | 2 + src/NexusMods.Library/Services.cs | 6 ++- 7 files changed, 82 insertions(+), 13 deletions(-) diff --git a/src/Abstractions/NexusMods.Abstractions.Jobs/JobResult.cs b/src/Abstractions/NexusMods.Abstractions.Jobs/JobResult.cs index 8b082bf9c7..e5f85bdd09 100644 --- a/src/Abstractions/NexusMods.Abstractions.Jobs/JobResult.cs +++ b/src/Abstractions/NexusMods.Abstractions.Jobs/JobResult.cs @@ -78,18 +78,25 @@ public bool TryGetFailed([NotNullWhen(true)] out JobResultFailed? failed) return true; } + /// + /// Returns the data in the completed result or thrown an exception. + /// + /// The result isn't of type public TData RequireData() where TData : notnull { if (!TryGetCompleted(out var completed)) - throw new InvalidOperationException($"JobResult is of type `{ResultType}` but expected `{JobResultType.Completed}`"); + throw new InvalidOperationException($"JobResult is of type `{ResultType}` but expected `{JobResultType.Completed}`: `{ToString()}`"); if (!completed.TryGetData(out var data)) - throw new InvalidOperationException("Completed JobResult doesn't have data!"); + throw new InvalidOperationException($"Completed JobResult doesn't have data: `{ToString()}`"); return data; } + /// + /// Creates a failed job result from an exception. + /// [StackTraceHidden] public static JobResult CreateFailed(Exception exception) { @@ -99,15 +106,23 @@ public static JobResult CreateFailed(Exception exception) }); } + /// + /// Creates a failed job result from an error message. + /// [StackTraceHidden] public static JobResult CreateFailed(string message) { return CreateFailed(new Exception(message)); } + /// + /// Creates a cancelled job result. + /// [StackTraceHidden] public static JobResult CreateCancelled() => new(new JobResultCancelled()); - [StackTraceHidden] public static JobResult CreateCompleted() => new(new JobResultCompleted()); + /// + /// Creates a completed job result with data. + /// [StackTraceHidden] public static JobResult CreateCompleted(TData data) where TData : notnull @@ -117,4 +132,14 @@ public static JobResult CreateCompleted(TData data) Data = data, }); } + + /// + public override string ToString() + { + return _value.Match( + f0: x => x.ToString(), + f1: x => x.ToString(), + f2: x => x.ToString() + ); + } } diff --git a/src/NexusMods.App/NexusMods.App.csproj b/src/NexusMods.App/NexusMods.App.csproj index 7ea30baad5..f2fd49fab9 100644 --- a/src/NexusMods.App/NexusMods.App.csproj +++ b/src/NexusMods.App/NexusMods.App.csproj @@ -24,6 +24,8 @@ + + diff --git a/src/NexusMods.App/Services.cs b/src/NexusMods.App/Services.cs index 3260c7260e..6ee491b31d 100644 --- a/src/NexusMods.App/Services.cs +++ b/src/NexusMods.App/Services.cs @@ -3,6 +3,7 @@ using NexusMods.Abstractions.FileStore; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Settings; @@ -21,6 +22,8 @@ using NexusMods.Games.Generic; using NexusMods.Games.Reshade; using NexusMods.Games.TestHarness; +using NexusMods.Jobs; +using NexusMods.Library; using NexusMods.Networking.Downloaders; using NexusMods.Networking.HttpDownloader; using NexusMods.Networking.NexusWebApi; @@ -56,6 +59,10 @@ public static IServiceCollection AddApp(this IServiceCollection services, { services .AddDataModel() + .AddLibrary() + .AddLibraryModels() + .AddJobMonitor() + .AddSettings() .AddSettings() .AddSettings() diff --git a/src/NexusMods.DataModel/FileOriginRegistry.cs b/src/NexusMods.DataModel/FileOriginRegistry.cs index da92fb3dfc..10d99442a4 100644 --- a/src/NexusMods.DataModel/FileOriginRegistry.cs +++ b/src/NexusMods.DataModel/FileOriginRegistry.cs @@ -1,4 +1,5 @@ -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; using NexusMods.Abstractions.DiskState; using NexusMods.Abstractions.FileExtractor; @@ -7,6 +8,8 @@ using NexusMods.Abstractions.FileStore.Downloads; using NexusMods.Abstractions.IO; using NexusMods.Abstractions.IO.StreamFactories; +using NexusMods.Abstractions.Library; +using NexusMods.App.BuildInfo; using NexusMods.Extensions.Hashing; using NexusMods.Hashing.xxHash64; using NexusMods.MnemonicDB.Abstractions; @@ -23,6 +26,7 @@ namespace NexusMods.DataModel; public class FileOriginRegistry : IFileOriginRegistry { private readonly ILogger _logger; + private readonly ILibraryService _libraryService; private readonly IFileExtractor _extractor; private readonly IFileStore _fileStore; private readonly TemporaryFileManager _temporaryFileManager; @@ -30,17 +34,19 @@ public class FileOriginRegistry : IFileOriginRegistry private readonly IFileHashCache _fileHashCache; /// - /// DI Constructor + /// Constructor. /// - /// - /// - /// - /// - /// - public FileOriginRegistry(ILogger logger, IFileExtractor extractor, - IFileStore fileStore, TemporaryFileManager temporaryFileManager, IConnection conn, IFileHashCache fileHashCache) + public FileOriginRegistry( + ILogger logger, + ILibraryService library, + IFileExtractor extractor, + IFileStore fileStore, + TemporaryFileManager temporaryFileManager, + IConnection conn, + IFileHashCache fileHashCache) { _logger = logger; + _libraryService = library; _extractor = extractor; _fileStore = fileStore; _temporaryFileManager = temporaryFileManager; @@ -72,9 +78,28 @@ void AppendNestedArchiveMetadata(ITransaction tx, EntityId id) } } + private async Task ShadowTrafficTestLibraryService(AbsolutePath path, CancellationToken cancellationToken) + { + // TODO: https://github.com/Nexus-Mods/NexusMods.App/issues/1763 + if (!CompileConstants.IsDebug) return; + try + { + var job = _libraryService.AddLocalFile(path); + await job.StartAsync(cancellationToken: cancellationToken); + var result = await job.WaitToFinishAsync(cancellationToken: cancellationToken); + _logger.LogInformation("AddLocalFile result: `{Result}`", result.ToString()); + } + catch (Exception e) + { + _logger.LogError(e, "Exception adding local file to library"); + } + } + /// public async ValueTask RegisterDownload(AbsolutePath path, MetadataFn metaDataFn, string modName, CancellationToken token = default) { + await ShadowTrafficTestLibraryService(path, token); + var db = _conn.Db; var archiveSize = (ulong) path.FileInfo.Size; var archiveHash = (await _fileHashCache.IndexFileAsync(path, token)).Hash; @@ -88,8 +113,11 @@ public async ValueTask RegisterDownload(AbsolutePath path, MetadataF return await RegisterFolderInternal(tmpFolder.Path, metaDataFn, null, _fileStore.GetFileHashes(), archiveHash.Value, archiveSize, modName, token); } + /// public async ValueTask RegisterDownload(AbsolutePath path, EntityId id, string modName, CancellationToken token = default) { + await ShadowTrafficTestLibraryService(path, token); + var db = _conn.Db; var archiveSize = (ulong) path.FileInfo.Size; diff --git a/src/NexusMods.DataModel/NexusMods.DataModel.csproj b/src/NexusMods.DataModel/NexusMods.DataModel.csproj index da8ec57fb4..f6bd200d22 100644 --- a/src/NexusMods.DataModel/NexusMods.DataModel.csproj +++ b/src/NexusMods.DataModel/NexusMods.DataModel.csproj @@ -4,6 +4,7 @@ + diff --git a/src/NexusMods.Library/AddLibraryFileJobWorker.cs b/src/NexusMods.Library/AddLibraryFileJobWorker.cs index c80beff2f6..123c820d3e 100644 --- a/src/NexusMods.Library/AddLibraryFileJobWorker.cs +++ b/src/NexusMods.Library/AddLibraryFileJobWorker.cs @@ -120,6 +120,8 @@ await Parallel.ForAsync(fromInclusive: 0, toExclusive: extractedFiles.Length, ca results[i] = result; }); + + job.AddExtractedFileJobResults = results; } cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/NexusMods.Library/Services.cs b/src/NexusMods.Library/Services.cs index a1c343062b..5424aeb01b 100644 --- a/src/NexusMods.Library/Services.cs +++ b/src/NexusMods.Library/Services.cs @@ -15,6 +15,10 @@ public static class Services /// public static IServiceCollection AddLibrary(this IServiceCollection serviceCollection) { - return serviceCollection.AddSingleton(); + return serviceCollection + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton(); } } From 32dce3bead507f54256ca1b22fcf81e2bb0986cb Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 12:58:53 +0200 Subject: [PATCH 05/12] Fix garbage test setup --- .../DependencyInjectionHelper.cs | 6 ++++++ .../NexusMods.Games.TestFramework.csproj | 2 ++ tests/NexusMods.CLI.Tests/Startup.cs | 6 ++++++ tests/NexusMods.DataModel.Tests/FileOriginRegistryTests.cs | 4 ++++ .../NexusMods.DataModel.Tests.csproj | 2 ++ tests/NexusMods.DataModel.Tests/Startup.cs | 6 ++++++ 6 files changed, 26 insertions(+) diff --git a/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs b/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs index a63a7064c3..437fa969a5 100644 --- a/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs +++ b/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs @@ -4,12 +4,15 @@ using Microsoft.Extensions.Logging; using NexusMods.Abstractions.Activities; using NexusMods.Abstractions.HttpDownloader; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts.Synchronizers; using NexusMods.Abstractions.Settings; using NexusMods.Activities; using NexusMods.CrossPlatform; using NexusMods.DataModel; using NexusMods.FileExtractor; +using NexusMods.Jobs; +using NexusMods.Library; using NexusMods.Networking.HttpDownloader; using NexusMods.Networking.NexusWebApi; using NexusMods.Paths; @@ -59,6 +62,9 @@ public static IServiceCollection AddDefaultServicesForTesting(this IServiceColle .AddSettings() .AddHttpDownloader() .AddDataModel() + .AddLibrary() + .AddLibraryModels() + .AddJobMonitor() .AddLoadoutsSynchronizers() .OverrideSettingsForTests(settings => settings with { diff --git a/tests/Games/NexusMods.Games.TestFramework/NexusMods.Games.TestFramework.csproj b/tests/Games/NexusMods.Games.TestFramework/NexusMods.Games.TestFramework.csproj index c3b104b69a..83688aa1a7 100644 --- a/tests/Games/NexusMods.Games.TestFramework/NexusMods.Games.TestFramework.csproj +++ b/tests/Games/NexusMods.Games.TestFramework/NexusMods.Games.TestFramework.csproj @@ -5,6 +5,8 @@ + + diff --git a/tests/NexusMods.CLI.Tests/Startup.cs b/tests/NexusMods.CLI.Tests/Startup.cs index 297729ccd0..3ed68ce870 100644 --- a/tests/NexusMods.CLI.Tests/Startup.cs +++ b/tests/NexusMods.CLI.Tests/Startup.cs @@ -3,6 +3,7 @@ using NexusMods.Abstractions.FileStore; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Settings; @@ -11,6 +12,8 @@ using NexusMods.CrossPlatform; using NexusMods.DataModel; using NexusMods.FileExtractor; +using NexusMods.Jobs; +using NexusMods.Library; using NexusMods.Networking.HttpDownloader; using NexusMods.Networking.HttpDownloader.Tests; using NexusMods.Networking.NexusWebApi; @@ -33,6 +36,9 @@ public void ConfigureServices(IServiceCollection services) .AddFileSystem() .AddSettingsManager() .AddDataModel() + .AddLibrary() + .AddLibraryModels() + .AddJobMonitor() .OverrideSettingsForTests(settings => settings with { UseInMemoryDataModel = true, diff --git a/tests/NexusMods.DataModel.Tests/FileOriginRegistryTests.cs b/tests/NexusMods.DataModel.Tests/FileOriginRegistryTests.cs index f5945fefd9..65cc13e551 100644 --- a/tests/NexusMods.DataModel.Tests/FileOriginRegistryTests.cs +++ b/tests/NexusMods.DataModel.Tests/FileOriginRegistryTests.cs @@ -6,6 +6,7 @@ using NexusMods.Abstractions.FileExtractor; using NexusMods.Abstractions.FileStore; using NexusMods.Abstractions.IO; +using NexusMods.Abstractions.Library; using NexusMods.DataModel.Tests.Harness; using NexusMods.Hashing.xxHash64; using NSubstitute; @@ -21,6 +22,7 @@ public async Task RegisterFolder_ShouldRegisterCorrectly() // Arrange IFileOriginRegistry sut = new FileOriginRegistry( ServiceProvider.GetRequiredService>(), + ServiceProvider.GetRequiredService(), ServiceProvider.GetRequiredService(), FileStore, TemporaryFileManager, @@ -52,6 +54,7 @@ public async Task RegisterFolder_WhenCalledTwice_ShouldBeDedupedOnSameArchive() fileStore.GetFileHashes().Returns(new HashSet()); // not needed here IFileOriginRegistry sut = new FileOriginRegistry( ServiceProvider.GetRequiredService>(), + ServiceProvider.GetRequiredService(), ServiceProvider.GetRequiredService(), fileStore, TemporaryFileManager, @@ -78,6 +81,7 @@ public async Task RegisterFolder_WhenCalledTwice_ShouldOnlyAppendNewData() IFileOriginRegistry sut = new FileOriginRegistry( ServiceProvider.GetRequiredService>(), + ServiceProvider.GetRequiredService(), ServiceProvider.GetRequiredService(), fileStore, TemporaryFileManager, diff --git a/tests/NexusMods.DataModel.Tests/NexusMods.DataModel.Tests.csproj b/tests/NexusMods.DataModel.Tests/NexusMods.DataModel.Tests.csproj index 31c6b97ac7..70be2a13cd 100644 --- a/tests/NexusMods.DataModel.Tests/NexusMods.DataModel.Tests.csproj +++ b/tests/NexusMods.DataModel.Tests/NexusMods.DataModel.Tests.csproj @@ -10,6 +10,8 @@ + + diff --git a/tests/NexusMods.DataModel.Tests/Startup.cs b/tests/NexusMods.DataModel.Tests/Startup.cs index 83b750799f..a1ca07f76f 100644 --- a/tests/NexusMods.DataModel.Tests/Startup.cs +++ b/tests/NexusMods.DataModel.Tests/Startup.cs @@ -4,6 +4,7 @@ using NexusMods.Abstractions.Games; using NexusMods.Abstractions.GuidedInstallers; using NexusMods.Abstractions.Installers; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Serialization.ExpressionGenerator; @@ -12,6 +13,8 @@ using NexusMods.App.BuildInfo; using NexusMods.CrossPlatform; using NexusMods.FileExtractor; +using NexusMods.Jobs; +using NexusMods.Library; using NexusMods.Paths; using NexusMods.Settings; using NexusMods.StandardGameLocators; @@ -49,6 +52,9 @@ public static IServiceCollection AddServices(IServiceCollection container) .AddSingleton(new TemporaryFileManager(FileSystem.Shared, prefix)) .AddSettingsManager() .AddDataModel() + .AddLibrary() + .AddLibraryModels() + .AddJobMonitor() .OverrideSettingsForTests(settings => settings with { UseInMemoryDataModel = true, From c1ded65d32857e207168d75f84ec26a396e6f293 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 13:25:21 +0200 Subject: [PATCH 06/12] Backup files --- src/NexusMods.Library/AddLibraryFileJob.cs | 4 +- .../AddLibraryFileJobWorker.cs | 53 +++++++++++++++++-- .../AddLocalFileJobWorker.cs | 1 + 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/NexusMods.Library/AddLibraryFileJob.cs b/src/NexusMods.Library/AddLibraryFileJob.cs index 1385721d40..682e9df6ae 100644 --- a/src/NexusMods.Library/AddLibraryFileJob.cs +++ b/src/NexusMods.Library/AddLibraryFileJob.cs @@ -14,15 +14,17 @@ public AddLibraryFileJob(IJobGroup? group = null, IJobWorker? worker = null) public required ITransaction Transaction { get; init; } public required AbsolutePath FilePath { get; init; } public required bool DoCommit { get; init; } + public required bool DoBackup { get; init; } public Optional EntityId { get; set; } public Optional IsArchive { get; set; } + public Optional HasBackup { get; set; } public Optional HashJobResult { get; set; } public Optional LibraryFile { get; set; } public Optional LibraryArchive { get; set; } public Optional ExtractionDirectory { get; set; } public Optional ExtractedFiles { get; set; } - public Optional AddExtractedFileJobResults { get; set; } + public Optional[]> AddExtractedFileJobResults { get; set; } protected override void Dispose(bool disposing) { diff --git a/src/NexusMods.Library/AddLibraryFileJobWorker.cs b/src/NexusMods.Library/AddLibraryFileJobWorker.cs index 123c820d3e..60ffa82f80 100644 --- a/src/NexusMods.Library/AddLibraryFileJobWorker.cs +++ b/src/NexusMods.Library/AddLibraryFileJobWorker.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NexusMods.Abstractions.FileExtractor; +using NexusMods.Abstractions.IO; using NexusMods.Abstractions.IO.StreamFactories; using NexusMods.Abstractions.Jobs; using NexusMods.Abstractions.LibraryModels; @@ -19,6 +20,7 @@ internal class AddLibraryFileJobWorker : AJobWorker private readonly IServiceProvider _serviceProvider; private readonly IFileExtractor _fileExtractor; private readonly TemporaryFileManager _temporaryFileManager; + private readonly IFileStore _fileStore; public AddLibraryFileJobWorker(IServiceProvider serviceProvider) { @@ -27,6 +29,7 @@ public AddLibraryFileJobWorker(IServiceProvider serviceProvider) _serviceProvider = serviceProvider; _fileExtractor = serviceProvider.GetRequiredService(); _temporaryFileManager = serviceProvider.GetRequiredService(); + _fileStore = serviceProvider.GetRequiredService(); } protected override async Task ExecuteAsync(AddLibraryFileJob job, CancellationToken cancellationToken) @@ -103,30 +106,56 @@ protected override async Task ExecuteAsync(AddLibraryFileJob job, Can if (!job.AddExtractedFileJobResults.HasValue) { var extractedFiles = job.ExtractedFiles.Value; - var results = new JobResult[extractedFiles.Length]; + var results = new ValueTuple[extractedFiles.Length]; await Parallel.ForAsync(fromInclusive: 0, toExclusive: extractedFiles.Length, cancellationToken, async (i, innerCancellationToken) => { + var fileEntry = extractedFiles[i]; + var worker = _serviceProvider.GetRequiredService(); var childJob = new AddLibraryFileJob(job, worker) { Transaction = job.Transaction, - FilePath = extractedFiles[i].Path, + FilePath = fileEntry.Path, DoCommit = false, + DoBackup = false, }; await worker.StartAsync(childJob, cancellationToken: innerCancellationToken); var result = await childJob.WaitToFinishAsync(cancellationToken: innerCancellationToken); - results[i] = result; + results[i] = (result, fileEntry); }); job.AddExtractedFileJobResults = results; } cancellationToken.ThrowIfCancellationRequested(); - foreach (var jobResult in job.AddExtractedFileJobResults.Value) + if (!job.HasBackup.HasValue) { + var filesToBackup = job.AddExtractedFileJobResults.Value + .Select(tuple => + { + var (jobResult, fileEntry) = tuple; + var data = jobResult.RequireData(); + + return new ArchivedFileEntry + { + Hash = data.Hash, + Size = data.Size, + StreamFactory = new NativeFileStreamFactory(fileEntry.Path), + }; + }) + .ToArray(); + + await _fileStore.BackupFiles(filesToBackup, token: cancellationToken); + job.HasBackup = true; + } + + cancellationToken.ThrowIfCancellationRequested(); + foreach (var tuple in job.AddExtractedFileJobResults.Value) + { + var (jobResult, _) = tuple; var libraryFile = jobResult.RequireData(); var archiveFileEntry = new LibraryArchiveFileEntry.New(job.Transaction, libraryFile.Id) { @@ -135,6 +164,22 @@ await Parallel.ForAsync(fromInclusive: 0, toExclusive: extractedFiles.Length, ca }; } } + else + { + cancellationToken.ThrowIfCancellationRequested(); + if (job is { DoBackup: true, HasBackup.HasValue: false }) + { + var archivedFileEntry = new ArchivedFileEntry + { + Hash = job.HashJobResult.Value.RequireData(), + Size = job.FilePath.FileInfo.Size, + StreamFactory = new NativeFileStreamFactory(job.FilePath), + }; + + await _fileStore.BackupFiles([archivedFileEntry], token: cancellationToken); + job.HasBackup = true; + } + } cancellationToken.ThrowIfCancellationRequested(); if (job.DoCommit) diff --git a/src/NexusMods.Library/AddLocalFileJobWorker.cs b/src/NexusMods.Library/AddLocalFileJobWorker.cs index 3323094e24..92ce7c79e4 100644 --- a/src/NexusMods.Library/AddLocalFileJobWorker.cs +++ b/src/NexusMods.Library/AddLocalFileJobWorker.cs @@ -25,6 +25,7 @@ protected override async Task ExecuteAsync(AddLocalFileJob job, Cance Transaction = job.Transaction, FilePath = job.FilePath, DoCommit = false, + DoBackup = true, }; await worker.StartAsync(addLibraryFileJob, cancellationToken: cancellationToken); From bc5e4de34f34d569b0b0782e868d7fbec406c354 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 13:59:12 +0200 Subject: [PATCH 07/12] Update package --- .../NexusMods.Abstractions.Library.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj index 752ab2ee71..fe3332af72 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj @@ -1,4 +1,6 @@  + + From b96cc33391133f62bedf6f62ed43e541bbebfbd3 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 14:43:22 +0200 Subject: [PATCH 08/12] Add install job and worker --- .../NexusMods.Abstractions.Games/AGame.cs | 3 ++ .../NexusMods.Abstractions.Games/IGame.cs | 5 ++ .../NexusMods.Abstractions.Jobs/JobWorker.cs | 2 +- .../InstallLoadoutItemJob.cs | 32 +++++++++++ .../InstallLoadoutItemJobWorker.cs | 53 +++++++++++++++++++ src/NexusMods.Library/LibraryService.cs | 9 +++- .../NexusMods.Library.csproj | 2 + src/NexusMods.Library/Services.cs | 3 +- tests/NexusMods.Jobs.Tests/JobWorkerTests.cs | 4 +- 9 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 src/NexusMods.Library/InstallLoadoutItemJob.cs create mode 100644 src/NexusMods.Library/InstallLoadoutItemJobWorker.cs diff --git a/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs b/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs index 9f3ad2b107..99ffe5e7dd 100644 --- a/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs +++ b/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs @@ -70,6 +70,9 @@ protected virtual ILoadoutSynchronizer MakeSynchronizer(IServiceProvider provide /// public virtual IEnumerable Installers => _installers.Value; + /// + public virtual ILibraryItemInstaller[] LibraryItemInstallers { get; } = []; + /// public virtual IDiagnosticEmitter[] DiagnosticEmitters { get; } = Array.Empty(); diff --git a/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs b/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs index 5edec419d5..cc8cb0abbf 100644 --- a/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs +++ b/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs @@ -31,6 +31,11 @@ public interface IGame : ILocatableGame /// public IEnumerable Installers { get; } + /// + /// Gets all available installers this game supports. + /// + public ILibraryItemInstaller[] LibraryItemInstallers { get; } + /// /// An array of all instances of supported /// by the game. diff --git a/src/Abstractions/NexusMods.Abstractions.Jobs/JobWorker.cs b/src/Abstractions/NexusMods.Abstractions.Jobs/JobWorker.cs index 1a62d3f384..2099b49caa 100644 --- a/src/Abstractions/NexusMods.Abstractions.Jobs/JobWorker.cs +++ b/src/Abstractions/NexusMods.Abstractions.Jobs/JobWorker.cs @@ -12,7 +12,7 @@ public delegate Task ExecuteAsyncDelegateWithData(TJob job, public delegate Task ExecuteAsyncDelegate(TJob job, AJobWorker worker, CancellationToken cancellationToken) where TJob : AJob; - public static AJobWorker Create(TJob job, ExecuteAsyncDelegateWithData func) + public static AJobWorker CreateWithData(TJob job, ExecuteAsyncDelegateWithData func) where TJob : AJob where TData : notnull { diff --git a/src/NexusMods.Library/InstallLoadoutItemJob.cs b/src/NexusMods.Library/InstallLoadoutItemJob.cs new file mode 100644 index 0000000000..8896165ea9 --- /dev/null +++ b/src/NexusMods.Library/InstallLoadoutItemJob.cs @@ -0,0 +1,32 @@ +using DynamicData.Kernel; +using NexusMods.Abstractions.Installers; +using NexusMods.Abstractions.Jobs; +using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Loadouts; +using NexusMods.MnemonicDB.Abstractions; + +namespace NexusMods.Library; + +public class InstallLoadoutItemJob : AJob +{ + public InstallLoadoutItemJob( + IJobGroup? group = default, + IJobWorker? worker = default, + IJobMonitor? monitor = default) : base(new MutableProgress(new IndeterminateProgress()), group, worker, monitor) { } + + public required ITransaction Transaction { get; init; } + public required LibraryItem.ReadOnly LibraryItem { get; init; } + public required Loadout.ReadOnly Loadout { get; init; } + + public Optional Installer { get; set; } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + Transaction.Dispose(); + } + + base.Dispose(disposing); + } +} diff --git a/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs b/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs new file mode 100644 index 0000000000..d2daac10aa --- /dev/null +++ b/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs @@ -0,0 +1,53 @@ +using DynamicData.Kernel; +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NexusMods.Abstractions.Games; +using NexusMods.Abstractions.Installers; +using NexusMods.Abstractions.Jobs; +using NexusMods.Abstractions.Loadouts; + +namespace NexusMods.Library; + +[UsedImplicitly] +internal class InstallLoadoutItemJobWorker : AJobWorker +{ + private readonly ILogger _logger; + + public InstallLoadoutItemJobWorker(IServiceProvider serviceProvider) + { + _logger = serviceProvider.GetRequiredService>(); + } + + protected override async Task ExecuteAsync(InstallLoadoutItemJob job, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + if (!job.Installer.HasValue) + { + ILibraryItemInstaller? foundInstaller = null; + var installers = job.Loadout.InstallationInstance.GetGame().LibraryItemInstallers; + foreach (var installer in installers) + { + var isSupported = await installer.IsSupportedAsync(job.LibraryItem, cancellationToken); + if (!isSupported) continue; + + foundInstaller = installer; + break; + } + + // TODO: default to advanced installer + if (foundInstaller is null) + { + return JobResult.CreateFailed($"Found no installer that supports `{job.LibraryItem.Name}` (`{job.LibraryItem.Id}`)"); + } + + job.Installer = Optional.Create(foundInstaller); + } + + var result = await job.Installer.Value.ExecuteAsync(job.LibraryItem, job.Transaction, job.Loadout, cancellationToken); + var transactionResult = await job.Transaction.Commit(); + + var jobResults = result.Select(x => transactionResult.Remap(x)).ToArray(); + return JobResult.CreateCompleted(jobResults); + } +} diff --git a/src/NexusMods.Library/LibraryService.cs b/src/NexusMods.Library/LibraryService.cs index f7fe213195..b29249500b 100644 --- a/src/NexusMods.Library/LibraryService.cs +++ b/src/NexusMods.Library/LibraryService.cs @@ -47,6 +47,13 @@ public IJob AddLocalFile(AbsolutePath absolutePath) public IJob InstallItem(LibraryItem.ReadOnly libraryItem, Loadout.ReadOnly targetLoadout) { - throw new NotImplementedException(); + var job = new InstallLoadoutItemJob(worker: _serviceProvider.GetRequiredService()) + { + Transaction = _connection.BeginTransaction(), + LibraryItem = libraryItem, + Loadout = targetLoadout, + }; + + return job; } } diff --git a/src/NexusMods.Library/NexusMods.Library.csproj b/src/NexusMods.Library/NexusMods.Library.csproj index 4f670d18b7..942fb20815 100644 --- a/src/NexusMods.Library/NexusMods.Library.csproj +++ b/src/NexusMods.Library/NexusMods.Library.csproj @@ -2,6 +2,8 @@ + + diff --git a/src/NexusMods.Library/Services.cs b/src/NexusMods.Library/Services.cs index 5424aeb01b..b1188e3a44 100644 --- a/src/NexusMods.Library/Services.cs +++ b/src/NexusMods.Library/Services.cs @@ -19,6 +19,7 @@ public static IServiceCollection AddLibrary(this IServiceCollection serviceColle .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton(); + .AddSingleton() + .AddSingleton(); } } diff --git a/tests/NexusMods.Jobs.Tests/JobWorkerTests.cs b/tests/NexusMods.Jobs.Tests/JobWorkerTests.cs index f6106d798d..4bd8cf60ff 100644 --- a/tests/NexusMods.Jobs.Tests/JobWorkerTests.cs +++ b/tests/NexusMods.Jobs.Tests/JobWorkerTests.cs @@ -10,7 +10,7 @@ public class JobWorkerTests public async Task TestCreateSync() { var job = new MyJob(); - var worker = JobWorker.Create(new MyJob(), (_, _, _) => Task.FromResult("hello world")); + var worker = JobWorker.CreateWithData(new MyJob(), (_, _, _) => Task.FromResult("hello world")); await worker.StartAsync(job); var jobResult = await job.WaitToFinishAsync(); @@ -23,7 +23,7 @@ public async Task TestCreateSync() public async Task TestCreateAsync() { var job = new MyJob(); - var worker = JobWorker.Create(new MyJob(), async (_, _, _) => + var worker = JobWorker.CreateWithData(new MyJob(), async (_, _, _) => { await Task.Yield(); return "hello world"; From 3fd6d9128947e5a5a9a75c9ce334e9d85dab4000 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 14:46:10 +0200 Subject: [PATCH 09/12] Fix build issue --- src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs b/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs index b07f941a0e..ca8a7f2cc4 100644 --- a/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs +++ b/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs @@ -60,6 +60,9 @@ public void ResetInstallations() { } /// public ILoadoutSynchronizer Synchronizer => throw new NotImplementedException(); + /// + public ILibraryItemInstaller[] LibraryItemInstallers { get; } = []; + /// public GameInstallation InstallationFromLocatorResult(GameLocatorResult metadata, EntityId dbId, IGameLocator locator) { From 70ed3423bfabc2da598cc8cf0544b0dffa402b23 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 14:57:22 +0200 Subject: [PATCH 10/12] Use ILibraryService for installation --- src/NexusMods.DataModel/ArchiveInstaller.cs | 39 +++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/NexusMods.DataModel/ArchiveInstaller.cs b/src/NexusMods.DataModel/ArchiveInstaller.cs index 5f725109c0..aa98c74ca5 100644 --- a/src/NexusMods.DataModel/ArchiveInstaller.cs +++ b/src/NexusMods.DataModel/ArchiveInstaller.cs @@ -7,10 +7,14 @@ using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; +using NexusMods.Abstractions.Library; +using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; +using NexusMods.App.BuildInfo; using NexusMods.Extensions.BCL; +using NexusMods.Hashing.xxHash64; using NexusMods.MnemonicDB.Abstractions; using File = NexusMods.Abstractions.Loadouts.Files.File; @@ -22,6 +26,7 @@ namespace NexusMods.DataModel; public class ArchiveInstaller : IArchiveInstaller { private readonly ILogger _logger; + private readonly ILibraryService _libraryService; private readonly IConnection _conn; private readonly IActivityFactory _activityFactory; private readonly IFileStore _fileStore; @@ -31,7 +36,9 @@ public class ArchiveInstaller : IArchiveInstaller /// /// DI Constructor /// - public ArchiveInstaller(ILogger logger, + public ArchiveInstaller( + ILogger logger, + ILibraryService libraryService, IFileOriginRegistry fileOriginRegistry, IConnection conn, IFileStore fileStore, @@ -39,13 +46,37 @@ public ArchiveInstaller(ILogger logger, IServiceProvider provider) { _logger = logger; + _libraryService = libraryService; _conn = conn; _fileOriginRegistry = fileOriginRegistry; _fileStore = fileStore; _activityFactory = activityFactory; _provider = provider; } - + + private async Task ShadowTrafficTestLibraryService(Hash hash, Loadout.ReadOnly loadout, CancellationToken cancellationToken) + { + // TODO: https://github.com/Nexus-Mods/NexusMods.App/issues/1763 + if (!CompileConstants.IsDebug) return; + try + { + if (!LibraryFile.FindByHash(_conn.Db, hash).TryGetFirst(out var libraryFile)) + { + _logger.LogDebug("Found no library item with hash `{Hash}`, skipping shadow traffic test", hash); + return; + } + + var job = _libraryService.InstallItem(libraryFile.AsLibraryItem(), loadout); + await job.StartAsync(cancellationToken: cancellationToken); + var result = await job.WaitToFinishAsync(cancellationToken: cancellationToken); + _logger.LogInformation("InstallItem result: `{Result}`", result.ToString()); + } + catch (Exception e) + { + _logger.LogError(e, "Exception install library item"); + } + } + /// public async Task AddMods( LoadoutId loadoutId, @@ -57,7 +88,9 @@ public async Task AddMods( // Get the loadout and create the mod, so we can use it in the job. var useCustomInstaller = installer != null; var loadout = Loadout.Load(_conn.Db, loadoutId); - + + await ShadowTrafficTestLibraryService(download.Hash, loadout, token); + // Note(suggestedName) cannot be null here. // Because string is non-nullable where it is set (FileOriginRegistry), // and using that is a prerequisite to calling this function. From cbdfb94010eb9ac30acd8b41a22656086f61ccb8 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 17:02:36 +0200 Subject: [PATCH 11/12] Rename namespace --- NexusMods.App.sln | 2 +- .../ALibraryArchiveInstaller.cs | 2 +- .../ALibraryFileInstaller.cs | 2 +- .../ALibraryItemInstaller.cs | 2 +- .../ILibraryArchiveInstaller.cs | 2 +- .../ILibraryFileInstaller.cs | 2 +- .../ILibraryItemInstaller.cs | 2 +- .../LibraryArchive.cs | 2 +- .../LibraryArchiveFileEntry.cs | 3 +-- .../LibraryFile.cs | 2 +- .../LibraryItem.cs | 2 +- .../LocalFile.cs | 2 +- .../NexusMods.Abstractions.Library.Models.csproj} | 0 .../Services.cs | 3 +-- .../NexusMods.Abstractions.Library/ILibraryService.cs | 2 +- .../NexusMods.Abstractions.Library.csproj | 2 +- .../LibraryLinkedLoadoutItem.cs | 2 +- .../NexusMods.Abstractions.Loadouts/LoadoutItem.cs | 7 +------ .../NexusMods.Abstractions.Loadouts.csproj | 2 +- .../NexusMods.Abstractions.NexusModsLibrary.csproj | 2 +- .../NexusModsLibraryFile.cs | 2 +- src/NexusMods.App/Services.cs | 2 +- src/NexusMods.DataModel/ArchiveInstaller.cs | 4 +--- src/NexusMods.Library/AddLibraryFileJob.cs | 2 +- src/NexusMods.Library/AddLibraryFileJobWorker.cs | 2 +- src/NexusMods.Library/AddLocalFileJobWorker.cs | 2 +- src/NexusMods.Library/InstallLoadoutItemJob.cs | 2 +- src/NexusMods.Library/LibraryService.cs | 2 +- .../DependencyInjectionHelper.cs | 3 +-- tests/NexusMods.CLI.Tests/Startup.cs | 2 +- tests/NexusMods.DataModel.Tests/Startup.cs | 2 +- 31 files changed, 30 insertions(+), 40 deletions(-) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/LibraryArchive.cs (93%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/LibraryArchiveFileEntry.cs (85%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/LibraryFile.cs (94%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/LibraryItem.cs (90%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/LocalFile.cs (92%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj => NexusMods.Abstractions.Library.Models/NexusMods.Abstractions.Library.Models.csproj} (100%) rename src/Abstractions/{NexusMods.Abstractions.LibraryModels => NexusMods.Abstractions.Library.Models}/Services.cs (85%) diff --git a/NexusMods.App.sln b/NexusMods.App.sln index ed0637300a..157f69d140 100644 --- a/NexusMods.App.sln +++ b/NexusMods.App.sln @@ -214,7 +214,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interprocess", "Interproces EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Settings.Tests", "tests\NexusMods.Settings.Tests\NexusMods.Settings.Tests.csproj", "{0D289DCE-1B17-4B63-B8B3-47CB852BF5B4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.LibraryModels", "src\Abstractions\NexusMods.Abstractions.LibraryModels\NexusMods.Abstractions.LibraryModels.csproj", "{0044D340-E435-489C-A425-139AAB2EA205}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Library.Models", "src\Abstractions\NexusMods.Abstractions.Library.Models\NexusMods.Abstractions.Library.Models.csproj", "{0044D340-E435-489C-A425-139AAB2EA205}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.NexusModsLibrary", "src\Abstractions\NexusMods.Abstractions.NexusModsLibrary\NexusMods.Abstractions.NexusModsLibrary.csproj", "{5D85EBB2-755F-4148-BFC4-8D2245A3105B}" EndProject diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs index b74f17726f..b2de14ccb2 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs index 431d99887d..9499adbb53 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs index f268921ada..944462fc04 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs index 75013e8c8a..3c3e054bf8 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs index 7b46719bea..691b1e6555 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs index c9acdf185d..10a5c0c018 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchive.cs similarity index 93% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchive.cs index a3ef14de0b..18fa778547 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchive.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchive.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Represents an archive in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchiveFileEntry.cs similarity index 85% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchiveFileEntry.cs index 2d4f79409f..e094149485 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryArchiveFileEntry.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryArchiveFileEntry.cs @@ -1,9 +1,8 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Represents a file inside a library archive. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryFile.cs similarity index 94% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryFile.cs index 6ebb461cae..ef268c7bd8 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryFile.cs @@ -2,7 +2,7 @@ using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Represents a that is a file in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryItem.cs similarity index 90% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryItem.cs index f31c182ca5..2fd3674994 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LibraryItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/LibraryItem.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Represents an item in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/LocalFile.cs similarity index 92% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/LocalFile.cs index 3aedae57ca..21617cf340 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/LocalFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/LocalFile.cs @@ -2,7 +2,7 @@ using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Represents a local file in the library. diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj b/src/Abstractions/NexusMods.Abstractions.Library.Models/NexusMods.Abstractions.Library.Models.csproj similarity index 100% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/NexusMods.Abstractions.LibraryModels.csproj rename to src/Abstractions/NexusMods.Abstractions.Library.Models/NexusMods.Abstractions.Library.Models.csproj diff --git a/src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs b/src/Abstractions/NexusMods.Abstractions.Library.Models/Services.cs similarity index 85% rename from src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Models/Services.cs index b1777170b7..c0e2a7e836 100644 --- a/src/Abstractions/NexusMods.Abstractions.LibraryModels/Services.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Models/Services.cs @@ -1,8 +1,7 @@ using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; -using NexusMods.Abstractions.MnemonicDB.Attributes; -namespace NexusMods.Abstractions.LibraryModels; +namespace NexusMods.Abstractions.Library.Models; /// /// Extension methods. diff --git a/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs b/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs index 6141e33f20..1dee0edf14 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library/ILibraryService.cs @@ -1,9 +1,9 @@ using JetBrains.Annotations; using NexusMods.Abstractions.Downloads; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; using NexusMods.Paths; +using LibraryItem = NexusMods.Abstractions.Library.Models.LibraryItem; namespace NexusMods.Abstractions.Library; diff --git a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj index fe3332af72..5301250070 100644 --- a/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Library/NexusMods.Abstractions.Library.csproj @@ -4,7 +4,7 @@ - + diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs b/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs index d7502ac7d7..a964f3a865 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/LibraryLinkedLoadoutItem.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs b/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs index 4ad7569047..edae3d3433 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/LoadoutItem.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; @@ -37,9 +37,4 @@ public partial class LoadoutItem : IModelDefinition /// Optional parent of the item. /// public static readonly ReferenceAttribute Parent = new(Namespace, nameof(Parent)) { IsIndexed = true, IsOptional = true }; - - /// - /// Optional source of the item. - /// - public static readonly ReferenceAttribute Source = new(Namespace, nameof(Source)) { IsIndexed = true, IsOptional = true }; } diff --git a/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj b/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj index 9ba95ef4c9..c519166dcc 100644 --- a/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Loadouts/NexusMods.Abstractions.Loadouts.csproj @@ -7,7 +7,7 @@ - + all diff --git a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj index 9ad0fc65af..e7df41743e 100644 --- a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj +++ b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusMods.Abstractions.NexusModsLibrary.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs index 6bad434015..cd50405b3d 100644 --- a/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs +++ b/src/Abstractions/NexusMods.Abstractions.NexusModsLibrary/NexusModsLibraryFile.cs @@ -1,5 +1,5 @@ using JetBrains.Annotations; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.MnemonicDB.Abstractions.Attributes; using NexusMods.MnemonicDB.Abstractions.Models; diff --git a/src/NexusMods.App/Services.cs b/src/NexusMods.App/Services.cs index 6ee491b31d..a32599e5db 100644 --- a/src/NexusMods.App/Services.cs +++ b/src/NexusMods.App/Services.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.FileStore; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Settings; diff --git a/src/NexusMods.DataModel/ArchiveInstaller.cs b/src/NexusMods.DataModel/ArchiveInstaller.cs index aa98c74ca5..9cd7e3b1c4 100644 --- a/src/NexusMods.DataModel/ArchiveInstaller.cs +++ b/src/NexusMods.DataModel/ArchiveInstaller.cs @@ -2,21 +2,19 @@ using Microsoft.Extensions.Logging; using NexusMods.Abstractions.Activities; using NexusMods.Abstractions.FileStore; -using NexusMods.Abstractions.FileStore.ArchiveMetadata; using NexusMods.Abstractions.FileStore.Downloads; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; using NexusMods.Abstractions.Library; -using NexusMods.Abstractions.LibraryModels; using NexusMods.Abstractions.Loadouts; -using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.App.BuildInfo; using NexusMods.Extensions.BCL; using NexusMods.Hashing.xxHash64; using NexusMods.MnemonicDB.Abstractions; using File = NexusMods.Abstractions.Loadouts.Files.File; +using LibraryFile = NexusMods.Abstractions.Library.Models.LibraryFile; namespace NexusMods.DataModel; diff --git a/src/NexusMods.Library/AddLibraryFileJob.cs b/src/NexusMods.Library/AddLibraryFileJob.cs index 682e9df6ae..a1ba63400e 100644 --- a/src/NexusMods.Library/AddLibraryFileJob.cs +++ b/src/NexusMods.Library/AddLibraryFileJob.cs @@ -1,6 +1,6 @@ using DynamicData.Kernel; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; diff --git a/src/NexusMods.Library/AddLibraryFileJobWorker.cs b/src/NexusMods.Library/AddLibraryFileJobWorker.cs index 60ffa82f80..d82fff64c3 100644 --- a/src/NexusMods.Library/AddLibraryFileJobWorker.cs +++ b/src/NexusMods.Library/AddLibraryFileJobWorker.cs @@ -5,7 +5,7 @@ using NexusMods.Abstractions.IO; using NexusMods.Abstractions.IO.StreamFactories; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Hashing.xxHash64; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; diff --git a/src/NexusMods.Library/AddLocalFileJobWorker.cs b/src/NexusMods.Library/AddLocalFileJobWorker.cs index 92ce7c79e4..39a5b2dd38 100644 --- a/src/NexusMods.Library/AddLocalFileJobWorker.cs +++ b/src/NexusMods.Library/AddLocalFileJobWorker.cs @@ -1,7 +1,7 @@ using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; namespace NexusMods.Library; diff --git a/src/NexusMods.Library/InstallLoadoutItemJob.cs b/src/NexusMods.Library/InstallLoadoutItemJob.cs index 8896165ea9..864c312f29 100644 --- a/src/NexusMods.Library/InstallLoadoutItemJob.cs +++ b/src/NexusMods.Library/InstallLoadoutItemJob.cs @@ -1,7 +1,7 @@ using DynamicData.Kernel; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.Jobs; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/NexusMods.Library/LibraryService.cs b/src/NexusMods.Library/LibraryService.cs index b29249500b..a136d393d5 100644 --- a/src/NexusMods.Library/LibraryService.cs +++ b/src/NexusMods.Library/LibraryService.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.Downloads; using NexusMods.Abstractions.Jobs; using NexusMods.Abstractions.Library; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; using NexusMods.Paths; diff --git a/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs b/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs index 437fa969a5..a696adfbd5 100644 --- a/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs +++ b/tests/Games/NexusMods.Games.TestFramework/DependencyInjectionHelper.cs @@ -2,9 +2,8 @@ using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using NexusMods.Abstractions.Activities; using NexusMods.Abstractions.HttpDownloader; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts.Synchronizers; using NexusMods.Abstractions.Settings; using NexusMods.Activities; diff --git a/tests/NexusMods.CLI.Tests/Startup.cs b/tests/NexusMods.CLI.Tests/Startup.cs index 3ed68ce870..759f224da8 100644 --- a/tests/NexusMods.CLI.Tests/Startup.cs +++ b/tests/NexusMods.CLI.Tests/Startup.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.FileStore; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Settings; diff --git a/tests/NexusMods.DataModel.Tests/Startup.cs b/tests/NexusMods.DataModel.Tests/Startup.cs index a1ca07f76f..60c984cf42 100644 --- a/tests/NexusMods.DataModel.Tests/Startup.cs +++ b/tests/NexusMods.DataModel.Tests/Startup.cs @@ -4,7 +4,7 @@ using NexusMods.Abstractions.Games; using NexusMods.Abstractions.GuidedInstallers; using NexusMods.Abstractions.Installers; -using NexusMods.Abstractions.LibraryModels; +using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Serialization; using NexusMods.Abstractions.Serialization.ExpressionGenerator; From 441736f044688b1a93136c44bd8dd5d6d5a0ca7d Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 18 Jul 2024 17:06:11 +0200 Subject: [PATCH 12/12] Rename namespace --- NexusMods.App.sln | 7 ++++++ .../NexusMods.Abstractions.Games/AGame.cs | 1 + .../NexusMods.Abstractions.Games/IGame.cs | 1 + .../NexusMods.Abstractions.Games.csproj | 1 + .../NexusMods.Abstractions.Installers.csproj | 15 ------------ .../ALibraryArchiveInstaller.cs | 2 +- .../ALibraryFileInstaller.cs | 2 +- .../ALibraryItemInstaller.cs | 2 +- .../ILibraryArchiveInstaller.cs | 2 +- .../ILibraryFileInstaller.cs | 2 +- .../ILibraryItemInstaller.cs | 2 +- ...ods.Abstractions.Library.Installers.csproj | 23 +++++++++++++++++++ .../InstallLoadoutItemJob.cs | 2 +- .../InstallLoadoutItemJobWorker.cs | 1 + .../Unknown/UnknownGame.cs | 1 + 15 files changed, 42 insertions(+), 22 deletions(-) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ALibraryArchiveInstaller.cs (97%) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ALibraryFileInstaller.cs (97%) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ALibraryItemInstaller.cs (95%) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ILibraryArchiveInstaller.cs (94%) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ILibraryFileInstaller.cs (94%) rename src/Abstractions/{NexusMods.Abstractions.Installers => NexusMods.Abstractions.Library.Installers}/ILibraryItemInstaller.cs (93%) create mode 100644 src/Abstractions/NexusMods.Abstractions.Library.Installers/NexusMods.Abstractions.Library.Installers.csproj diff --git a/NexusMods.App.sln b/NexusMods.App.sln index 157f69d140..53661c13bd 100644 --- a/NexusMods.App.sln +++ b/NexusMods.App.sln @@ -232,6 +232,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Libr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Jobs", "src\NexusMods.Jobs\NexusMods.Jobs.csproj", "{44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexusMods.Abstractions.Library.Installers", "src\Abstractions\NexusMods.Abstractions.Library.Installers\NexusMods.Abstractions.Library.Installers.csproj", "{F6482055-698C-492A-9FC2-0FCDC9FC2E23}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -598,6 +600,10 @@ Global {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Debug|Any CPU.Build.0 = Debug|Any CPU {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Release|Any CPU.ActiveCfg = Release|Any CPU {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9}.Release|Any CPU.Build.0 = Release|Any CPU + {F6482055-698C-492A-9FC2-0FCDC9FC2E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6482055-698C-492A-9FC2-0FCDC9FC2E23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6482055-698C-492A-9FC2-0FCDC9FC2E23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6482055-698C-492A-9FC2-0FCDC9FC2E23}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -704,6 +710,7 @@ Global {01043F6A-121B-4B3C-A694-B823D9CD0BB0} = {52AF9D62-7D5B-4AD0-BA12-86F2AA67428B} {C47C59F4-1C6C-4F78-9A27-F328F1C02BF0} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} {44E6BD8A-7A82-49CC-91FA-AF3B3E5FBEE9} = {E7BAE287-D505-4D6D-A090-665A64309B2D} + {F6482055-698C-492A-9FC2-0FCDC9FC2E23} = {0CB73565-1207-4A56-A79F-6A8E9BBD795C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9F9F8352-34DD-42C0-8564-EE9AF34A3501} diff --git a/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs b/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs index 99ffe5e7dd..1263b63f28 100644 --- a/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs +++ b/src/Abstractions/NexusMods.Abstractions.Games/AGame.cs @@ -7,6 +7,7 @@ using NexusMods.Abstractions.Games.Loadouts; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; +using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.Abstractions.Loadouts.Synchronizers; using NexusMods.Abstractions.Serialization; diff --git a/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs b/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs index cc8cb0abbf..92023f7625 100644 --- a/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs +++ b/src/Abstractions/NexusMods.Abstractions.Games/IGame.cs @@ -2,6 +2,7 @@ using NexusMods.Abstractions.GameLocators; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; +using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.Abstractions.Loadouts.Synchronizers; using NexusMods.Abstractions.Serialization; diff --git a/src/Abstractions/NexusMods.Abstractions.Games/NexusMods.Abstractions.Games.csproj b/src/Abstractions/NexusMods.Abstractions.Games/NexusMods.Abstractions.Games.csproj index d16acbb31a..161b992b82 100644 --- a/src/Abstractions/NexusMods.Abstractions.Games/NexusMods.Abstractions.Games.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Games/NexusMods.Abstractions.Games.csproj @@ -24,6 +24,7 @@ + diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj b/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj index 77ce4fe2cc..fa3af61b3d 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj +++ b/src/Abstractions/NexusMods.Abstractions.Installers/NexusMods.Abstractions.Installers.csproj @@ -15,21 +15,6 @@ - - ILibraryItemInstaller.cs - - - ILibraryItemInstaller.cs - - - ILibraryItemInstaller.cs - - - ILibraryFileInstaller.cs - - - ILibraryArchiveInstaller.cs - IModInstaller.cs diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryArchiveInstaller.cs similarity index 97% rename from src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryArchiveInstaller.cs index b2de14ccb2..e93d9ed50e 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryArchiveInstaller.cs @@ -4,7 +4,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Base implementation of . diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryFileInstaller.cs similarity index 97% rename from src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryFileInstaller.cs index 9499adbb53..1eb1014ec9 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryFileInstaller.cs @@ -4,7 +4,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Base implementation of . diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryItemInstaller.cs similarity index 95% rename from src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryItemInstaller.cs index 944462fc04..3bd3e49755 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ALibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ALibraryItemInstaller.cs @@ -4,7 +4,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Base implementation of . diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryArchiveInstaller.cs similarity index 94% rename from src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryArchiveInstaller.cs index 3c3e054bf8..0d2f4a6fdd 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryArchiveInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryArchiveInstaller.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Variant of for diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryFileInstaller.cs similarity index 94% rename from src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryFileInstaller.cs index 691b1e6555..14d85f606b 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryFileInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryFileInstaller.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Variant of for . diff --git a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryItemInstaller.cs similarity index 93% rename from src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs rename to src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryItemInstaller.cs index 10a5c0c018..d7f2020116 100644 --- a/src/Abstractions/NexusMods.Abstractions.Installers/ILibraryItemInstaller.cs +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/ILibraryItemInstaller.cs @@ -3,7 +3,7 @@ using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; -namespace NexusMods.Abstractions.Installers; +namespace NexusMods.Abstractions.Library.Installers; /// /// Turns into . diff --git a/src/Abstractions/NexusMods.Abstractions.Library.Installers/NexusMods.Abstractions.Library.Installers.csproj b/src/Abstractions/NexusMods.Abstractions.Library.Installers/NexusMods.Abstractions.Library.Installers.csproj new file mode 100644 index 0000000000..c87c227886 --- /dev/null +++ b/src/Abstractions/NexusMods.Abstractions.Library.Installers/NexusMods.Abstractions.Library.Installers.csproj @@ -0,0 +1,23 @@ + + + + + + + + + + + + + ILibraryArchiveInstaller.cs + + + ILibraryFileInstaller.cs + + + ILibraryItemInstaller.cs + + + + diff --git a/src/NexusMods.Library/InstallLoadoutItemJob.cs b/src/NexusMods.Library/InstallLoadoutItemJob.cs index 864c312f29..d1de69bd56 100644 --- a/src/NexusMods.Library/InstallLoadoutItemJob.cs +++ b/src/NexusMods.Library/InstallLoadoutItemJob.cs @@ -1,6 +1,6 @@ using DynamicData.Kernel; -using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.Jobs; +using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; using NexusMods.MnemonicDB.Abstractions; diff --git a/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs b/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs index d2daac10aa..1d5f48635c 100644 --- a/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs +++ b/src/NexusMods.Library/InstallLoadoutItemJobWorker.cs @@ -5,6 +5,7 @@ using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.Jobs; +using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Loadouts; namespace NexusMods.Library; diff --git a/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs b/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs index ca8a7f2cc4..b77d96f656 100644 --- a/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs +++ b/src/NexusMods.StandardGameLocators/Unknown/UnknownGame.cs @@ -4,6 +4,7 @@ using NexusMods.Abstractions.Games.DTO; using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; +using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.Abstractions.Loadouts.Synchronizers; using NexusMods.Abstractions.Serialization;