Browse Source

Fixed more things

4.0.0-beta
Anairkoen Schno 4 years ago
parent
commit
91e021eada
7 changed files with 19 additions and 6 deletions
  1. +1
    -1
      IPA.Loader/Config/Data/List.cs
  2. +1
    -1
      IPA.Loader/Config/Data/Map.cs
  3. +1
    -1
      IPA.Loader/Config/Data/Value.cs
  4. +10
    -0
      IPA.Loader/Config/Providers/JsonConfigProvider.cs
  5. +0
    -1
      IPA.Loader/Config/SelfConfig.cs
  6. +2
    -2
      IPA.Loader/Config/Stores/GeneratedStore.cs
  7. +4
    -0
      IPA.Loader/Loader/PluginComponent.cs

+ 1
- 1
IPA.Loader/Config/Data/List.cs View File

@ -113,7 +113,7 @@ namespace IPA.Config.Data
/// </summary>
/// <returns>a comma-seperated list of the result of <see cref="Value.ToString"/> wrapped in square brackets</returns>
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<Value>)values).GetEnumerator();
}


+ 1
- 1
IPA.Loader/Config/Data/Map.cs View File

@ -109,7 +109,7 @@ namespace IPA.Config.Data
/// </summary>
/// <returns>a JSON-like set of key-value pairs</returns>
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())}}}";
}


+ 1
- 1
IPA.Loader/Config/Data/Value.cs View File

@ -54,7 +54,7 @@ namespace IPA.Config.Data
/// <param name="val">the value to wrap</param>
/// <returns>a <see cref="Data.Text"/> wrapping <paramref name="val"/></returns>
/// <seealso cref="From(string)"/>
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 };
/// <summary>
/// Creates a new <see cref="Value"/> wrapping a <see cref="long"/>.


+ 10
- 0
IPA.Loader/Config/Providers/JsonConfigProvider.cs View File

@ -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:


+ 0
- 1
IPA.Loader/Config/SelfConfig.cs View File

@ -20,7 +20,6 @@ namespace IPA.Config
{
LoaderConfig = Config.GetConfigFor(IPAName, "json");
Instance = LoaderConfig.Generated<SelfConfig>();
GeneratedStore.DebugSaveAssembly("GeneratedAssembly.dll");
}
public static void ReadCommandLine(string[] args)


+ 2
- 2
IPA.Loader/Config/Stores/GeneratedStore.cs View File

@ -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;
}


+ 4
- 0
IPA.Loader/Loader/PluginComponent.cs View File

@ -78,6 +78,10 @@ namespace IPA.Loader
ConfigRuntime.SaveAll();
#if DEBUG
Config.Stores.GeneratedStore.DebugSaveAssembly("GeneratedAssembly.dll");
#endif
quitting = true;
}


Loading…
Cancel
Save