Multi-Platform Package Manager for Stable Diffusion
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.

21 lines
595 B

using System.Text.Json;
using System.Text.Json.Serialization;
using Semver;
namespace StabilityMatrix.Core.Converters.Json;
public class SemVersionJsonConverter : JsonConverter<SemVersion>
{
public override SemVersion Read(
ref Utf8JsonReader reader,
Type typeToConvert,
JsonSerializerOptions options) =>
SemVersion.Parse(reader.GetString()!, SemVersionStyles.Strict);
public override void Write(
Utf8JsonWriter writer,
SemVersion value,
JsonSerializerOptions options) =>
writer.WriteStringValue(value.ToString());
}