From 180068d4333f14b86ad502f4325af6d8cd3cefca Mon Sep 17 00:00:00 2001 From: Kamran Ayub Date: Thu, 13 Jun 2024 07:47:29 -0500 Subject: [PATCH] refactor!: fix namespaces, mark LamdaActivator internal but expose ctor getters --- IGDB/IGDBApi.cs | 1 + IGDB/Serialization/IdentityConverter.cs | 8 ++++---- IGDB/Serialization/LamdaActivator.cs | 6 +++--- IGDB/Serialization/UnixTimestampConverter.cs | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/IGDB/IGDBApi.cs b/IGDB/IGDBApi.cs index ed84fb0..ba514e3 100644 --- a/IGDB/IGDBApi.cs +++ b/IGDB/IGDBApi.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading.Tasks; using IGDB.Models; +using IGDB.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestEase; diff --git a/IGDB/Serialization/IdentityConverter.cs b/IGDB/Serialization/IdentityConverter.cs index 52a8ce9..6d6166e 100644 --- a/IGDB/Serialization/IdentityConverter.cs +++ b/IGDB/Serialization/IdentityConverter.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json; using static IGDB.Serialization.LambdaActivator; -namespace IGDB +namespace IGDB.Serialization { public class IdentityConverter : JsonConverter { @@ -137,7 +137,7 @@ private static ObjectActivator GetIdentitiesActivator(Type objectType) return activator; } - private static ObjectActivator GetValuesActivator(Type objectType) + public static ObjectActivator GetValuesActivator(Type objectType) { if (valuesActivators.ContainsKey(objectType)) { @@ -150,7 +150,7 @@ private static ObjectActivator GetValuesActivator(Type objectType) return activator; } - private static ObjectActivator GetIdentityActivator(Type objectType) + public static ObjectActivator GetIdentityActivator(Type objectType) { if (identityActivators.ContainsKey(objectType)) { @@ -163,7 +163,7 @@ private static ObjectActivator GetIdentityActivator(Type objectType) return activator; } - private static ObjectActivator GetValueActivator(Type objectType) + public static ObjectActivator GetValueActivator(Type objectType) { if (valueActivators.ContainsKey(objectType)) { diff --git a/IGDB/Serialization/LamdaActivator.cs b/IGDB/Serialization/LamdaActivator.cs index a4ecf96..fc5f9fe 100644 --- a/IGDB/Serialization/LamdaActivator.cs +++ b/IGDB/Serialization/LamdaActivator.cs @@ -4,13 +4,13 @@ namespace IGDB.Serialization { + public delegate object ObjectActivator(params object[] args); + /// /// See: https://rogerjohansson.blog/2008/02/28/linq-expressions-creating-objects/ /// - public static class LambdaActivator + internal static class LambdaActivator { - public delegate object ObjectActivator(params object[] args); - public static ObjectActivator GetActivator(ConstructorInfo ctor) { ParameterInfo[] paramsInfo = ctor.GetParameters(); diff --git a/IGDB/Serialization/UnixTimestampConverter.cs b/IGDB/Serialization/UnixTimestampConverter.cs index 3e3561f..37dabb0 100644 --- a/IGDB/Serialization/UnixTimestampConverter.cs +++ b/IGDB/Serialization/UnixTimestampConverter.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; -namespace IGDB +namespace IGDB.Serialization { public class UnixTimestampConverter : JsonConverter {