feat: Initialize URLNotesGrabberCORE project with core application structure, data access, and configuration.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace URLNotesGrabberCORE
|
||||
{
|
||||
public class EmptyArrayOrObjectConverter<T> : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(T);
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
JToken token = JToken.Load(reader);
|
||||
if (token.Type == JTokenType.Array)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return token.ToObject<T>(serializer);
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
serializer.Serialize(writer, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user