tgstation-server 6.12.3
The /tg/station 13 server suite
Loading...
Searching...
No Matches
SemverSerializer.cs
Go to the documentation of this file.
1using System;
2
3using StrawberryShake.Serialization;
4
6
7#pragma warning disable CA1812 // not detecting usage via annotation in schema.extensions.graphql
8
10{
14 sealed class SemverSerializer : ScalarSerializer<string, Version>
15 {
20 : base("Semver")
21 {
22 }
23
25 public override Version Parse(string serializedValue)
26 => Version.Parse(serializedValue ?? throw new ArgumentNullException(nameof(serializedValue)));
27
29 protected override string Format(Version runtimeValue)
30 {
31 ArgumentNullException.ThrowIfNull(runtimeValue);
32 return runtimeValue.Semver().ToString();
33 }
34 }
35}
ScalarSerializer<TSerialized, TRuntime> for Versions.
SemverSerializer()
Initializes a new instance of the SemverSerializer class.
override Version Parse(string serializedValue)