From eb63ffaeee005a4364c2e2c52af64a78c9288e31 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Wed, 17 Apr 2024 23:34:55 +0200 Subject: [PATCH] Bump Version. Fix ResoniteModdingGroup/MonkeyLoader.GamePacks.Resonite/#1 --- MonkeyLoader/Entrypoint.cs | 14 ++++++++++++++ MonkeyLoader/EnumerableExtensions.cs | 20 ++++++++++---------- MonkeyLoader/Meta/LocationConfigSection.cs | 6 +++--- MonkeyLoader/MonkeyLoader.csproj | 2 +- docfx.json | 2 +- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/MonkeyLoader/Entrypoint.cs b/MonkeyLoader/Entrypoint.cs index 5f34efe..e45413a 100644 --- a/MonkeyLoader/Entrypoint.cs +++ b/MonkeyLoader/Entrypoint.cs @@ -15,6 +15,20 @@ public static void Start() { var log = new FileLoggingHandler("MonkeyLoader/MonkeyLog.log"); + foreach (var file in Directory.EnumerateFiles("./")) + { + try + { + if (Path.GetFileName(file).StartsWith("doorstop", StringComparison.OrdinalIgnoreCase) + && Path.GetExtension(file).Equals(".log", StringComparison.OrdinalIgnoreCase)) + File.Delete(file); + } + catch + { + log.Warn(() => $"Failed to delete doorstop logfile - probably the active one: {file}"); + } + } + try { AppDomain.CurrentDomain.UnhandledException += (sender, e) => log.Fatal(() => (e.ExceptionObject as Exception)?.Format("Unhandled Exception!") ?? "Unhandled Exception!"); diff --git a/MonkeyLoader/EnumerableExtensions.cs b/MonkeyLoader/EnumerableExtensions.cs index 5386f31..c881bc0 100644 --- a/MonkeyLoader/EnumerableExtensions.cs +++ b/MonkeyLoader/EnumerableExtensions.cs @@ -295,8 +295,8 @@ public static IEnumerable TopologicalSort(this IEnumerable /// The delegate to safely invoke. /// The arguments for the invocation. /// Thrown when any invoked methods threw. Contains all nested Exceptions. - public static void TryInvokeAll(this Delegate del, params object[] args) - => del.GetInvocationList().TryInvokeAll(args); + public static void TryInvokeAll(this Delegate? del, params object[] args) + => del?.GetInvocationList().TryInvokeAll(args); /// /// Individually calls all given in a try-catch-block, @@ -305,14 +305,14 @@ public static void TryInvokeAll(this Delegate del, params object[] args) /// The delegates to safely invoke. /// The arguments for the invocation. /// Thrown when any invoked methods threw. Contains all nested Exceptions. - public static void TryInvokeAll(this IEnumerable delegates, params object[] args) + public static void TryInvokeAll(this IEnumerable? delegates, params object[] args) { - if (!delegates.Any()) + if (!delegates?.Any() ?? true) return; var exceptions = new List(); - foreach (var handler in delegates) + foreach (var handler in delegates!) { try { @@ -338,8 +338,8 @@ public static void TryInvokeAll(this IEnumerable delegates, params obj /// The -returning delegate to safely invoke. /// The arguments for the invocation. /// Thrown when any invoked methods threw. Contains all nested Exceptions. - public static Task TryInvokeAllAsync(this Delegate del, params object[] args) - => del.GetInvocationList().TryInvokeAllAsync(args); + public static Task TryInvokeAllAsync(this Delegate? del, params object[] args) + => del?.GetInvocationList().TryInvokeAllAsync(args) ?? Task.CompletedTask; /// /// Sequentially calls and awaits all given @@ -349,14 +349,14 @@ public static Task TryInvokeAllAsync(this Delegate del, params object[] args) /// The -returning delegates to safely invoke. /// The arguments for the invocation. /// Thrown when any invoked methods threw. Contains all nested Exceptions. - public static async Task TryInvokeAllAsync(this IEnumerable delegates, params object[] args) + public static async Task TryInvokeAllAsync(this IEnumerable? delegates, params object[] args) { - if (!delegates.Any()) + if (!delegates?.Any() ?? true) return; var exceptions = new List(); - foreach (var handler in delegates) + foreach (var handler in delegates!) { try { diff --git a/MonkeyLoader/Meta/LocationConfigSection.cs b/MonkeyLoader/Meta/LocationConfigSection.cs index f9b7157..1e8f6d1 100644 --- a/MonkeyLoader/Meta/LocationConfigSection.cs +++ b/MonkeyLoader/Meta/LocationConfigSection.cs @@ -14,9 +14,9 @@ namespace MonkeyLoader.Meta /// public sealed class LocationConfigSection : ConfigSection { - public readonly DefiningConfigKey ConfigsKey = new("Configs", "Paths to check for configuration files.", () => "./MonkeyLoader/Configs", valueValidator: PathValidator); - public readonly DefiningConfigKey GamePacksKey = new("GamePacks", "Paths to check for game packs.", () => "./MonkeyLoader/GamePacks", valueValidator: PathValidator); - public readonly DefiningConfigKey LibsKey = new("Libs", "Paths to check for dependency libraries.", () => "./MonkeyLoader/Libs", valueValidator: PathValidator); + public readonly DefiningConfigKey ConfigsKey = new("Configs", "Path to check for configuration files.", () => "./MonkeyLoader/Configs", valueValidator: PathValidator); + public readonly DefiningConfigKey GamePacksKey = new("GamePacks", "Path to check for game packs.", () => "./MonkeyLoader/GamePacks", valueValidator: PathValidator); + public readonly DefiningConfigKey LibsKey = new("Libs", "Path to check for dependency libraries.", () => "./MonkeyLoader/Libs", valueValidator: PathValidator); public readonly DefiningConfigKey> ModsKey = new("Mods", "Loading locations to check for mods.", () => new() { new ModLoadingLocation("./MonkeyLoader/Mods", true, true, "\\.disabled$") }, valueValidator: locations => locations?.Count > 0); public readonly DefiningConfigKey PatchedAssembliesKey = new("PatchedAssemblies", "Path to save pre-patched assemblies to. Set null to disable.", () => "./MonkeyLoader/PatchedAssemblies", valueValidator: PathValidator); diff --git a/MonkeyLoader/MonkeyLoader.csproj b/MonkeyLoader/MonkeyLoader.csproj index e94e30f..a083cef 100644 --- a/MonkeyLoader/MonkeyLoader.csproj +++ b/MonkeyLoader/MonkeyLoader.csproj @@ -11,7 +11,7 @@ True MonkeyLoader Banane9 - 0.14.2-beta + 0.15.0-beta A convenience and extendability focused mod loader using NuGet packages. README.md LGPL-3.0-or-later diff --git a/docfx.json b/docfx.json index 753f5b2..89d5a89 100644 --- a/docfx.json +++ b/docfx.json @@ -39,7 +39,7 @@ ], "globalMetadata": { "_appName": "MonkeyLoader", - "_appTitle": "Monkey Loader", + "_appTitle": "MonkeyLoader", "_enableSearch": true, "pdf": false, "sitemap": {