diff --git a/src/Games/NexusMods.Games.UnrealEngine/Installers/SmartUEInstaller.cs b/src/Games/NexusMods.Games.UnrealEngine/Installers/SmartUEInstaller.cs index d1f2859b7c..9acf500b0c 100644 --- a/src/Games/NexusMods.Games.UnrealEngine/Installers/SmartUEInstaller.cs +++ b/src/Games/NexusMods.Games.UnrealEngine/Installers/SmartUEInstaller.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Logging; using NexusMods.Abstractions.FileStore.Trees; using NexusMods.Abstractions.GameLocators; -using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.Library.Installers; using NexusMods.Abstractions.Library.Models; using NexusMods.Abstractions.Loadouts; @@ -40,129 +39,129 @@ public SmartUEInstaller(ILogger logger, IConnection connection ]; // This is here for reference, to be removed when loadout items reach parity with this implementation - public async ValueTask> GetModsAsync( - ModInstallerInfo info, - CancellationToken cancellationToken = default) - { - var gameFolderPath = info.Locations[LocationId.Game]; - var gameMainUEFolderPath = info.Locations[Constants.GameMainUE]; + //public async ValueTask> GetModsAsync( + // ModInstallerInfo info, + // CancellationToken cancellationToken = default) + //{ + // var gameFolderPath = info.Locations[LocationId.Game]; + // var gameMainUEFolderPath = info.Locations[Constants.GameMainUE]; - var achiveFiles = info.ArchiveFiles.GetFiles(); + // var achiveFiles = info.ArchiveFiles.GetFiles(); - if (achiveFiles.Length == 0) - { - Logger.LogError("Archive contains 0 files"); - return []; - } + // if (achiveFiles.Length == 0) + // { + // Logger.LogError("Archive contains 0 files"); + // return []; + // } - var loadout = Loadout.All(_connection.Db) - .First(x => x.Installation.Path == gameFolderPath.ToString()); + // var loadout = Loadout.All(_connection.Db) + // .First(x => x.Installation.Path == gameFolderPath.ToString()); - var gameFilesLookup = loadout.Mods - .First(mod => mod.Category == ModCategory.GameFiles).Files - .Select(file => file.To).ToLookup(x => x.Path.FileName); + // var gameFilesLookup = loadout.Mods + // .First(mod => mod.Category == ModCategory.GameFiles).Files + // .Select(file => file.To).ToLookup(x => x.Path.FileName); - var modFiles = achiveFiles.Select(kv => - { - switch (kv.Path().Extension) - { - case Extension ext when Constants.ContentExts.Contains(ext): - { - var matchesGameContentFles = gameFilesLookup[kv.FileName()]; - if (matchesGameContentFles.Any()) // if Content file exists in game dir replace it - { - var matchedContentFIle = matchesGameContentFles.First(); - return kv.ToStoredFile( - matchedContentFIle - ); - } - else - return kv.ToStoredFile( - Constants.ContentModsPath.Join(kv.FileName()) - ); - } - case Extension ext when ext == Constants.DLLExt: - { - var matchesGameDlls = gameFilesLookup[kv.FileName()]; - if (matchesGameDlls.Any()) // if DLL exists in game dir replace it - { - var matchedDll = matchesGameDlls.First(); - return kv.ToStoredFile( - matchedDll - ); - } - else - return kv.ToStoredFile( - Constants.InjectorModsPath.Join(kv.FileName()) - ); - } - default: - { - var matchesGameFles = gameFilesLookup[kv.FileName()]; - if (matchesGameFles.Any()) // if File exists in game dir replace it - { - var matchedFile = matchesGameFles.First(); - return kv.ToStoredFile( - matchedFile - ); - } - else - { - Logger.LogWarning("File {} is of unrecognized type {}, skipping", kv.Path().FileName, kv.Path().Extension); - return null; - } - } - } - }).OfType().ToArray(); + // var modFiles = achiveFiles.Select(kv => + // { + // switch (kv.Path().Extension) + // { + // case Extension ext when Constants.ContentExts.Contains(ext): + // { + // var matchesGameContentFles = gameFilesLookup[kv.FileName()]; + // if (matchesGameContentFles.Any()) // if Content file exists in game dir replace it + // { + // var matchedContentFIle = matchesGameContentFles.First(); + // return kv.ToStoredFile( + // matchedContentFIle + // ); + // } + // else + // return kv.ToStoredFile( + // Constants.ContentModsPath.Join(kv.FileName()) + // ); + // } + // case Extension ext when ext == Constants.DLLExt: + // { + // var matchesGameDlls = gameFilesLookup[kv.FileName()]; + // if (matchesGameDlls.Any()) // if DLL exists in game dir replace it + // { + // var matchedDll = matchesGameDlls.First(); + // return kv.ToStoredFile( + // matchedDll + // ); + // } + // else + // return kv.ToStoredFile( + // Constants.InjectorModsPath.Join(kv.FileName()) + // ); + // } + // default: + // { + // var matchesGameFles = gameFilesLookup[kv.FileName()]; + // if (matchesGameFles.Any()) // if File exists in game dir replace it + // { + // var matchedFile = matchesGameFles.First(); + // return kv.ToStoredFile( + // matchedFile + // ); + // } + // else + // { + // Logger.LogWarning("File {} is of unrecognized type {}, skipping", kv.Path().FileName, kv.Path().Extension); + // return null; + // } + // } + // } + // }).OfType().ToArray(); - if (modFiles.Length == 0) - { - Logger.LogError("0 files were processed"); - return []; - } - else if (modFiles.Length != achiveFiles.Length) - { - Logger.LogWarning("Of {} files in archive only {} were processed", achiveFiles.Length, modFiles.Length); - } + // if (modFiles.Length == 0) + // { + // Logger.LogError("0 files were processed"); + // return []; + // } + // else if (modFiles.Length != achiveFiles.Length) + // { + // Logger.LogWarning("Of {} files in archive only {} were processed", achiveFiles.Length, modFiles.Length); + // } - var Name = info.ModName; - var Id = info.BaseModId; - string? Version = null; + // var Name = info.ModName; + // var Id = info.BaseModId; + // string? Version = null; - // If ModName ends with archive extension try to parse name and version out of the archive name - if (info.ModName != null && Constants.ArchiveExts.Contains(info.ModName.ToRelativePath().Extension)) - { - foreach (var regex in ModArchiveNameRegexes) - { - var match = regex.Match(info.ModName); - if (match.Success) - { - if (match.Groups.ContainsKey("modName")) - { - Name = match.Groups["modName"].Value - .Replace('_', ' ') - .Trim(); - } + // // If ModName ends with archive extension try to parse name and version out of the archive name + // if (info.ModName != null && Constants.ArchiveExts.Contains(info.ModName.ToRelativePath().Extension)) + // { + // foreach (var regex in ModArchiveNameRegexes) + // { + // var match = regex.Match(info.ModName); + // if (match.Success) + // { + // if (match.Groups.ContainsKey("modName")) + // { + // Name = match.Groups["modName"].Value + // .Replace('_', ' ') + // .Trim(); + // } - if (match.Groups.ContainsKey("version")) - { - Version = match.Groups["version"].Value - .Replace('-', '.'); - } + // if (match.Groups.ContainsKey("version")) + // { + // Version = match.Groups["version"].Value + // .Replace('-', '.'); + // } - break; - } - } - } + // break; + // } + // } + // } - return [ new ModInstallerResult - { - Id = Id, - Files = modFiles, - Name = Name, - Version = Version, - }]; - } + // return [ new ModInstallerResult + // { + // Id = Id, + // Files = modFiles, + // Name = Name, + // Version = Version, + // }]; + //} public override async ValueTask ExecuteAsync( LibraryArchive.ReadOnly libraryArchive, diff --git a/src/Games/NexusMods.Games.UnrealEngine/PacificDrive/PacificDriveGame.cs b/src/Games/NexusMods.Games.UnrealEngine/PacificDrive/PacificDriveGame.cs index 94a9f55805..3848b57d0e 100644 --- a/src/Games/NexusMods.Games.UnrealEngine/PacificDrive/PacificDriveGame.cs +++ b/src/Games/NexusMods.Games.UnrealEngine/PacificDrive/PacificDriveGame.cs @@ -4,7 +4,6 @@ using NexusMods.Abstractions.GameLocators.Stores.Steam; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Games.DTO; -using NexusMods.Abstractions.Installers; using NexusMods.Abstractions.IO; using NexusMods.Abstractions.IO.StreamFactories; using NexusMods.Abstractions.Loadouts.Synchronizers;