Im going bonkers

This commit is contained in:
Ben C 2022-05-22 12:27:27 -04:00
parent 09762a0f53
commit 821c3bf919
3 changed files with 25 additions and 15 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,14 @@ using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons namespace NewHorizons
{ {
// TODO: Test class, delete later
[JsonObject]
public class Test
{
[JsonProperty]
public string Name;
}
public class Main : ModBehaviour public class Main : ModBehaviour
{ {
public static AssetBundle NHAssetBundle { get; private set; } public static AssetBundle NHAssetBundle { get; private set; }
@ -114,16 +122,25 @@ namespace NewHorizons
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage()); TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
} }
// TODO: Test class, delete later #region Assembly Stuff
[JsonObject]
public class Test public static Assembly ResolveAssembly(object sender, ResolveEventArgs e)
{ {
[JsonProperty] Logger.LogError($"Couldn't resolve assembly: {e.Name} from {e.RequestingAssembly.FullName}... Trying to fix it.");
public string Name; if (e.Name.Contains("Namotion.Reflection"))
return Assembly.LoadFrom("Namotion.Reflection.dll");
else if (e.Name.Contains("Microsoft.CSharp"))
return Assembly.LoadFrom("Microsoft.CSharp.dll");
else
return null;
} }
#endregion
public void Start() public void Start()
{ {
AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
// Patches // Patches
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
@ -142,15 +159,8 @@ namespace NewHorizons
Logger.Log("Begin load of config files...", Logger.LogType.Log); Logger.Log("Begin load of config files...", Logger.LogType.Log);
try
{
_bodySchema = JsonSchema.FromType<Test>(); _bodySchema = JsonSchema.FromType<Test>();
} Logger.LogWarning(_bodySchema.ToString());
catch (TypeLoadException te)
{
Logger.LogError(te.ToString());
Application.Quit();
}
try try