Skip to content

Commit

Permalink
refactor!: fix namespaces, mark LamdaActivator internal but expose ct…
Browse files Browse the repository at this point in the history
…or getters
  • Loading branch information
kamranayub committed Jun 13, 2024
1 parent 55ad31e commit 180068d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions IGDB/IGDBApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions IGDB/Serialization/IdentityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Newtonsoft.Json;
using static IGDB.Serialization.LambdaActivator;

namespace IGDB
namespace IGDB.Serialization
{
public class IdentityConverter : JsonConverter
{
Expand Down Expand Up @@ -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))
{
Expand All @@ -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))
{
Expand All @@ -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))
{
Expand Down
6 changes: 3 additions & 3 deletions IGDB/Serialization/LamdaActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace IGDB.Serialization
{
public delegate object ObjectActivator(params object[] args);

/// <summary>
/// See: https://rogerjohansson.blog/2008/02/28/linq-expressions-creating-objects/
/// </summary>
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();
Expand Down
2 changes: 1 addition & 1 deletion IGDB/Serialization/UnixTimestampConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace IGDB
namespace IGDB.Serialization
{
public class UnixTimestampConverter : JsonConverter
{
Expand Down

0 comments on commit 180068d

Please sign in to comment.