summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoryn Aaron <zoryn4163@gmail.com>2016-03-27 07:13:16 -0400
committerZoryn Aaron <zoryn4163@gmail.com>2016-03-27 07:13:34 -0400
commit36a3401e14ce911e1c2a7855d2d4d9a709fbf526 (patch)
tree3ad2068fc419338432c128e8e56a4ffdc5e2a767
parentfac89e4c26d4fcdb840c47c2b0d2192baf898d50 (diff)
downloadSMAPI-36a3401e14ce911e1c2a7855d2d4d9a709fbf526.tar.gz
SMAPI-36a3401e14ce911e1c2a7855d2d4d9a709fbf526.tar.bz2
SMAPI-36a3401e14ce911e1c2a7855d2d4d9a709fbf526.zip
speeder needs to fuck off
-rw-r--r--StardewModdingAPI/Manifest.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/StardewModdingAPI/Manifest.cs b/StardewModdingAPI/Manifest.cs
index 162ab399..e2526cf3 100644
--- a/StardewModdingAPI/Manifest.cs
+++ b/StardewModdingAPI/Manifest.cs
@@ -1,4 +1,8 @@
using System;
+using System.IO;
+using System.Linq;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace StardewModdingAPI
{
@@ -50,5 +54,36 @@ namespace StardewModdingAPI
EntryDll = "";
return this as T;
}
+
+ public override T LoadConfig<T>()
+ {
+ if (File.Exists(ConfigLocation))
+ {
+ try
+ {
+ Manifest m = JsonConvert.DeserializeObject<Manifest>(File.ReadAllText(ConfigLocation));
+ }
+ catch
+ {
+ //Invalid json blob. Try to remove version?
+ try
+ {
+ JObject j = JObject.Parse(File.ReadAllText(ConfigLocation));
+ if (!j.GetValue("Version").Contains("{"))
+ {
+ Log.AsyncC("INVALID JSON VERSION. TRYING TO REMOVE SO A NEW CAN BE AUTO-GENERATED");
+ j.Remove("Version");
+ File.WriteAllText(ConfigLocation, j.ToString());
+ }
+ }
+ catch
+ {
+ //Idgaf speeder can go fuck himself
+ }
+ }
+ }
+
+ return base.LoadConfig<T>();
+ }
}
} \ No newline at end of file