Game infrastructire implementation, providing classes and services to detect and launch Petroglyph Star Wars games (EaW, FoC) and mods.
$ dotnet add package AlamoEngineTools.PG.StarWarsGame.Infrastructure.NET library for managing and launching Petroglyph's Star Wars Empire at War and mod installations.
Include the library as a nuget package: AlamoEngineTools.PG.StarWarsGame.Infrastructure
See the listed code below to see a minimal example how to use the library.
var fs = new FileSystem();
var sc = new ServiceCollection();
sc.AddSingleton(WindowsRegistry.Default);
sc.AddSingleton<IFileSystem>(fs);
// Initialize the library
PetroglyphGameInfrastructure.InitializeServices(sc);
var serviceProvider = sc.BuildServiceProvider();
// Search for Forces of Corruption at the specified directory
var gameFactory = services.GetRequiredService<IGameFactory>();
var detector = new DirectoryGameDetector(fs.DirectoryInfo.New("YOUR_GAME_DIR"), serviceProvider);
var game = gameFactory.CreateGame(detector.Detect(GameType.Foc), CultureInfo.CurrentCulture);
// Create a client and launch the game with WINDOWED arugment.
var client = services.GetRequiredService<IGameClientFactory>().CreateClient(game);
using var gameArgs = new GameArgumentsBuilder().Add(new WindowedArgument());
client.Play(gameArgs.Build());
See the sample application for an extended example including how to work with game mods.