Skip to content

Commit

Permalink
- fix price tag
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-shishkov committed Jul 4, 2024
1 parent 9d18704 commit 6ae0329
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions SteamInventoryServiceTool/Data/Steam/Fields/PriceCategory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Linq;

namespace SteamInventoryServiceTool.Data.Steam.Fields;

Expand Down Expand Up @@ -77,8 +78,15 @@ public class PriceCategoryJsonConverter : JsonConverter<PriceCategory>
var jsonString = reader.Value as string;
if (jsonString == null)
return new PriceCategory(PriceCategories.None);
else
return new PriceCategory((PriceCategories)Enum.Parse(typeof(PriceCategories), jsonString));

var split = jsonString.Split(';');
if (split.Length > 0)
{
var price = split.LastOrDefault(x => x.Contains("VLV"));
if(price != null)
return new PriceCategory((PriceCategories)Enum.Parse(typeof(PriceCategories), price));
}
return new PriceCategory(PriceCategories.None);
}

public override void WriteJson(JsonWriter writer, PriceCategory? value, JsonSerializer serializer)
Expand All @@ -89,10 +97,10 @@ public override void WriteJson(JsonWriter writer, PriceCategory? value, JsonSeri
return;
}
var enumValue = value.Category;
if(enumValue == PriceCategories.None)
if (enumValue == PriceCategories.None)
writer.WriteNull();
else
writer.WriteValue(enumValue.ToString());
writer.WriteValue($"1;{enumValue.ToString()}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion SteamInventoryServiceTool/Data/Steam/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Item
// TODO: exchange
// TODO: price

[JsonProperty("price_category")]
[JsonProperty("price")]
public PriceCategory PriceCategory { get; set; } = new PriceCategory(PriceCategories.None);

[JsonProperty("background_color")]
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.6</AssemblyVersion>
<Version>0.1.0.6</Version>
<AssemblyVersion>0.1.0.7</AssemblyVersion>
<Version>0.1.0.7</Version>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Expand Down

0 comments on commit 6ae0329

Please sign in to comment.