-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPassThroughSerializer.cs
More file actions
58 lines (54 loc) · 2.31 KB
/
PassThroughSerializer.cs
File metadata and controls
58 lines (54 loc) · 2.31 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using System;
using System.Runtime.Serialization;
namespace RapidField.SolidInstruments.Serialization
{
/// <summary>
/// Stands in place of a serializer when the input and output are both unformatted byte arrays.
/// </summary>
public sealed class PassThroughSerializer : DynamicSerializer<Byte[]>
{
/// <summary>
/// Initializes a new instance of the <see cref="PassThroughSerializer" /> class.
/// </summary>
public PassThroughSerializer()
: base(SerializationFormat.Binary)
{
return;
}
/// <summary>
/// Converts the specified bit field to its typed equivalent.
/// </summary>
/// <param name="serializedObject">
/// A serialized object.
/// </param>
/// <param name="format">
/// The format to use for deserialization.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
/// <exception cref="SerializationException">
/// <paramref name="serializedObject" /> is invalid or an error occurred during deserialization.
/// </exception>
protected sealed override Byte[] Deserialize(Byte[] serializedObject, SerializationFormat format) => serializedObject;
/// <summary>
/// Converts the specified object to a bit field.
/// </summary>
/// <param name="target">
/// An object to be serialized.
/// </param>
/// <param name="format">
/// The format to use for serialization.
/// </param>
/// <returns>
/// The serialized bit field.
/// </returns>
/// <exception cref="SerializationException">
/// <paramref name="target" /> is invalid or an error occurred during serialization.
/// </exception>
protected sealed override Byte[] Serialize(Byte[] target, SerializationFormat format) => target;
}
}