Skip to content

Commit fdd9e38

Browse files
committed
basic support for VerificationTarget type
1 parent 2772bb5 commit fdd9e38

16 files changed

Lines changed: 1703 additions & 562 deletions

File tree

src/ModVerify.CliApp/ModSelectors/AutomaticModSelector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal class AutomaticModSelector(IServiceProvider serviceProvider) : ModSelec
3939
catch (GameNotFoundException)
4040
{
4141
Logger?.LogError(ModVerifyConstants.ConsoleEventId, "Unable to find games based of the given location '{SettingsGamePath}'. Consider specifying all paths manually.", settings.GamePath);
42-
targetObject = null!;
42+
targetObject = null;
4343
return null;
4444
}
4545

src/ModVerify.CliApp/ModSelectors/ConsoleModSelector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ namespace AET.ModVerify.App.ModSelectors;
1414

1515
internal class ConsoleModSelector(IServiceProvider serviceProvider) : ModSelectorBase(serviceProvider)
1616
{
17-
public override GameLocations Select(GameInstallationsSettings settings, out IPhysicalPlayableObject targetObject,
17+
public override GameLocations Select(
18+
GameInstallationsSettings settings,
19+
out IPhysicalPlayableObject targetObject,
1820
out GameEngineType? actualEngineType)
1921
{
2022
var gameResult = GameFinderService.FindGames();

src/ModVerify.CliApp/ModSelectors/ManualModSelector.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using AET.ModVerify.App.Settings;
34
using PG.StarWarsGame.Engine;
45
using PG.StarWarsGame.Infrastructure;
@@ -22,8 +23,8 @@ public override GameLocations Select(
2223
throw new ArgumentException("Argument --game must be set.");
2324

2425
return new GameLocations(
25-
settings.ModPaths,
26+
settings.ModPaths.ToList(),
2627
settings.GamePath!,
27-
GetFallbackPaths(settings.FallbackGamePath, settings.AdditionalFallbackPaths));
28+
GetFallbackPaths(settings.FallbackGamePath, settings.AdditionalFallbackPaths).ToList());
2829
}
2930
}

src/ModVerify.CliApp/ModSelectors/ModSelectorBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected GameLocations GetLocations(IPhysicalPlayableObject playableObject, Gam
3434
{
3535
var fallbacks = GetFallbackPaths(finderResult, playableObject, additionalFallbackPaths);
3636
var modPaths = GetModPaths(playableObject);
37-
return new GameLocations(modPaths, playableObject.Game.Directory.FullName, fallbacks);
37+
return new GameLocations(modPaths.ToList(), playableObject.Game.Directory.FullName, fallbacks.ToList());
3838
}
3939

4040
private static IList<string> GetFallbackPaths(GameFinderResult finderResult, IPlayableObject gameOrMod, IList<string> additionalFallbackPaths)

src/ModVerify.CliApp/ModSelectors/SettingsBasedModSelector.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@ public VerificationTarget CreateInstallationDataFromSettings(GameInstallationsSe
2525
{
2626
Engine = engineType.Value,
2727
Location = gameLocations,
28-
Name = GetNameFromGameLocations(targetObject, gameLocations, engineType.Value)
28+
Name = GetNameFromGameLocations(targetObject, gameLocations),
29+
Version = GetTargetVersion(targetObject)
2930
};
3031
}
3132

32-
private static string GetNameFromGameLocations(IPlayableObject? targetObject, GameLocations gameLocations, GameEngineType engineType)
33+
private static string GetNameFromGameLocations(IPlayableObject? targetObject, GameLocations gameLocations)
3334
{
3435
if (targetObject is not null)
3536
return targetObject.Name;
3637

3738
var mod = gameLocations.ModPaths.FirstOrDefault();
3839
return mod ?? gameLocations.GamePath;
3940
}
41+
42+
private static string? GetTargetVersion(IPlayableObject? targetObject)
43+
{
44+
// TODO: Implement version retrieval from targetObject if possible
45+
return null;
46+
}
4047
}

src/ModVerify.CliApp/ModVerifyApplication.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private async Task<int> RunVerify()
102102
if (!settings.CreateNewBaseline)
103103
return 0;
104104

105-
await WriteBaseline(reportSettings, allErrors, settings.NewBaselinePath).ConfigureAwait(false);
105+
await WriteBaseline(verificationTarget, reportSettings, allErrors, settings.NewBaselinePath).ConfigureAwait(false);
106106
_logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Baseline successfully created.");
107107

108108
return 0;
@@ -167,11 +167,12 @@ private async Task ReportErrors(IReadOnlyCollection<VerificationError> errors)
167167
}
168168

169169
private async Task WriteBaseline(
170+
VerificationTarget target,
170171
GlobalVerifyReportSettings reportSettings,
171172
IEnumerable<VerificationError> errors,
172173
string baselineFile)
173174
{
174-
var baseline = new VerificationBaseline(reportSettings.MinimumReportSeverity, errors);
175+
var baseline = new VerificationBaseline(reportSettings.MinimumReportSeverity, errors, target);
175176

176177
var fullPath = _fileSystem.Path.GetFullPath(baselineFile);
177178
_logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Writing Baseline to '{FullPath}'", fullPath);

0 commit comments

Comments
 (0)