Skip to content

Commit

Permalink
- update hex serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-shishkov committed Jul 3, 2024
1 parent e6b925f commit 9d18704
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion SteamInventoryServiceTool/Data/Steam/Fields/HexColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class HexColorJsonConverter : JsonConverter<HexColor>
{
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);
}
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions SteamInventoryServiceTool/SteamInventoryServiceTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\AppLogo_Small.ico</ApplicationIcon>
<AssemblyVersion>0.1.0.5</AssemblyVersion>
<Version>0.1.0.5</Version>
<AssemblyVersion>0.1.0.6</AssemblyVersion>
<Version>0.1.0.6</Version>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Expand Down

0 comments on commit 9d18704

Please sign in to comment.