mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Misc
This commit is contained in:
@@ -494,15 +494,25 @@ namespace ArchiSteamFarm {
|
|||||||
while (true) {
|
while (true) {
|
||||||
Steam.InventoryResponse response = await WebBrowser.UrlGetToJsonResultRetry<Steam.InventoryResponse>(request + (startAssetID > 0 ? "&start_assetid=" + startAssetID : "")).ConfigureAwait(false);
|
Steam.InventoryResponse response = await WebBrowser.UrlGetToJsonResultRetry<Steam.InventoryResponse>(request + (startAssetID > 0 ? "&start_assetid=" + startAssetID : "")).ConfigureAwait(false);
|
||||||
|
|
||||||
if (response?.Success != true) {
|
if (response == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((response.Assets == null) || (response.Assets.Count == 0) || (response.Descriptions == null) || (response.Descriptions.Count == 0)) {
|
if (!response.Success) {
|
||||||
|
Bot.ArchiLogger.LogGenericWarning(!string.IsNullOrEmpty(response.Error) ? string.Format(Strings.WarningFailedWithError, response.Error) : Strings.WarningFailed);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.TotalInventoryCount == 0) {
|
||||||
// Empty inventory
|
// Empty inventory
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((response.Assets == null) || (response.Assets.Count == 0) || (response.Descriptions == null) || (response.Descriptions.Count == 0)) {
|
||||||
|
Bot.ArchiLogger.LogNullError(nameof(response.Assets) + " || " + nameof(response.Descriptions));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<ulong, (uint AppID, Steam.Asset.EType Type, bool Tradable)> descriptionMap = new Dictionary<ulong, (uint AppID, Steam.Asset.EType Type, bool Tradable)>();
|
Dictionary<ulong, (uint AppID, Steam.Asset.EType Type, bool Tradable)> descriptionMap = new Dictionary<ulong, (uint AppID, Steam.Asset.EType Type, bool Tradable)>();
|
||||||
foreach (Steam.InventoryResponse.Description description in response.Descriptions.Where(description => description != null)) {
|
foreach (Steam.InventoryResponse.Description description in response.Descriptions.Where(description => description != null)) {
|
||||||
if (description.ClassID == 0) {
|
if (description.ClassID == 0) {
|
||||||
|
|||||||
@@ -370,6 +370,12 @@ namespace ArchiSteamFarm.JSON {
|
|||||||
[JsonProperty(PropertyName = "descriptions", Required = Required.DisallowNull)]
|
[JsonProperty(PropertyName = "descriptions", Required = Required.DisallowNull)]
|
||||||
internal readonly HashSet<Description> Descriptions;
|
internal readonly HashSet<Description> Descriptions;
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "error", Required = Required.DisallowNull)]
|
||||||
|
internal readonly string Error;
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "total_inventory_count", Required = Required.Always)]
|
||||||
|
internal readonly uint TotalInventoryCount;
|
||||||
|
|
||||||
internal ulong LastAssetID { get; private set; }
|
internal ulong LastAssetID { get; private set; }
|
||||||
internal bool MoreItems { get; private set; }
|
internal bool MoreItems { get; private set; }
|
||||||
internal bool Success { get; private set; }
|
internal bool Success { get; private set; }
|
||||||
|
|||||||
@@ -143,8 +143,6 @@ namespace ArchiSteamFarm {
|
|||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiLogger.LogGenericDebug("JSON: <" + json + ">");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return JsonConvert.DeserializeObject<T>(json);
|
return JsonConvert.DeserializeObject<T>(json);
|
||||||
} catch (JsonException e) {
|
} catch (JsonException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user