diff options
Diffstat (limited to 'src/SMAPI.Web/Framework/LogParsing')
-rw-r--r-- | src/SMAPI.Web/Framework/LogParsing/LogParser.cs | 4 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs | 20 |
2 files changed, 19 insertions, 5 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> |