Skip to content

Commit

Permalink
imp - Indicate what addons loaded or failed
Browse files Browse the repository at this point in the history
---

We need to indicate what kernel addons failed to load and/or initialize.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 15, 2024
1 parent 7f39c23 commit 3064db6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions public/Nitrocid/Kernel/Extensions/AddonTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using Nitrocid.Kernel.Exceptions;
using Nitrocid.Languages;
using Nitrocid.Misc.Reflection;
using Nitrocid.Misc.Splash;
using Nitrocid.Modifications;
using Nitrocid.Security.Signing;
using System;
Expand Down Expand Up @@ -146,6 +147,7 @@ internal static void ProcessAddon(string addon, ModLoadPriority type)
DebugWriter.WriteDebug(DebugLevel.W, "Skipping addon entry {0} because of conflicts with the already-loaded addon in the queue [{1}]...", addon, addonPath);
return;
}
SplashReport.ReportProgress(Translate.DoTranslation("Initializing kernel addon") + " {0}...", Path.GetFileName(addon));
probedAddons.Add(addonPath);
var asm = Assembly.LoadFrom(addonPath);
var addonInstance = GetAddonInstance(asm) ??
Expand All @@ -157,6 +159,7 @@ internal static void ProcessAddon(string addon, ModLoadPriority type)
// Call the start function
try
{
SplashReport.ReportProgress(Translate.DoTranslation("Starting kernel addon") + " {0}...", addonInstance.AddonName);
addonInstance.StartAddon();
DebugWriter.WriteDebug(DebugLevel.I, "Started!");

Expand All @@ -165,16 +168,19 @@ internal static void ProcessAddon(string addon, ModLoadPriority type)
if (!addons.Where((addon) => addonInstance.AddonName == addon.AddonName).Any())
addons.Add(info);
DebugWriter.WriteDebug(DebugLevel.I, "Loaded addon!");
SplashReport.ReportProgress(Translate.DoTranslation("Started kernel addon") + " {0}!", addonInstance.AddonName);
}
catch (Exception ex)
{
SplashReport.ReportProgress(Translate.DoTranslation("Failed to start kernel addon") + " {0}.", addonInstance.AddonName);
DebugWriter.WriteDebug(DebugLevel.E, "Failed to start addon {0}. {1}", addon, ex.Message);
DebugWriter.WriteDebugStackTrace(ex);
}
}
}
catch (Exception ex)
{
SplashReport.ReportProgress(Translate.DoTranslation("Failed to initialize kernel addon") + " {0}.", Path.GetFileName(addon));
DebugWriter.WriteDebug(DebugLevel.E, "Failed to load addon {0}. {1}", addon, ex.Message);
DebugWriter.WriteDebugStackTrace(ex);
}
Expand Down

0 comments on commit 3064db6

Please sign in to comment.