private static TypeParser GetParser(MelonPreferences_Entry.TypeEnum type) { TypeParser parser = null; if (type == MelonPreferences_Entry.TypeEnum.UNKNOWN) { return(parser); } lock (TypeParserDict_TypeEnum) { if (TypeParserDict_TypeEnum.TryGetValue(type, out TypeParser nparser)) { parser = nparser; } else { var args = new TypeParser.ResolveEventArgs { TypeEnum = type }; ResolveEvents?.Invoke(null, args); //if (args.TypeParser == null) // throw new NullReferenceException("No Parser for Type " + MelonPreferences.TypeEnumToTypeName(type)); if ((args.TypeParser != null) && (args.TypeParser.GetTypeEnum() == type)) { parser = TypeParserDict_TypeEnum[type] = args.TypeParser; } } } return(parser); }
internal static string TypeEnumToTypeName(MelonPreferences_Entry.TypeEnum type) { TypeParser parser = GetParser(type); if (parser == null) { return(null); } return(parser.GetTypeName()); }
internal static Type TypeEnumToReflectedType(MelonPreferences_Entry.TypeEnum type) { TypeParser parser = GetParser(type); if (parser == null) { return(null); } return(parser.GetReflectedType()); }