You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
764 B

  1. using IPA.Utilities;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace IPA.JsonConverters
  9. {
  10. internal class AlmostVersionConverter : JsonConverter<AlmostVersion>
  11. {
  12. public override AlmostVersion ReadJson(JsonReader reader, Type objectType, AlmostVersion existingValue, bool hasExistingValue, JsonSerializer serializer) =>
  13. reader.Value == null ? null : new AlmostVersion(reader.Value as string);
  14. public override void WriteJson(JsonWriter writer, AlmostVersion value, JsonSerializer serializer)
  15. {
  16. if (value == null) writer.WriteNull();
  17. else writer.WriteValue(value.ToString());
  18. }
  19. }
  20. }