From 9d187047e2167479e1175692eb46831cdf884c97 Mon Sep 17 00:00:00 2001 From: Piotr Shishkov Date: Wed, 3 Jul 2024 11:31:05 +0300 Subject: [PATCH] - update hex serialization --- SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs | 4 +++- SteamInventoryServiceTool/SteamInventoryServiceTool.csproj | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs b/SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs index b24e00d..e486304 100644 --- a/SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs +++ b/SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs @@ -30,6 +30,8 @@ public class HexColorJsonConverter : JsonConverter { return new HexColor(0, 255, 255, 255); } + if(!jsonString.StartsWith('#')) + jsonString = $"#{jsonString}"; var color = (Color)ColorConverter.ConvertFromString(jsonString); return new HexColor(color.A, color.R, color.G, color.B); } @@ -42,7 +44,7 @@ public override void WriteJson(JsonWriter writer, HexColor? value, JsonSerialize return; } var color = value.Color; - var hexString = $"#{color.R:X2}{color.G:X2}{color.B:X2}"; + var hexString = $"{color.R:X2}{color.G:X2}{color.B:X2}"; if (color.A == 0) hexString = ""; writer.WriteValue(hexString); diff --git a/SteamInventoryServiceTool/SteamInventoryServiceTool.csproj b/SteamInventoryServiceTool/SteamInventoryServiceTool.csproj index 189a5f3..4df1380 100644 --- a/SteamInventoryServiceTool/SteamInventoryServiceTool.csproj +++ b/SteamInventoryServiceTool/SteamInventoryServiceTool.csproj @@ -6,8 +6,8 @@ enable true Resources\AppLogo_Small.ico - 0.1.0.5 - 0.1.0.5 + 0.1.0.6 + 0.1.0.6 true false win-x64