fix mod count in log parser metadata
This commit is contained in:
parent
8e9237bdd7
commit
e0ef8a20a5
|
@ -1,6 +1,10 @@
|
|||
← [README](README.md)
|
||||
|
||||
# Release notes
|
||||
## Upcoming release
|
||||
* For the web UI:
|
||||
* Fixed the mod count in the log parser metadata.
|
||||
|
||||
## 3.15.0
|
||||
Released 17 June 2022 for Stardew Valley 1.5.6 or later. See [release highlights](https://www.patreon.com/posts/67877219).
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue