diff --git a/IPA.Loader/Config/Data/List.cs b/IPA.Loader/Config/Data/List.cs index cbf3a4fb..d4f48397 100644 --- a/IPA.Loader/Config/Data/List.cs +++ b/IPA.Loader/Config/Data/List.cs @@ -113,7 +113,7 @@ namespace IPA.Config.Data /// /// a comma-seperated list of the result of wrapped in square brackets public override string ToString() - => $"[{string.Join(",",this.Select(v => v.ToString()).StrJP())}]"; + => $"[{string.Join(",",this.Select(v => v?.ToString() ?? "null").StrJP())}]"; IEnumerator IEnumerable.GetEnumerator() => ((IList)values).GetEnumerator(); } diff --git a/IPA.Loader/Config/Data/Map.cs b/IPA.Loader/Config/Data/Map.cs index 0f7df8a9..4bd7fcb4 100644 --- a/IPA.Loader/Config/Data/Map.cs +++ b/IPA.Loader/Config/Data/Map.cs @@ -109,7 +109,7 @@ namespace IPA.Config.Data /// /// a JSON-like set of key-value pairs public override string ToString() - => $"{{{string.Join(",", this.Select(p => $"\"{p.Key}\":{p.Value.ToString()}").StrJP())}}}"; + => $"{{{string.Join(",", this.Select(p => $"\"{p.Key}\":{p.Value?.ToString() ?? "null"}").StrJP())}}}"; } diff --git a/IPA.Loader/Config/Data/Value.cs b/IPA.Loader/Config/Data/Value.cs index a139dc27..8b397a8e 100644 --- a/IPA.Loader/Config/Data/Value.cs +++ b/IPA.Loader/Config/Data/Value.cs @@ -54,7 +54,7 @@ namespace IPA.Config.Data /// the value to wrap /// a wrapping /// - public static Text Text(string val) => val == null ? new Text { Value = val } : null; + public static Text Text(string val) => val == null ? null : new Text { Value = val }; /// /// Creates a new wrapping a . diff --git a/IPA.Loader/Config/Providers/JsonConfigProvider.cs b/IPA.Loader/Config/Providers/JsonConfigProvider.cs index e30dcbe2..6221071d 100644 --- a/IPA.Loader/Config/Providers/JsonConfigProvider.cs +++ b/IPA.Loader/Config/Providers/JsonConfigProvider.cs @@ -55,10 +55,20 @@ namespace IPA.Config.Providers case JTokenType.Raw: // idk if the parser will normally emit a Raw type, but just to be safe return VisitToValue(JToken.Parse((tok as JRaw).Value as string)); case JTokenType.Undefined: + Logger.config.Warn("Found JTokenType.Undefined"); + goto case JTokenType.Null; case JTokenType.Bytes: // never used by Newtonsoft + Logger.config.Warn("Found JTokenType.Bytes"); + goto case JTokenType.Null; case JTokenType.Comment: // never used by Newtonsoft + Logger.config.Warn("Found JTokenType.Comment"); + goto case JTokenType.Null; case JTokenType.Constructor: // never used by Newtonsoft + Logger.config.Warn("Found JTokenType.Constructor"); + goto case JTokenType.Null; case JTokenType.Property: // never used by Newtonsoft + Logger.config.Warn("Found JTokenType.Property"); + goto case JTokenType.Null; case JTokenType.Null: return Value.Null(); case JTokenType.Boolean: diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 57501262..5e9a7cf1 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -20,7 +20,6 @@ namespace IPA.Config { LoaderConfig = Config.GetConfigFor(IPAName, "json"); Instance = LoaderConfig.Generated(); - GeneratedStore.DebugSaveAssembly("GeneratedAssembly.dll"); } public static void ReadCommandLine(string[] args) diff --git a/IPA.Loader/Config/Stores/GeneratedStore.cs b/IPA.Loader/Config/Stores/GeneratedStore.cs index 7d2549b2..fcc126d3 100644 --- a/IPA.Loader/Config/Stores/GeneratedStore.cs +++ b/IPA.Loader/Config/Stores/GeneratedStore.cs @@ -106,7 +106,7 @@ namespace IPA.Config.Stores internal static MethodInfo FindImplMethod = typeof(Impl).GetMethod(nameof(FindImpl)); public static Impl FindImpl(IGeneratedStore store) { - while (store != null) store = store.Parent; // walk to the top of the tree + while (store?.Parent != null) store = store.Parent; // walk to the top of the tree return store?.Impl; } @@ -176,7 +176,7 @@ namespace IPA.Config.Stores get { if (module == null) - module = Assembly.DefineDynamicModule(Assembly.GetName().Name + ".dll"); + module = Assembly.DefineDynamicModule(Assembly.GetName().Name, Assembly.GetName().Name + ".dll"); return module; } diff --git a/IPA.Loader/Loader/PluginComponent.cs b/IPA.Loader/Loader/PluginComponent.cs index 92bfe8b9..54fab9d4 100644 --- a/IPA.Loader/Loader/PluginComponent.cs +++ b/IPA.Loader/Loader/PluginComponent.cs @@ -78,6 +78,10 @@ namespace IPA.Loader ConfigRuntime.SaveAll(); +#if DEBUG + Config.Stores.GeneratedStore.DebugSaveAssembly("GeneratedAssembly.dll"); +#endif + quitting = true; }