speeder needs to fuck off
This commit is contained in:
parent
fac89e4c26
commit
36a3401e14
|
@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue