summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Program.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-06-19 02:12:18 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-06-19 02:12:18 -0400
commit640a523eb4a63aa078db15b63ac6e01c6c15d53c (patch)
tree9ddcbb7ae2b784031fd5318ed48a33c0abbdb356 /src/StardewModdingAPI/Program.cs
parent565aa2c67b2619e478e2e7c1e212926ca1ba2369 (diff)
downloadSMAPI-640a523eb4a63aa078db15b63ac6e01c6c15d53c.tar.gz
SMAPI-640a523eb4a63aa078db15b63ac6e01c6c15d53c.tar.bz2
SMAPI-640a523eb4a63aa078db15b63ac6e01c6c15d53c.zip
when the ObjectInformation.xnb file is broken, print one error instead of a warning flood
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r--src/StardewModdingAPI/Program.cs22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 71f09f5c..da0c5bca 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -355,7 +355,7 @@ namespace StardewModdingAPI
// validate XNB integrity
if (!this.ValidateContentIntegrity())
- this.Monitor.Log("SMAPI found problems in the game's XNB files which may cause errors or crashes while you're playing. Consider uninstalling XNB mods or reinstalling the game.", LogLevel.Warn);
+ this.Monitor.Log("SMAPI found problems in your game's content files which are likely to cause errors or crashes. Consider uninstalling XNB mods or reinstalling the game.", LogLevel.Error);
// load mods
int modsLoaded;
@@ -486,17 +486,18 @@ namespace StardewModdingAPI
this.Monitor.Log("Detecting common issues...");
bool issuesFound = false;
-
- // object format (commonly broken by outdated files)
+ // object format (commonly broken by outdated mods)
{
- void LogIssue(int id, string issue) => this.Monitor.Log($"Detected issue: item #{id} in Content\\Data\\ObjectInformation is invalid ({issue}).", LogLevel.Warn);
+ // detect issues
+ bool hasObjectIssues = false;
+ void LogIssue(int id, string issue) => this.Monitor.Log($@"Detected issue: item #{id} in Content\Data\ObjectInformation.xnb is invalid ({issue}).", LogLevel.Trace);
foreach (KeyValuePair<int, string> entry in Game1.objectInformation)
{
// must not be empty
if (string.IsNullOrWhiteSpace(entry.Value))
{
LogIssue(entry.Key, "entry is empty");
- issuesFound = true;
+ hasObjectIssues = true;
continue;
}
@@ -505,7 +506,7 @@ namespace StardewModdingAPI
if (fields.Length < SObject.objectInfoDescriptionIndex + 1)
{
LogIssue(entry.Key, "too few fields for an object");
- issuesFound = true;
+ hasObjectIssues = true;
continue;
}
@@ -516,11 +517,18 @@ namespace StardewModdingAPI
if (fields.Length < SObject.objectInfoBuffDurationIndex + 1)
{
LogIssue(entry.Key, "too few fields for a cooking item");
- issuesFound = true;
+ hasObjectIssues = true;
}
break;
}
}
+
+ // log error
+ if (hasObjectIssues)
+ {
+ issuesFound = true;
+ this.Monitor.Log(@"Your Content\Data\ObjectInformation.xnb file seems to be broken or outdated.", LogLevel.Warn);
+ }
}
return !issuesFound;