mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Misc
This commit is contained in:
@@ -494,15 +494,25 @@ namespace ArchiSteamFarm {
|
||||
while (true) {
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
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)>();
|
||||
foreach (Steam.InventoryResponse.Description description in response.Descriptions.Where(description => description != null)) {
|
||||
if (description.ClassID == 0) {
|
||||
|
||||
@@ -370,6 +370,12 @@ namespace ArchiSteamFarm.JSON {
|
||||
[JsonProperty(PropertyName = "descriptions", Required = Required.DisallowNull)]
|
||||
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 bool MoreItems { get; private set; }
|
||||
internal bool Success { get; private set; }
|
||||
|
||||
@@ -143,8 +143,6 @@ namespace ArchiSteamFarm {
|
||||
return default;
|
||||
}
|
||||
|
||||
ArchiLogger.LogGenericDebug("JSON: <" + json + ">");
|
||||
|
||||
try {
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
} catch (JsonException e) {
|
||||
|
||||
Reference in New Issue
Block a user