From 3b8315073bee4ea7954eb7989cd0b14fe08437ca Mon Sep 17 00:00:00 2001 From: JustArchi Date: Thu, 30 Jun 2016 09:33:22 +0200 Subject: [PATCH] Fix regressions --- ArchiSteamFarm/ArchiWebHandler.cs | 4 ++-- ArchiSteamFarm/JSON/Steam.cs | 31 +++++++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 020351348..5560067c8 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -606,7 +606,7 @@ namespace ArchiSteamFarm { type = description.Item2; } - Steam.Item steamItem = new Steam.Item(appID, contextID, amount, realAppID, type); + Steam.Item steamItem = new Steam.Item(appID, contextID, classID, amount, realAppID, type); tradeOffer.ItemsToGive.Add(steamItem); } @@ -644,7 +644,7 @@ namespace ArchiSteamFarm { type = description.Item2; } - Steam.Item steamItem = new Steam.Item(appID, contextID, amount, realAppID, type); + Steam.Item steamItem = new Steam.Item(appID, contextID, classID, amount, realAppID, type); tradeOffer.ItemsToReceive.Add(steamItem); } diff --git a/ArchiSteamFarm/JSON/Steam.cs b/ArchiSteamFarm/JSON/Steam.cs index 53e8ccebe..618e9108c 100644 --- a/ArchiSteamFarm/JSON/Steam.cs +++ b/ArchiSteamFarm/JSON/Steam.cs @@ -176,18 +176,30 @@ namespace ArchiSteamFarm.JSON { internal uint RealAppID { get; set; } internal EType Type { get; set; } - internal Item(uint appID, ulong contextID, ulong assetID, uint amount) { - if ((appID == 0) || (contextID == 0) || (assetID == 0) || (amount == 0)) { - throw new ArgumentNullException(nameof(appID) + " || " + nameof(contextID) + " || " + nameof(assetID) + " || " + nameof(amount)); + // This constructor is used for constructing items in trades being sent + internal Item(uint appID, ulong contextID, ulong assetID, uint amount) : this(appID, contextID, amount) { + if (assetID == 0) { + throw new ArgumentNullException(nameof(assetID)); } - AppID = appID; - ContextID = contextID; AssetID = assetID; - Amount = amount; } - internal Item(uint appID, ulong contextID, uint amount, uint realAppID, EType type) { + // This constructor is used for constructing items in trades being received + internal Item(uint appID, ulong contextID, ulong classID, uint amount, uint realAppID, EType type) : this(appID, contextID, amount) { + if (classID == 0) { + throw new ArgumentNullException(nameof(classID)); + } + + ClassID = classID; + RealAppID = realAppID; + Type = type; + } + + [SuppressMessage("ReSharper", "UnusedMember.Local")] + private Item() { } + + private Item(uint appID, ulong contextID, uint amount) { if ((appID == 0) || (contextID == 0) || (amount == 0)) { throw new ArgumentNullException(nameof(appID) + " || " + nameof(contextID) + " || " + nameof(amount)); } @@ -195,12 +207,7 @@ namespace ArchiSteamFarm.JSON { AppID = appID; ContextID = contextID; Amount = amount; - RealAppID = realAppID; - Type = type; } - - [SuppressMessage("ReSharper", "UnusedMember.Local")] - private Item() { } } internal sealed class TradeOffer { // REF: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#CEcon_TradeOffer