Skip to content

Commit

Permalink
Add an error count counter
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Feb 17, 2024
1 parent adfa158 commit e32debd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/PatchManager.Core/Assets/PatchingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ internal static class PatchingManager
private static Dictionary<string, List<(string name, string text)>> _createdAssets = new();

internal static int TotalPatchCount;
internal static int TotalErrorCount;

public static void GenerateUniverse(HashSet<string> singleFileModIds)
{
var loadedPlugins = PluginList.AllEnabledAndActivePlugins.Select(x => x.Guid).ToList();
Expand Down Expand Up @@ -87,6 +89,7 @@ private static string PatchJson(string label, string assetName, string text)
}
catch (Exception e)
{
TotalErrorCount += 1;
Console.WriteLine($"Patch of {label}:{assetName} errored due to: {e}");
text = backup;
}
Expand Down
2 changes: 2 additions & 0 deletions src/PatchManager.Core/Patches/Runtime/LoadingBarPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static bool ShuffleLoadingTip(ref LoadingBar __instance)
if (!InjectPatchManagerTips)
return true;
__instance.tipsText.text = $"Patch Manager: {PatchingManager.TotalPatchCount} patches";
if (PatchingManager.TotalErrorCount > 0)
__instance.tipsText.text += $", {PatchingManager.TotalErrorCount} errors";

return false;
}
Expand Down

0 comments on commit e32debd

Please sign in to comment.