2022-01-26 11:32:16 -05:00
|
|
|
|
using System;
|
|
|
|
|
using Newtonsoft.Json;
|
2020-01-11 21:32:27 -05:00
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore.Helpers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// JSON converter for the build number
|
2020-01-11 21:32:27 -05:00
|
|
|
|
/// </summary>
|
|
|
|
|
public class BuildNumberJsonConverter : JsonConverter
|
|
|
|
|
{
|
|
|
|
|
public override bool CanConvert(Type objectType)
|
|
|
|
|
{
|
|
|
|
|
return objectType == typeof(string);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 11:32:16 -05:00
|
|
|
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
|
|
|
|
|
JsonSerializer serializer)
|
2020-01-11 21:32:27 -05:00
|
|
|
|
{
|
|
|
|
|
return BuildNumber.Parse(reader.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
|
|
|
|
{
|
|
|
|
|
writer.WriteValue(value.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-26 11:32:16 -05:00
|
|
|
|
}
|