mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
C# 7.0 syntax sugars
This commit is contained in:
@@ -43,13 +43,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
private bool ParsingScheduled;
|
||||
|
||||
internal Trading(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
|
||||
Bot = bot;
|
||||
}
|
||||
internal Trading(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||
|
||||
public void Dispose() => TradesSemaphore.Dispose();
|
||||
|
||||
@@ -269,8 +263,7 @@ namespace ArchiSteamFarm {
|
||||
// Now let's create a map which maps items to their amount in our EQ
|
||||
Dictionary<ulong, uint> amountMap = new Dictionary<ulong, uint>();
|
||||
foreach (Steam.Item item in inventory) {
|
||||
uint amount;
|
||||
if (amountMap.TryGetValue(item.ClassID, out amount)) {
|
||||
if (amountMap.TryGetValue(item.ClassID, out uint amount)) {
|
||||
amountMap[item.ClassID] = amount + item.Amount;
|
||||
} else {
|
||||
amountMap[item.ClassID] = item.Amount;
|
||||
@@ -281,8 +274,7 @@ namespace ArchiSteamFarm {
|
||||
List<uint> amountsToGive = new List<uint>(tradeOffer.ItemsToGive.Count);
|
||||
Dictionary<ulong, uint> amountMapToGive = new Dictionary<ulong, uint>(amountMap);
|
||||
foreach (ulong key in tradeOffer.ItemsToGive.Select(item => item.ClassID)) {
|
||||
uint amount;
|
||||
if (!amountMapToGive.TryGetValue(key, out amount)) {
|
||||
if (!amountMapToGive.TryGetValue(key, out uint amount)) {
|
||||
amountsToGive.Add(0);
|
||||
continue;
|
||||
}
|
||||
@@ -298,8 +290,7 @@ namespace ArchiSteamFarm {
|
||||
List<uint> amountsToReceive = new List<uint>(tradeOffer.ItemsToReceive.Count);
|
||||
Dictionary<ulong, uint> amountMapToReceive = new Dictionary<ulong, uint>(amountMap);
|
||||
foreach (ulong key in tradeOffer.ItemsToReceive.Select(item => item.ClassID)) {
|
||||
uint amount;
|
||||
if (!amountMapToReceive.TryGetValue(key, out amount)) {
|
||||
if (!amountMapToReceive.TryGetValue(key, out uint amount)) {
|
||||
amountsToReceive.Add(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user