1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

made json converter collection code a bit cleaner

This commit is contained in:
Ellpeck 2020-02-27 19:43:36 +01:00
parent d0370e583e
commit 2744f7d806

View file

@ -6,8 +6,8 @@ using Newtonsoft.Json;
namespace MLEM.Data.Json { namespace MLEM.Data.Json {
public class JsonConverters { public class JsonConverters {
public static readonly JsonConverter[] Converters = Assembly.GetExecutingAssembly().GetExportedTypes() public static readonly JsonConverter[] Converters = typeof(JsonConverters).Assembly.GetExportedTypes()
.Where(t => t.Namespace == typeof(JsonConverters).Namespace && t.IsSubclassOf(typeof(JsonConverter))) .Where(t => t.IsSubclassOf(typeof(JsonConverter)))
.Select(t => t.GetConstructor(Type.EmptyTypes).Invoke(null)).Cast<JsonConverter>().ToArray(); .Select(t => t.GetConstructor(Type.EmptyTypes).Invoke(null)).Cast<JsonConverter>().ToArray();
public static JsonSerializer AddAll(JsonSerializer serializer) { public static JsonSerializer AddAll(JsonSerializer serializer) {