From fc0f846c7d3e1bd0d279cd88980a643e1cae0cf0 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Tue, 20 Feb 2024 15:35:39 -0500 Subject: [PATCH] Cleanup --- CS2Interface/Data/GameDataItems.cs | 2 +- CS2Interface/Data/GameDataText.cs | 4 ++-- CS2Interface/Data/InventoryItem.cs | 4 ---- CS2Interface/Helpers/UtilExtensions.cs | 11 ----------- 4 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 CS2Interface/Helpers/UtilExtensions.cs diff --git a/CS2Interface/Data/GameDataItems.cs b/CS2Interface/Data/GameDataItems.cs index fe71f4b..a8f5211 100644 --- a/CS2Interface/Data/GameDataItems.cs +++ b/CS2Interface/Data/GameDataItems.cs @@ -31,7 +31,7 @@ internal List? this[string? key] { return null; } - return Data.Search(key); + return Data.Children.Where(x => x.Name == key).SelectMany(x => x.Children).ToList(); } } diff --git a/CS2Interface/Data/GameDataText.cs b/CS2Interface/Data/GameDataText.cs index 280766f..256d002 100644 --- a/CS2Interface/Data/GameDataText.cs +++ b/CS2Interface/Data/GameDataText.cs @@ -12,14 +12,14 @@ internal class GameDataText : GameDataResource { internal GameDataText(string url) : base(url) {} internal async Task Update() { - List? data = (await FetchKVResource().ConfigureAwait(false))?.Search("Tokens"); + KeyValue? data = await FetchKVResource().ConfigureAwait(false); if (data == null) { ASF.ArchiLogger.LogGenericError(String.Format("Couldn't load game data from: {0}", Url)); return false; } - Data = data; + Data = data.Children.Where(x => x.Name == "Tokens").SelectMany(x => x.Children).ToList(); Updated = true; return true; diff --git a/CS2Interface/Data/InventoryItem.cs b/CS2Interface/Data/InventoryItem.cs index da33283..9cd624e 100644 --- a/CS2Interface/Data/InventoryItem.cs +++ b/CS2Interface/Data/InventoryItem.cs @@ -143,10 +143,6 @@ private bool ParseAttributes(List? attributes) { return false; } - if (attribute_def["attribute_type"].Value == "vector") { - ASF.ArchiLogger.LogGenericError(String.Format("zzzz vector for: {0}", attribute_name)); - } - switch (attribute_def["attribute_type"].Value) { case "uint32": case null when attribute_def["stored_as_integer"].Value == "1": diff --git a/CS2Interface/Helpers/UtilExtensions.cs b/CS2Interface/Helpers/UtilExtensions.cs deleted file mode 100644 index a5214df..0000000 --- a/CS2Interface/Helpers/UtilExtensions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using SteamKit2; - -namespace CS2Interface { - public static class UtilExtensions { - public static List Search(this KeyValue obj, string value) { - return obj.Children.Where(x => x.Name == value).SelectMany(x => x.Children).ToList(); - } - } -} \ No newline at end of file