-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathSerializer.cs
36 lines (33 loc) · 1.49 KB
/
Serializer.cs
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
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using OmniSharp.Extensions.DebugAdapter.Protocol.DebugAdapterConverters;
using OmniSharp.Extensions.JsonRpc.Serialization;
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization
{
[Obsolete("DapProtocolSerializer will be removed in a future version, DapSerializer will be a drop in replacement")]
public class DapProtocolSerializer : SerializerBase, ISerializer
{
protected override void AddOrReplaceConverters(ICollection<JsonConverter> converters)
{
ReplaceConverter(converters, new NumberStringConverter());
ReplaceConverter(converters, new DapClientNotificationConverter(this));
ReplaceConverter(converters, new DapClientResponseConverter(this));
ReplaceConverter(converters, new DapClientRequestConverter());
ReplaceConverter(converters, new DapRpcErrorConverter(this));
ReplaceConverter(converters, new ProgressTokenConverter());
}
protected override JsonSerializer CreateSerializer()
{
var serializer = base.CreateSerializer();
serializer.ContractResolver = new DapContractResolver();
return serializer;
}
protected override JsonSerializerSettings CreateSerializerSettings()
{
var settings = base.CreateSerializerSettings();
settings.ContractResolver = new DapContractResolver();
return settings;
}
}
}