summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/ModMetadata.cs4
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs6
-rw-r--r--src/StardewModdingAPI/Program.cs8
3 files changed, 6 insertions, 12 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModMetadata.cs b/src/StardewModdingAPI/Framework/ModLoading/ModMetadata.cs
index 7be85a83..5ec2d4e0 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/ModMetadata.cs
@@ -21,10 +21,10 @@ namespace StardewModdingAPI.Framework.ModLoading
public ModCompatibility Compatibility { get; }
/// <summary>The metadata resolution status.</summary>
- public ModMetadataStatus Status { get; set; }
+ public ModMetadataStatus Status { get; private set; }
/// <summary>The reason the metadata is invalid, if any.</summary>
- public string Error { get; set; }
+ public string Error { get; private set; }
/*********
diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
index 829575af..9b26e8b0 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
@@ -188,8 +188,7 @@ namespace StardewModdingAPI.Framework.ModLoading
}
if (missingMods != null)
{
- mod.Status = ModMetadataStatus.Failed;
- mod.Error = $"it requires mods which aren't installed ({missingMods.Substring(0, missingMods.Length - 2)}).";
+ mod.SetStatus(ModMetadataStatus.Failed, $"it requires mods which aren't installed ({missingMods.Substring(0, missingMods.Length - 2)}).");
return false;
}
}
@@ -207,8 +206,7 @@ namespace StardewModdingAPI.Framework.ModLoading
ModMetadata circularReferenceMod = currentChain.FirstOrDefault(modsToLoadFirst.Contains);
if (circularReferenceMod != null)
{
- mod.Status = ModMetadataStatus.Failed;
- mod.Error = $"its dependencies have a circular reference: {string.Join(" => ", currentChain.Select(p => p.DisplayName))} => {circularReferenceMod.DisplayName}).";
+ mod.SetStatus(ModMetadataStatus.Failed, $"its dependencies have a circular reference: {string.Join(" => ", currentChain.Select(p => p.DisplayName))} => {circularReferenceMod.DisplayName}).");
return false;
}
currentChain.Add(mod);
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 74a9ff8e..37e1e000 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -337,15 +337,11 @@ namespace StardewModdingAPI
string psDir = Path.Combine(mod.DirectoryPath, "psconfigs");
Directory.CreateDirectory(psDir);
if (!Directory.Exists(psDir))
- {
- mod.Status = ModMetadataStatus.Failed;
- mod.Error = "it requires per-save configuration files ('psconfigs') which couldn't be created for some reason.";
- }
+ mod.SetStatus(ModMetadataStatus.Failed, "it requires per-save configuration files ('psconfigs') which couldn't be created for some reason.");
}
catch (Exception ex)
{
- mod.Status = ModMetadataStatus.Failed;
- mod.Error = $"it requires per-save configuration files ('psconfigs') which couldn't be created: {ex.GetLogSummary()}";
+ mod.SetStatus(ModMetadataStatus.Failed, $"it requires per-save configuration files ('psconfigs') which couldn't be created: {ex.GetLogSummary()}");
}
}
}