Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check icons #13

Merged
merged 34 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4b3680c
update branch in sub
AnakinRaW Aug 3, 2024
1ac8d5b
add mdt to solution
AnakinRaW Aug 3, 2024
86edc46
update branch in sub
AnakinRaW Aug 3, 2024
335c4ce
add mdt to solution
AnakinRaW Aug 3, 2024
8666612
Merge branch 'check-icons' of https://github.com/AlamoEngine-Tools/Mo…
AnakinRaW Aug 3, 2024
2141d57
prototype texture verifier
AnakinRaW Aug 6, 2024
9a31f18
improve error reporting
AnakinRaW Aug 10, 2024
88f42d9
finish new game init reporting
AnakinRaW Aug 10, 2024
ffa70a5
start GameManagers
AnakinRaW Aug 10, 2024
9777997
update subs
AnakinRaW Aug 15, 2024
ecdcd4d
update sub
AnakinRaW Aug 15, 2024
e964e86
move to gamemanager arch
AnakinRaW Aug 17, 2024
b8cf31b
first support for gui dialogs
AnakinRaW Sep 10, 2024
2367849
remove valuelistdict to xml objects to avoid boxing
AnakinRaW Sep 12, 2024
dbe65fd
fix gameobject land terrain model mapping uses only the first ocurrance
AnakinRaW Sep 12, 2024
d7aaaa5
update deps and module
AnakinRaW Sep 24, 2024
dc52ed4
minor changes
AnakinRaW Sep 24, 2024
80a86a5
fix initialization
AnakinRaW Sep 24, 2024
8691382
correct file not found handling
AnakinRaW Sep 24, 2024
713bb87
use spans for repositories
AnakinRaW Sep 24, 2024
08ec5e4
support custom xml parser action
AnakinRaW Oct 4, 2024
6e0a81c
reduce allocations in repository
AnakinRaW Oct 4, 2024
433fc29
update valuestringbuilder usages
AnakinRaW Oct 4, 2024
decf6c6
fix some files are not found.
AnakinRaW Oct 4, 2024
745971b
extract constants
AnakinRaW Oct 4, 2024
f9382a6
implement parsing commandbar components (except colors)
AnakinRaW Oct 5, 2024
3070a37
move code
AnakinRaW Oct 5, 2024
3d524e8
move code
AnakinRaW Oct 5, 2024
d8e379b
move code
AnakinRaW Oct 11, 2024
8e982ed
remove submodule
AnakinRaW Feb 2, 2025
e68b5b0
remove module
AnakinRaW Feb 2, 2025
db6edad
update all deps and make run again
AnakinRaW Feb 2, 2025
2596128
read corrupt string throws BinaryCorruptedExcpetion
AnakinRaW Feb 3, 2025
f5baee7
update to .net9
AnakinRaW Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Create NetFramework Release
run: dotnet publish .\src\ModVerify.CliApp\ModVerify.CliApp.csproj --configuration Release -f net48 --output ./releases/net48
- name: Create Net Core Release
run: dotnet publish .\src\ModVerify.CliApp\ModVerify.CliApp.csproj --configuration Release -f net8.0 --output ./releases/net8.0
run: dotnet publish .\src\ModVerify.CliApp\ModVerify.CliApp.csproj --configuration Release -f net9.0 --output ./releases/net9.0
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -53,8 +53,8 @@ jobs:
path: ./releases
- name: Create NET Core .zip
# Change into the artifacts directory to avoid including the directory itself in the zip archive
working-directory: ./releases/net8.0
run: zip -r ../ModVerify-Net8.zip .
working-directory: ./releases/net9.0
run: zip -r ../ModVerify-Net9.zip .
- uses: dotnet/[email protected]
id: nbgv
- name: Create GitHub release
Expand All @@ -66,4 +66,4 @@ jobs:
generate_release_notes: true
files: |
./releases/net48/ModVerify.exe
./releases/ModVerify-Net8.zip
./releases/ModVerify-Net9.zip
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Build & Test in Release Mode
run: dotnet test --configuration Release
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.6.139</Version>
<Version>3.6.143</Version>
</PackageReference>
</ItemGroup>
</Project>
21 changes: 0 additions & 21 deletions ModVerify.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ VisualStudioVersion = 17.11.34909.67
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PetroglyphTools", "PetroglyphTools", "{15F8B753-814A-406E-9147-EB048DADAC96}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PG.Commons", "PetroglyphTools\PG.Commons\PG.Commons\PG.Commons.csproj", "{1A9E1B15-DD77-47E3-893E-AFADF982CEC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PG.StarWarsGame.Files.DAT", "PetroglyphTools\PG.StarWarsGame.Files.DAT\PG.StarWarsGame.Files.DAT\PG.StarWarsGame.Files.DAT.csproj", "{4630F85C-D1C4-4454-9126-BE13F6901E0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PG.StarWarsGame.Files.MEG", "PetroglyphTools\PG.StarWarsGame.Files.MEG\PG.StarWarsGame.Files.MEG\PG.StarWarsGame.Files.MEG.csproj", "{885291F4-E5E8-45B2-B0B4-40B2910228A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModVerify", "src\ModVerify\ModVerify.csproj", "{22ED0E2C-FF3B-40EB-9CE2-DCDE65CDF31B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModVerify.CliApp", "src\ModVerify.CliApp\ModVerify.CliApp.csproj", "{84479931-A329-4113-9BE5-90B71E5486E6}"
Expand All @@ -29,18 +23,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1A9E1B15-DD77-47E3-893E-AFADF982CEC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A9E1B15-DD77-47E3-893E-AFADF982CEC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A9E1B15-DD77-47E3-893E-AFADF982CEC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A9E1B15-DD77-47E3-893E-AFADF982CEC6}.Release|Any CPU.Build.0 = Release|Any CPU
{4630F85C-D1C4-4454-9126-BE13F6901E0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4630F85C-D1C4-4454-9126-BE13F6901E0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4630F85C-D1C4-4454-9126-BE13F6901E0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4630F85C-D1C4-4454-9126-BE13F6901E0B}.Release|Any CPU.Build.0 = Release|Any CPU
{885291F4-E5E8-45B2-B0B4-40B2910228A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{885291F4-E5E8-45B2-B0B4-40B2910228A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{885291F4-E5E8-45B2-B0B4-40B2910228A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{885291F4-E5E8-45B2-B0B4-40B2910228A3}.Release|Any CPU.Build.0 = Release|Any CPU
{22ED0E2C-FF3B-40EB-9CE2-DCDE65CDF31B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22ED0E2C-FF3B-40EB-9CE2-DCDE65CDF31B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22ED0E2C-FF3B-40EB-9CE2-DCDE65CDF31B}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -70,9 +52,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1A9E1B15-DD77-47E3-893E-AFADF982CEC6} = {15F8B753-814A-406E-9147-EB048DADAC96}
{4630F85C-D1C4-4454-9126-BE13F6901E0B} = {15F8B753-814A-406E-9147-EB048DADAC96}
{885291F4-E5E8-45B2-B0B4-40B2910228A3} = {15F8B753-814A-406E-9147-EB048DADAC96}
{92F2A0C8-61B6-424B-99D5-7898CDBA7CA6} = {15F8B753-814A-406E-9147-EB048DADAC96}
{DF76A383-C94E-4D03-A07C-22D61ED37059} = {15F8B753-814A-406E-9147-EB048DADAC96}
{418C68FA-531B-432E-8459-6433181C8AD3} = {15F8B753-814A-406E-9147-EB048DADAC96}
Expand Down
1 change: 0 additions & 1 deletion PetroglyphTools
Submodule PetroglyphTools deleted from 034767
28 changes: 14 additions & 14 deletions src/ModVerify.CliApp/GameFinder/GameFinderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using PG.StarWarsGame.Infrastructure.Games;
using PG.StarWarsGame.Infrastructure.Mods;
using PG.StarWarsGame.Infrastructure.Services;
using PG.StarWarsGame.Infrastructure.Services.Dependencies;
using PG.StarWarsGame.Infrastructure.Services.Detection;

namespace AET.ModVerifyTool.GameFinder;
Expand Down Expand Up @@ -69,17 +68,20 @@ public GameFinderResult FindGamesFromPathOrGlobal(string path)
private bool TryDetectGame(GameType gameType, IList<IGameDetector> detectors, out GameDetectionResult result)
{
var gd = new CompositeGameDetector(detectors, _serviceProvider);
result = gd.Detect(new GameDetectorOptions(gameType));

if (result.Error is not null)
try
{
_logger?.LogTrace($"Unable to find game installation: {result.Error.Message}", result.Error);
return false;
result = gd.Detect(gameType);
if (result.GameLocation is null)
return false;
return true;
}
if (result.GameLocation is null)
catch (Exception e)
{
result = GameDetectionResult.NotInstalled(gameType);
_logger?.LogTrace($"Unable to find game installation: {e.Message}");
return false;

return true;
}
}

private GameFinderResult FindGames(IList<IGameDetector> detectors)
Expand Down Expand Up @@ -128,15 +130,15 @@ private GameFinderResult FindGames(IList<IGameDetector> detectors)

private void SetupMods(IGame game)
{
var modFinder = _serviceProvider.GetRequiredService<IModReferenceFinder>();
var modFinder = _serviceProvider.GetRequiredService<IModFinder>();
var modRefs = modFinder.FindMods(game);

var mods = new List<IMod>();

foreach (var modReference in modRefs)
{
var mod = _modFactory.FromReference(game, modReference, CultureInfo.InvariantCulture);
mods.AddRange(mod);
var mod = _modFactory.CreatePhysicalMod(game, modReference, CultureInfo.InvariantCulture);
mods.Add(mod);
}

foreach (var mod in mods)
Expand All @@ -145,9 +147,7 @@ private void SetupMods(IGame game)
// Mods need to be added to the game first, before resolving their dependencies.
foreach (var mod in mods)
{
var resolver = _serviceProvider.GetRequiredService<IDependencyResolver>();
mod.ResolveDependencies(resolver,
new DependencyResolverOptions { CheckForCycle = true, ResolveCompleteChain = true });
mod.ResolveDependencies();
}
}
}
26 changes: 16 additions & 10 deletions src/ModVerify.CliApp/ModSelectors/AutomaticModSelector.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO.Abstractions;
using System.Linq;
using AET.ModVerifyTool.GameFinder;
using AET.ModVerifyTool.Options;
using EawModinfo.Model;
using EawModinfo.Spec;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using PG.StarWarsGame.Engine;
using PG.StarWarsGame.Infrastructure;
using PG.StarWarsGame.Infrastructure.Games;
using PG.StarWarsGame.Infrastructure.Mods;
using PG.StarWarsGame.Infrastructure.Services;
using PG.StarWarsGame.Infrastructure.Services.Dependencies;
using PG.StarWarsGame.Infrastructure.Services.Detection;

namespace AET.ModVerifyTool.ModSelectors;

internal class AutomaticModSelector(IServiceProvider serviceProvider) : ModSelectorBase(serviceProvider)
{
private readonly IFileSystem _fileSystem = serviceProvider.GetRequiredService<IFileSystem>();

public override GameLocations? Select(GameInstallationsSettings settings, out IPhysicalPlayableObject? targetObject, out GameEngineType? actualEngineType)
public override GameLocations? Select(
GameInstallationsSettings settings,
out IPhysicalPlayableObject? targetObject,
out GameEngineType? actualEngineType)
{
var pathToVerify = settings.AutoPath;
Debug.Assert(pathToVerify is not null);
if (pathToVerify is null)
throw new InvalidOperationException("path to verify cannot be null.");

actualEngineType = settings.EngineType;

Expand Down Expand Up @@ -100,14 +102,18 @@ private GameLocations GetDetachedModLocations(string modPath, GameFinderResult g
if (game is null)
throw new GameNotFoundException($"Unable to find game of type '{settings.EngineType}'");

var modFinder = ServiceProvider.GetRequiredService<IModFinder>();
var modRef = modFinder.FindMods(game, _fileSystem.DirectoryInfo.New(modPath)).FirstOrDefault();

if (modRef is null)
throw new NotSupportedException($"The mod at '{modPath}' is not compatible to the found game '{game}'.");

var modFactory = ServiceProvider.GetRequiredService<IModFactory>();
mod = modFactory.FromReference(game, new ModReference(modPath, ModType.Default), true, CultureInfo.InvariantCulture);
mod = modFactory.CreatePhysicalMod(game, modRef, CultureInfo.InvariantCulture);

game.AddMod(mod);

var resolver = ServiceProvider.GetRequiredService<IDependencyResolver>();
mod.ResolveDependencies(resolver,
new DependencyResolverOptions { CheckForCycle = true, ResolveCompleteChain = true });
mod.ResolveDependencies();

return GetLocations(mod, gameResult, settings.AdditionalFallbackPaths);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ModVerify.CliApp/ModSelectors/ConsoleModSelector.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using AET.Modinfo.Spec;
using AET.ModVerifyTool.GameFinder;
using AET.ModVerifyTool.Options;
using EawModinfo.Spec;
using PG.StarWarsGame.Engine;
using PG.StarWarsGame.Infrastructure;
using PG.StarWarsGame.Infrastructure.Mods;
Expand All @@ -11,7 +11,7 @@ namespace AET.ModVerifyTool.ModSelectors;

internal class ConsoleModSelector(IServiceProvider serviceProvider) : ModSelectorBase(serviceProvider)
{
public override GameLocations? Select(GameInstallationsSettings settings, out IPhysicalPlayableObject? targetObject,
public override GameLocations Select(GameInstallationsSettings settings, out IPhysicalPlayableObject targetObject,
out GameEngineType? actualEngineType)
{
var gameResult = GameFinderService.FindGames();
Expand Down
6 changes: 4 additions & 2 deletions src/ModVerify.CliApp/ModSelectors/ManualModSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace AET.ModVerifyTool.ModSelectors;

internal class ManualModSelector(IServiceProvider serviceProvider) : ModSelectorBase(serviceProvider)
{
public override GameLocations Select(GameInstallationsSettings settings, out IPhysicalPlayableObject? targetObject,
public override GameLocations Select(
GameInstallationsSettings settings,
out IPhysicalPlayableObject? targetObject,
out GameEngineType? actualEngineType)
{
actualEngineType = settings.EngineType;
Expand All @@ -21,7 +23,7 @@ public override GameLocations Select(GameInstallationsSettings settings, out IPh

return new GameLocations(
settings.ModPaths,
settings.GamePath,
settings.GamePath!,
GetFallbackPaths(settings.FallbackGamePath, settings.AdditionalFallbackPaths));
}
}
5 changes: 3 additions & 2 deletions src/ModVerify.CliApp/ModSelectors/ModSelectorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ protected ModSelectorBase(IServiceProvider serviceProvider)
GameFinderService = new GameFinderService(serviceProvider);
}

public abstract GameLocations? Select(GameInstallationsSettings settings, out IPhysicalPlayableObject? targetObject,
public abstract GameLocations? Select(
GameInstallationsSettings settings,
out IPhysicalPlayableObject? targetObject,
out GameEngineType? actualEngineType);

protected GameLocations GetLocations(IPhysicalPlayableObject playableObject, GameFinderResult finderResult, IList<string> additionalFallbackPaths)
Expand Down Expand Up @@ -66,7 +68,6 @@ private IList<string> GetModPaths(IPhysicalPlayableObject modOrGame)

var traverser = ServiceProvider.GetRequiredService<IModDependencyTraverser>();
return traverser.Traverse(mod)
.Select(x => x.Mod)
.OfType<IPhysicalMod>().Select(x => x.Directory.FullName)
.ToList();
}
Expand Down
30 changes: 2 additions & 28 deletions src/ModVerify.CliApp/ModSelectors/SettingsBasedModSelector.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
using System;
using System.Globalization;
using System.IO.Abstractions;
using System.Linq;
using AET.ModVerifyTool.Options;
using EawModinfo.Model;
using EawModinfo.Spec;
using Microsoft.Extensions.DependencyInjection;
using PG.StarWarsGame.Engine;
using PG.StarWarsGame.Infrastructure;
using PG.StarWarsGame.Infrastructure.Games;
using PG.StarWarsGame.Infrastructure.Services.Name;

namespace AET.ModVerifyTool.ModSelectors;

internal class SettingsBasedModSelector(IServiceProvider serviceProvider)
{
private readonly IFileSystem _fileSystem = serviceProvider.GetRequiredService<IFileSystem>();
public VerifyGameInstallationData CreateInstallationDataFromSettings(GameInstallationsSettings settings)
{
var gameLocations = new ModSelectorFactory(serviceProvider).CreateSelector(settings)
Expand All @@ -35,30 +27,12 @@ public VerifyGameInstallationData CreateInstallationDataFromSettings(GameInstall
};
}

private string GetNameFromGameLocations(IPlayableObject? targetObject, GameLocations gameLocations, GameEngineType engineType)
private static string GetNameFromGameLocations(IPlayableObject? targetObject, GameLocations gameLocations, GameEngineType engineType)
{
if (targetObject is not null)
return targetObject.Name;

var mod = gameLocations.ModPaths.FirstOrDefault();

var name = mod is not null ? GetNameFromMod(mod) : GetNameFromGame(engineType);

if (string.IsNullOrEmpty(name))
throw new InvalidOperationException("Mod or game name cannot be null or empty.");

return name;
}

private string? GetNameFromGame(GameEngineType type)
{
var nameResolver = serviceProvider.GetRequiredService<IGameNameResolver>();
return nameResolver.ResolveName(new GameIdentity(type.FromEngineType(), GamePlatform.Undefined), CultureInfo.InvariantCulture);
}

private string? GetNameFromMod(string mod)
{
var nameResolver = serviceProvider.GetRequiredService<IModNameResolver>();
return nameResolver.ResolveName(new ModReference(_fileSystem.Path.GetFullPath(mod), ModType.Default), CultureInfo.InvariantCulture);
return mod ?? gameLocations.GamePath;
}
}
Loading
Loading