// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Text.Json; using System.Text.Json.Serialization; #pragma warning disable CA1027 #pragma warning disable CA1069 namespace EpicGames.Horde { /// /// Version number for the Horde public API. Can be retrieved from the /api/v1/server/info endpoint via the /// response. Should be serialized as an integer in messages to allow /// clients with missing enum names to still parse the result correctly. /// public enum HordeApiVersion { /// /// Unknown version /// Unknown = 0, /// /// Initial version /// Initial = 1, /// /// Interior nodes in chunked data now include the length of chunked data to allow seeking. /// AddLengthsToInteriorNodes = 2, /// /// Add support for last modified timestamps to file entries in directory nodes /// AddFileModTimes = 3, /// /// Interior nodes in chunked data now include the rolling hash of any leaf nodes /// AddRollingHashesForLeafNodes = 4, /// /// One past the latest known version number. Add new version numbers above this point. /// LatestPlusOne, /// /// Latest API version /// Latest = (int)(LatestPlusOne - 1), } /// /// Converter for which forces serialization as an integer, to override any /// default that may be enabled. /// public class HordeApiVersionConverter : JsonConverter { /// public override HordeApiVersion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return (HordeApiVersion)reader.GetInt32(); } /// public override void Write(Utf8JsonWriter writer, HordeApiVersion value, JsonSerializerOptions options) { writer.WriteNumberValue((int)value); } } }