File size: 1,057 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Text.Json.Nodes;
using System.Text.Json;
using VersOne.Epub.Test.Integration.CustomSerialization.TypeSerializers;

namespace VersOne.Epub.Test.Integration.CustomSerialization.Context
{
    internal class CustomPropertySerializationContext
    {
        private readonly CustomPropertySerializer customPropertySerializer;
        private readonly TestEpubFile testEpubFile;

        public CustomPropertySerializationContext(CustomPropertySerializer customPropertySerializer, TestEpubFile testEpubFile)
        {
            this.customPropertySerializer = customPropertySerializer;
            this.testEpubFile = testEpubFile;
        }

        public JsonNode? SerializePropertyValue(object serializingObject)
        {
            return customPropertySerializer.SerializePropertyValue(serializingObject, testEpubFile);
        }

        public object? DeserializePropertyValue(JsonElement serializedValue)
        {
            return customPropertySerializer.DeserializePropertyValue(serializedValue, testEpubFile);
        }
    }
}