Skip to content

Commit

Permalink
adapt new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeWanderer committed Aug 1, 2024
1 parent 16e0d9a commit 33664f8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ public async ValueTask<IEnumerable<ModInstallerResult>> GetModsAsync(
}];
}

public override async ValueTask<LoadoutItem.New[]> ExecuteAsync(
public override async ValueTask<InstallerResult> ExecuteAsync(
LibraryArchive.ReadOnly libraryArchive,
LoadoutItemGroup.New loadoutGroup,
ITransaction transaction,
Loadout.ReadOnly loadout,
CancellationToken cancellationToken)
Expand All @@ -183,10 +184,10 @@ public async ValueTask<IEnumerable<ModInstallerResult>> GetModsAsync(
if (achiveFiles.Length == 0)
{
Logger.LogError("Archive contains 0 files");
return [];
return new NotSupported();
}

var group = libraryArchive.ToGroup(loadout, transaction, out var loadoutItem);
var group = loadoutGroup;

var gameFilesLookup = loadout.Mods
.First(mod => mod.Category == ModCategory.GameFiles).Files // TODO: fogure out what to use instead of ModCategory
Expand Down Expand Up @@ -244,13 +245,13 @@ public async ValueTask<IEnumerable<ModInstallerResult>> GetModsAsync(
if (modFiles.Length == 0)
{
Logger.LogError("0 files were processed");
return [];
return new NotSupported();
}
else if (modFiles.Length != achiveFiles.Length)
{
Logger.LogWarning("Of {} files in archive only {} were processed", achiveFiles.Length, modFiles.Length);
}

return [loadoutItem];
return new Success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
using JetBrains.Annotations;
using NexusMods.Abstractions.Library.Installers;

namespace NexusMods.Games.UnrealEngine;
namespace NexusMods.Games.UnrealEngine.PacificDrive;

[UsedImplicitly]
public class PacificDrive : AGame, ISteamGame//, IEpicGame
public class PacificDriveGame : AGame, ISteamGame//, IEpicGame
{
public static readonly GameDomain StaticDomain = GameDomain.From("pacificdrive");
private readonly IFileSystem _fileSystem;
private readonly IServiceProvider _serviceProvider;

public PacificDrive(IEnumerable<IGameLocator> gameLocators, IFileSystem fileSystem, IServiceProvider provider) : base(provider)
public PacificDriveGame(IEnumerable<IGameLocator> gameLocators, IFileSystem fileSystem, IServiceProvider provider) : base(provider)
{
_fileSystem = fileSystem;
_serviceProvider = provider;
Expand All @@ -38,7 +38,7 @@ protected override IReadOnlyDictionary<LocationId, AbsolutePath> GetLocations(IF
var result = new Dictionary<LocationId, AbsolutePath>()
{
{ LocationId.Game, installation.Path },
{ Constants.GameMainUE, installation.Path.Combine("PenDriverPro")},
{ Constants.GameMainUE, installation.Path.Combine("PenDriverPro")},
{
LocationId.Saves,
fileSystem.GetKnownPath(KnownPath.LocalApplicationDataDirectory)
Expand All @@ -58,10 +58,10 @@ protected override IReadOnlyDictionary<LocationId, AbsolutePath> GetLocations(IF
public IEnumerable<string> EpicCatalogItemId => ["5beededaad9743df90e8f07d92df153f"]; // TODO: ask someone

public override IStreamFactory Icon =>
new EmbededResourceStreamFactory<PacificDrive>("NexusMods.Games.UnrealEngine.Resources.PacificDrive.icon.png");
new EmbededResourceStreamFactory<PacificDriveGame>("NexusMods.Games.UnrealEngine.Resources.PacificDrive.icon.png");

public override IStreamFactory GameImage =>
new EmbededResourceStreamFactory<PacificDrive>("NexusMods.Games.UnrealEngine.Resources.PacificDrive.game_image.jpg");
new EmbededResourceStreamFactory<PacificDriveGame>("NexusMods.Games.UnrealEngine.Resources.PacificDrive.game_image.jpg");

public override IEnumerable<IModInstaller> Installers =>
[
Expand All @@ -76,11 +76,6 @@ protected override IReadOnlyDictionary<LocationId, AbsolutePath> GetLocations(IF
public override List<IModInstallDestination> GetInstallDestinations(IReadOnlyDictionary<LocationId, AbsolutePath> locations)
=> ModInstallDestinationHelpers.GetCommonLocations(locations);

protected override ILoadoutSynchronizerOld MakeSynchronizerOld(IServiceProvider provider)
{
return new PacificDriveLoadoutSynchronizerOld(provider);
}

protected override ILoadoutSynchronizer MakeSynchronizer(IServiceProvider provider)
{
return new PacificDriveLoadoutSynchronizer(provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using NexusMods.Abstractions.Loadouts.Synchronizers;
using NexusMods.Abstractions.Settings;

namespace NexusMods.Games.UnrealEngine;
namespace NexusMods.Games.UnrealEngine.PacificDrive;

public class PacificDriveLoadoutSynchronizer : ALoadoutSynchronizer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NexusMods.Abstractions.Settings;

namespace NexusMods.Games.UnrealEngine;
namespace NexusMods.Games.UnrealEngine.PacificDrive;

public class PacificDriveSettings : ISettings
{
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions src/Games/NexusMods.Games.UnrealEngine/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using NexusMods.Abstractions.Loadouts;
using NexusMods.Abstractions.Settings;
using NexusMods.Games.UnrealEngine.Installers;
using NexusMods.Games.UnrealEngine.PacificDrive;

namespace NexusMods.Games.UnrealEngine;

Expand All @@ -11,8 +12,8 @@ public static class Services
public static IServiceCollection AddPacificDrive(this IServiceCollection services)
{
services
.AddGame<PacificDrive>()
.AddSingleton<ITool, RunGameTool<PacificDrive>>()
.AddGame<PacificDriveGame>()
.AddSingleton<ITool, RunGameTool<PacificDriveGame>>()

// Misc
.AddSettings<PacificDriveSettings>();
Expand Down

0 comments on commit 33664f8

Please sign in to comment.