diff --git a/ModdingToolBase b/ModdingToolBase index 5313f2a..7893e04 160000 --- a/ModdingToolBase +++ b/ModdingToolBase @@ -1 +1 @@ -Subproject commit 5313f2aaa89894fdf602c0c73ae78fc407aadbe6 +Subproject commit 7893e0437e9bc8880962b1b553839eb9cc57b1e9 diff --git a/RawDevTools.sln b/RawDevTools.sln index 6c3310b..6f4e119 100644 --- a/RawDevTools.sln +++ b/RawDevTools.sln @@ -55,10 +55,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExternalUpdater.Core", "Mod EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationBase.CommandLine", "ModdingToolBase\src\AnakinApps\ApplicationBase.CommandLine\ApplicationBase.CommandLine.csproj", "{8768819D-B0C2-4487-3B3A-84A90F36BAB7}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ApplicationBase.Shared", "ModdingToolBase\src\AnakinApps\ApplicationBase.Shared\ApplicationBase.Shared.shproj", "{B297A13A-8E3A-436C-BA97-8B5F57827FFE}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppUpdaterFramework.Attributes", "ModdingToolBase\src\Updater\AppUpdaterFramework.Attributes\AppUpdaterFramework.Attributes.csproj", "{1AA3A6D5-5492-26C3-E36C-54AB5997D2CF}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ApplicationBase.Shared", "ModdingToolBase\src\AnakinApps\ApplicationBase.Shared\ApplicationBase.Shared.shproj", "{B297A13A-8E3A-436C-BA97-8B5F57827FFE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -169,8 +169,8 @@ Global {846253D9-D766-8852-74B9-E1E04B9F2A81} = {3E986062-E81F-4833-A127-24FA73FBCB1B} {EF1942AC-C4E5-A6AA-0328-1DA00E3BE7A1} = {3E986062-E81F-4833-A127-24FA73FBCB1B} {8768819D-B0C2-4487-3B3A-84A90F36BAB7} = {46DB413A-0F73-48A6-9071-9C38916BE6FC} - {B297A13A-8E3A-436C-BA97-8B5F57827FFE} = {46DB413A-0F73-48A6-9071-9C38916BE6FC} {1AA3A6D5-5492-26C3-E36C-54AB5997D2CF} = {3E986062-E81F-4833-A127-24FA73FBCB1B} + {B297A13A-8E3A-436C-BA97-8B5F57827FFE} = {46DB413A-0F73-48A6-9071-9C38916BE6FC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DC15751A-BB36-4EF1-BFF0-2DF1E419AC8F} diff --git a/src/DevLauncher.Tests/DevLauncher.Tests.csproj b/src/DevLauncher.Tests/DevLauncher.Tests.csproj index a4d6339..65466d9 100644 --- a/src/DevLauncher.Tests/DevLauncher.Tests.csproj +++ b/src/DevLauncher.Tests/DevLauncher.Tests.csproj @@ -14,7 +14,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/DevLauncher/Options/DevToolsOptionBase.cs b/src/DevLauncher/Options/DevToolsOptionBase.cs index f2038ed..bf9ab86 100644 --- a/src/DevLauncher/Options/DevToolsOptionBase.cs +++ b/src/DevLauncher/Options/DevToolsOptionBase.cs @@ -6,4 +6,7 @@ internal abstract class DevToolsOptionBase { [Option("warnAsError")] public virtual bool WarnAsError { get; init; } + + [Option('v', "verbose", Default = false, HelpText = "Enables verbose logging for this application.")] + public bool VerboseLogging { get; init; } } \ No newline at end of file diff --git a/src/DevLauncher/Options/VerboseLoggingOption.cs b/src/DevLauncher/Options/VerboseLoggingOption.cs new file mode 100644 index 0000000..5b9882a --- /dev/null +++ b/src/DevLauncher/Options/VerboseLoggingOption.cs @@ -0,0 +1,9 @@ +using CommandLine; + +namespace RepublicAtWar.DevLauncher.Options; + +internal class VerboseLoggingOption +{ + [Option('v', "verbose", Default = false, HelpText = "Enables verbose logging for this application.")] + public bool VerboseLogging { get; init; } +} \ No newline at end of file diff --git a/src/DevLauncher/Pipelines/BuildPipeline.cs b/src/DevLauncher/Pipelines/BuildPipeline.cs index e1bac39..7106e48 100644 --- a/src/DevLauncher/Pipelines/BuildPipeline.cs +++ b/src/DevLauncher/Pipelines/BuildPipeline.cs @@ -59,7 +59,7 @@ private IEnumerable CreateBuildSteps() { yield return new PackMegFileStep(new RawAiPackMegConfiguration(mod, ServiceProvider), _settings, ServiceProvider); yield return new PackMegFileStep(new RawCustomMapsPackMegConfiguration(mod, ServiceProvider), _settings, ServiceProvider); - yield return new PackMegFileStep(new RawNonLocalizedSFXMegConfiguration(mod, ServiceProvider), _settings, ServiceProvider); + yield return new PackMegFileStep(new RawNonLocalizedSfxMegConfiguration(mod, ServiceProvider), _settings, ServiceProvider); yield return new PackIconsStep(_settings, ServiceProvider); yield return new CompileLocalizationStep(_settings, ServiceProvider); @@ -72,7 +72,7 @@ private IEnumerable CreateBuildSteps() continue; yield return new PackMegFileStep( - new RawLocalizedSFX2DMegConfiguration(focLanguage, isRaWSupported, mod, ServiceProvider), + new RawLocalizedSfx2DMegConfiguration(focLanguage, isRaWSupported, mod, ServiceProvider), _settings, ServiceProvider); } diff --git a/src/DevLauncher/Pipelines/ReleaseRawPipeline.cs b/src/DevLauncher/Pipelines/ReleaseRawPipeline.cs index 24ad272..59fdf6e 100644 --- a/src/DevLauncher/Pipelines/ReleaseRawPipeline.cs +++ b/src/DevLauncher/Pipelines/ReleaseRawPipeline.cs @@ -9,7 +9,7 @@ using PG.StarWarsGame.Infrastructure.Games; using PG.StarWarsGame.Infrastructure.Mods; using RepublicAtWar.DevLauncher.Utilities; -using RepublicAtWar.DevTools.Steps.Release; +using RepublicAtWar.DevTools.Steps.Releasing; using RepublicAtWar.DevTools.Steps.Settings; namespace RepublicAtWar.DevLauncher.Pipelines; diff --git a/src/DevLauncher/Program.cs b/src/DevLauncher/Program.cs index 53b0ddb..9be543b 100644 --- a/src/DevLauncher/Program.cs +++ b/src/DevLauncher/Program.cs @@ -1,39 +1,41 @@ using AET.ModVerify.Reporting.Reporters; using AET.SteamAbstraction; +using AnakinRaW.ApplicationBase; +using AnakinRaW.ApplicationBase.Environment; +using AnakinRaW.ApplicationBase.Update; +using AnakinRaW.ApplicationBase.Utilities; using AnakinRaW.AppUpdaterFramework.Handlers.Interaction; +using AnakinRaW.AppUpdaterFramework.Json; +using AnakinRaW.CommonUtilities.FileSystem; using AnakinRaW.CommonUtilities.Hashing; using AnakinRaW.CommonUtilities.Registry; using AnakinRaW.CommonUtilities.Registry.Windows; +using CommandLine; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using PG.Commons; using PG.StarWarsGame.Engine; +using PG.StarWarsGame.Engine.Xml.Parsers; using PG.StarWarsGame.Files.ALO; using PG.StarWarsGame.Files.DAT; using PG.StarWarsGame.Files.MEG; using PG.StarWarsGame.Files.MTD; using PG.StarWarsGame.Files.XML; +using PG.StarWarsGame.Files.XML.Parsers; using PG.StarWarsGame.Infrastructure; using PG.StarWarsGame.Infrastructure.Clients.Steam; +using RepublicAtWar.DevLauncher.Options; using RepublicAtWar.DevLauncher.Services; +using RepublicAtWar.DevLauncher.Update; using Serilog; using Serilog.Events; using Serilog.Filters; +using Serilog.Sinks.SystemConsole.Themes; using System; using System.Collections.Generic; using System.IO.Abstractions; using System.Reflection; using System.Threading.Tasks; -using AnakinRaW.ApplicationBase; -using AnakinRaW.ApplicationBase.Environment; -using AnakinRaW.ApplicationBase.Update; -using AnakinRaW.ApplicationBase.Utilities; -using AnakinRaW.AppUpdaterFramework.Json; -using AnakinRaW.CommonUtilities.FileSystem; -using PG.StarWarsGame.Engine.Xml.Parsers; -using PG.StarWarsGame.Files.XML.Parsers; -using RepublicAtWar.DevLauncher.Update; -using Serilog.Sinks.SystemConsole.Themes; using Testably.Abstractions; using ILogger = Serilog.ILogger; @@ -116,7 +118,15 @@ protected override void ResetApp(Microsoft.Extensions.Logging.ILogger? logger) protected override void CreateAppServices(IServiceCollection services, IReadOnlyCollection args) { - services.AddLogging(ConfigureLogging); + var verboseLogging = false; + + using var parser = new Parser(s => + { + s.IgnoreUnknownArguments = true; + }); + parser.ParseArguments(args).WithParsed(o => verboseLogging = o.VerboseLogging); + + services.AddLogging(builder => ConfigureLogging(builder, verboseLogging)); services.AddSingleton(sp => new HashingService(sp)); @@ -144,7 +154,7 @@ protected override void CreateAppServices(IServiceCollection services, IReadOnly sc => { sc.AddSingleton(new CosturaLockedFileHandler()); }); } - private void ConfigureLogging(ILoggingBuilder loggingBuilder) + private void ConfigureLogging(ILoggingBuilder loggingBuilder, bool verbose) { loggingBuilder.ClearProviders(); @@ -155,6 +165,9 @@ private void ConfigureLogging(ILoggingBuilder loggingBuilder) loggingBuilder.AddDebug(); #endif + if (verbose) + logLevel = LogEventLevel.Verbose; + var fileLogger = SetupFileLogging(ApplicationEnvironment.ApplicationLocalPath, logLevel); loggingBuilder.AddSerilog(fileLogger); diff --git a/src/DevLauncher/Properties/launchSettings.json b/src/DevLauncher/Properties/launchSettings.json index 8cf03f9..98701b1 100644 --- a/src/DevLauncher/Properties/launchSettings.json +++ b/src/DevLauncher/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Build & Run Mod": { "commandName": "Project", - "commandLineArgs": "", + "commandLineArgs": "--verboseBootstrapLogging -verbose --skipUpdate", "workingDirectory": "C:\\Privat\\Steam\\steamapps\\common\\Star Wars Empire at War\\corruption\\Mods\\republic-at-war" }, "DAT2LocFile": { diff --git a/src/DevLauncher/RawDevLauncher.cs b/src/DevLauncher/RawDevLauncher.cs index 1ac5ac4..17b3145 100644 --- a/src/DevLauncher/RawDevLauncher.cs +++ b/src/DevLauncher/RawDevLauncher.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using AnakinRaW.ApplicationBase.Environment; +using AnakinRaW.ApplicationBase.Environment; using AnakinRaW.ApplicationBase.Update.Options; using AnakinRaW.CommonUtilities.SimplePipeline; using CommandLine; @@ -16,6 +12,10 @@ using RepublicAtWar.DevLauncher.Update; using RepublicAtWar.DevTools.Services; using RepublicAtWar.DevTools.Steps.Settings; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace RepublicAtWar.DevLauncher; @@ -36,7 +36,7 @@ public async Task RunAsync(IReadOnlyList args) return await RunCore(option).ConfigureAwait(false); } - + private async Task UpdateLauncher(IReadOnlyList args) { var skipUpdate = false; diff --git a/src/MegCompile/PackSfxMegPipeline.cs b/src/MegCompile/PackSfxMegPipeline.cs index d7e6afc..f799c3f 100644 --- a/src/MegCompile/PackSfxMegPipeline.cs +++ b/src/MegCompile/PackSfxMegPipeline.cs @@ -32,7 +32,7 @@ protected override Task> BuildSteps() continue; steps.Add(new PackMegFileStep( - new RawLocalizedSFX2DMegConfiguration(focLanguage, isRaWSupported, mod, ServiceProvider), settings, + new RawLocalizedSfx2DMegConfiguration(focLanguage, isRaWSupported, mod, ServiceProvider), settings, ServiceProvider)); } diff --git a/src/RawDevTools/Steps/Build/Meg/Config/RawLocalizedSFX2DMegConfiguration.cs b/src/RawDevTools/Steps/Build/Meg/Config/RawLocalizedSFX2DMegConfiguration.cs index b98b4da..65a22e7 100644 --- a/src/RawDevTools/Steps/Build/Meg/Config/RawLocalizedSFX2DMegConfiguration.cs +++ b/src/RawDevTools/Steps/Build/Meg/Config/RawLocalizedSFX2DMegConfiguration.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.IO.Abstractions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using PG.StarWarsGame.Engine; @@ -10,7 +9,7 @@ namespace RepublicAtWar.DevTools.Steps.Build.Meg.Config; -public sealed class RawLocalizedSFX2DMegConfiguration : RawPackMegConfiguration +public sealed class RawLocalizedSfx2DMegConfiguration : RawPackMegConfiguration { private readonly Lazy?> _lazyLocalizeFileName; private readonly LanguageType _language; @@ -26,7 +25,8 @@ public sealed class RawLocalizedSFX2DMegConfiguration : RawPackMegConfiguration public override bool FileNamesOnly => true; - public RawLocalizedSFX2DMegConfiguration(LanguageType language, + public RawLocalizedSfx2DMegConfiguration( + LanguageType language, bool languageSupported, IPhysicalPlayableObject physicalGameObject, IServiceProvider serviceProvider) : base(physicalGameObject, serviceProvider) @@ -47,11 +47,9 @@ public RawLocalizedSFX2DMegConfiguration(LanguageType language, private IEnumerable GetFilesToPack() { - var fs = ServiceProvider.GetRequiredService(); + var path = FileSystem.Path.Combine("Data\\Audio\\Units\\", _language.ToString()); - var path = fs.Path.Combine("Data\\Audio\\Units\\", _language.ToString()); - - if (!fs.Directory.Exists(path)) + if (!FileSystem.Directory.Exists(path)) { if (IsLanguageSupported) throw new DirectoryNotFoundException($"Unable to find SFX directory: '{path}'"); @@ -60,7 +58,7 @@ private IEnumerable GetFilesToPack() path = $"Data\\Audio\\Units\\{LanguageType.English}"; } - if (!fs.Directory.Exists(path)) + if (!FileSystem.Directory.Exists(path)) throw new DirectoryNotFoundException($"Unable to find SFX directory: '{path}'"); return new List diff --git a/src/RawDevTools/Steps/Build/Meg/Config/RawNonLocalizedSFXMegConfiguration.cs b/src/RawDevTools/Steps/Build/Meg/Config/RawNonLocalizedSFXMegConfiguration.cs index acc35b4..595011f 100644 --- a/src/RawDevTools/Steps/Build/Meg/Config/RawNonLocalizedSFXMegConfiguration.cs +++ b/src/RawDevTools/Steps/Build/Meg/Config/RawNonLocalizedSFXMegConfiguration.cs @@ -4,7 +4,7 @@ namespace RepublicAtWar.DevTools.Steps.Build.Meg.Config; -public class RawNonLocalizedSFXMegConfiguration( +public class RawNonLocalizedSfxMegConfiguration( IPhysicalPlayableObject physicalGameObject, IServiceProvider serviceProvider) : RawPackMegConfiguration(physicalGameObject, serviceProvider) diff --git a/src/RawDevTools/Steps/Build/Meg/Config/RawPackMegConfiguration.cs b/src/RawDevTools/Steps/Build/Meg/Config/RawPackMegConfiguration.cs index 6c9f2dd..8f4950c 100644 --- a/src/RawDevTools/Steps/Build/Meg/Config/RawPackMegConfiguration.cs +++ b/src/RawDevTools/Steps/Build/Meg/Config/RawPackMegConfiguration.cs @@ -9,11 +9,19 @@ namespace RepublicAtWar.DevTools.Steps.Build.Meg.Config; public abstract class RawPackMegConfiguration : IPackMegConfiguration { - protected ILogger? Logger { get; } + protected readonly ILogger? Logger; + protected readonly IFileSystem FileSystem; + protected readonly IServiceProvider ServiceProvider; - protected IServiceProvider ServiceProvider { get; } + public abstract IEnumerable FilesToPack { get; } - protected readonly IFileSystem FileSystem; + public abstract string FileName { get; } + + public virtual bool FileNamesOnly => false; + + public IDirectoryInfo VirtualRootDirectory { get; } + + public virtual Func? ModifyFileNameAction => null; protected RawPackMegConfiguration(IPhysicalPlayableObject physicalGameObject, IServiceProvider serviceProvider) @@ -23,13 +31,4 @@ protected RawPackMegConfiguration(IPhysicalPlayableObject physicalGameObject, FileSystem = serviceProvider.GetRequiredService(); VirtualRootDirectory = physicalGameObject.Directory; } - - public abstract IEnumerable FilesToPack { get; } - - public abstract string FileName { get; } - - public virtual bool FileNamesOnly => false; - - public IDirectoryInfo VirtualRootDirectory { get; } - public virtual Func? ModifyFileNameAction => null; } \ No newline at end of file diff --git a/src/RawDevTools/Steps/Releasing/CopyReleaseStep.cs b/src/RawDevTools/Steps/Releasing/CopyReleaseStep.cs index e94d2fc..6aa4734 100644 --- a/src/RawDevTools/Steps/Releasing/CopyReleaseStep.cs +++ b/src/RawDevTools/Steps/Releasing/CopyReleaseStep.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging; using RepublicAtWar.DevTools.Steps.Settings; -namespace RepublicAtWar.DevTools.Steps.Release; +namespace RepublicAtWar.DevTools.Steps.Releasing; public class CopyReleaseStep : PipelineStep, IProgressStep { diff --git a/src/RawDevTools/Steps/Releasing/CreateUploadMetaArtifactsStep.cs b/src/RawDevTools/Steps/Releasing/CreateUploadMetaArtifactsStep.cs index bcb546d..d139674 100644 --- a/src/RawDevTools/Steps/Releasing/CreateUploadMetaArtifactsStep.cs +++ b/src/RawDevTools/Steps/Releasing/CreateUploadMetaArtifactsStep.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Logging; using Semver; -namespace RepublicAtWar.DevTools.Steps.Release; +namespace RepublicAtWar.DevTools.Steps.Releasing; public class CreateUploadMetaArtifactsStep(IServiceProvider serviceProvider) : SynchronizedStep(serviceProvider) { @@ -19,9 +19,9 @@ public class CreateUploadMetaArtifactsStep(IServiceProvider serviceProvider) : S private readonly IDictionary _replacementVariables = new Dictionary(); - internal string? SteamTitle { get; private set; } + internal string SteamTitle { get; private set; } = null!; - internal string? SteamJsonName { get; private set; } + internal string SteamJsonName { get; private set; } = null!; protected override void RunSynchronized(CancellationToken token) {