summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-06-19 17:21:53 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-06-19 17:21:53 -0400
commite0ef8a20a5e7ccf1de32ff1a06f1aa62e37eb1db (patch)
treed51b5302d902f18021b72158cc95c249616ede2b /src/SMAPI.Web
parent8e9237bdd7ec179975c9be5e28c811b42007e707 (diff)
downloadSMAPI-e0ef8a20a5e7ccf1de32ff1a06f1aa62e37eb1db.tar.gz
SMAPI-e0ef8a20a5e7ccf1de32ff1a06f1aa62e37eb1db.tar.bz2
SMAPI-e0ef8a20a5e7ccf1de32ff1a06f1aa62e37eb1db.zip
fix mod count in log parser metadata
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs4
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs20
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml2
3 files changed, 20 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
index 55272b23..7fc8f958 100644
--- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
@@ -77,8 +77,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
};
// parse log messages
- LogModInfo smapiMod = new(name: "SMAPI", author: "Pathoschild", version: "", description: "", loaded: true);
- LogModInfo gameMod = new(name: "game", author: "", version: "", description: "", loaded: true);
+ LogModInfo smapiMod = new(name: "SMAPI", author: "Pathoschild", version: "", description: "", loaded: true, isMod: false);
+ LogModInfo gameMod = new(name: "game", author: "", version: "", description: "", loaded: true, isMod: false);
IDictionary<string, List<LogModInfo>> mods = new Dictionary<string, List<LogModInfo>>();
bool inModList = false;
bool inContentPackList = false;
diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
index a6b9165c..4b80a830 100644
--- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
@@ -39,9 +39,15 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
[MemberNotNullWhen(true, nameof(LogModInfo.UpdateVersion), nameof(LogModInfo.UpdateLink))]
public bool HasUpdate => this.UpdateVersion != null && this.Version != this.UpdateVersion;
- /// <summary>Whether the mod is a content pack for another mod.</summary>
+ /// <summary>Whether this is an actual mod (rather than a special entry for SMAPI or the game itself).</summary>
+ public bool IsMod { get; }
+
+ /// <summary>Whether this is a C# code mod.</summary>
+ public bool IsCodeMod { get; }
+
+ /// <summary>Whether this is a content pack for another mod.</summary>
[MemberNotNullWhen(true, nameof(LogModInfo.ContentPackFor))]
- public bool IsContentPack => !string.IsNullOrWhiteSpace(this.ContentPackFor);
+ public bool IsContentPack { get; }
/*********
@@ -57,7 +63,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
/// <param name="contentPackFor">The name of the mod for which this is a content pack (if applicable).</param>
/// <param name="errors">The number of errors logged by this mod.</param>
/// <param name="loaded">Whether the mod was loaded into the game.</param>
- public LogModInfo(string name, string author, string version, string description, string? updateVersion = null, string? updateLink = null, string? contentPackFor = null, int errors = 0, bool loaded = true)
+ /// <param name="isMod">Whether this is an actual mod (instead of a special entry for SMAPI or the game).</param>
+ public LogModInfo(string name, string author, string version, string description, string? updateVersion = null, string? updateLink = null, string? contentPackFor = null, int errors = 0, bool loaded = true, bool isMod = true)
{
this.Name = name;
this.Author = author;
@@ -68,6 +75,13 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
this.ContentPackFor = contentPackFor;
this.Errors = errors;
this.Loaded = loaded;
+
+ if (isMod)
+ {
+ this.IsMod = true;
+ this.IsContentPack = !string.IsNullOrWhiteSpace(this.ContentPackFor);
+ this.IsCodeMod = !this.IsContentPack;
+ }
}
/// <summary>Add an update alert for this mod.</summary>
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 5e55906d..33239a2b 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -293,7 +293,7 @@ else if (log?.IsValid == true)
<table
id="metadata"
class="table"
- data-code-mods="@log.Mods.Count(p => !p.IsContentPack)"
+ data-code-mods="@log.Mods.Count(p => p.IsCodeMod)"
data-content-packs="@log.Mods.Count(p => p.IsContentPack)"
data-os="@log.OperatingSystem"
data-game-version="@log.GameVersion"