summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 22:27:07 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 22:27:07 -0400
commitd813c4e2c8522584beaf1432725b4cdd2cc251b5 (patch)
treedd7ce212182e773d826c955d3e1deaa7cbcdec40 /src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
parente376386d250780c50f17c40f82419128b4e7beab (diff)
downloadSMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.tar.gz
SMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.tar.bz2
SMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.zip
fix log parsing for invalid content packs (#860)
Diffstat (limited to 'src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs')
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
index 557f08ff..c81942e4 100644
--- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs
@@ -48,21 +48,24 @@ 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>The mod type.</summary>
+ public ModType ModType { get; }
+
/// <summary>Whether this is an actual mod (rather than a special entry for SMAPI or the game itself).</summary>
- public bool IsMod { get; }
+ public bool IsMod => this.ModType != ModType.Special;
/// <summary>Whether this is a C# code mod.</summary>
- public bool IsCodeMod { get; }
+ public bool IsCodeMod => this.ModType == ModType.CodeMod;
/// <summary>Whether this is a content pack for another mod.</summary>
- [MemberNotNullWhen(true, nameof(LogModInfo.ContentPackFor))]
- public bool IsContentPack { get; }
+ public bool IsContentPack => this.ModType == ModType.ContentPack;
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
+ /// <param name="modType">The mod type.</param>
/// <param name="name">The mod name.</param>
/// <param name="author">The mod author.</param>
/// <param name="version">The mod version.</param>
@@ -72,9 +75,9 @@ 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>
- /// <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)
+ public LogModInfo(ModType modType, string name, string author, string version, string description, string? updateVersion = null, string? updateLink = null, string? contentPackFor = null, int errors = 0, bool loaded = true)
{
+ this.ModType = modType;
this.Name = name;
this.Author = author;
this.Description = description;
@@ -84,13 +87,6 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
this.Errors = errors;
this.Loaded = loaded;
- if (isMod)
- {
- this.IsMod = true;
- this.IsContentPack = !string.IsNullOrWhiteSpace(this.ContentPackFor);
- this.IsCodeMod = !this.IsContentPack;
- }
-
this.OverrideVersion(version);
}