Post-merge Resharper fixes #501

This commit is contained in:
JustArchi
2017-04-05 16:17:34 +02:00
parent 7d7a1c9900
commit c7515f9024
5 changed files with 11 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ namespace ArchiSteamFarm {
internal DateTime LastPacketReceived { get; private set; } = DateTime.MinValue;
internal ArchiHandler(ArchiLogger archiLogger) => ArchiLogger = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger));
internal ArchiHandler(ArchiLogger archiLogger) => ArchiLogger = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger));
public override void HandleMsg(IPacketMsg packetMsg) {
if (packetMsg == null) {

View File

@@ -346,6 +346,7 @@ namespace ArchiSteamFarm {
return appID;
}
// ReSharper disable once LoopCanBePartlyConvertedToQuery - C# 7.0 out can't be used within LINQ query yet | https://github.com/dotnet/roslyn/issues/15619
foreach (Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> productInfoApps in productInfoResultSet.Results.Select(result => result.Apps)) {
if (!productInfoApps.TryGetValue(appID, out SteamApps.PICSProductInfoCallback.PICSProductInfo productInfoApp)) {
continue;
@@ -841,7 +842,7 @@ namespace ArchiSteamFarm {
Task.Run(() => Stop()).Forget();
}
Bots.TryRemove(BotName, out Bot ignored);
Bots.TryRemove(BotName, out Bot _);
}
private void Disconnect() {
@@ -923,12 +924,12 @@ namespace ArchiSteamFarm {
private ulong GetFirstSteamMasterID() => BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Key != SteamID) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault();
private BotConfig.EPermission GetSteamUserPermission(ulong steamID) {
if (steamID == 0) {
ArchiLogger.LogNullError(nameof(steamID));
return BotConfig.EPermission.None;
if (steamID != 0) {
return BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission permission) ? permission : BotConfig.EPermission.None;
}
return BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission permission) ? permission : BotConfig.EPermission.None;
ArchiLogger.LogNullError(nameof(steamID));
return BotConfig.EPermission.None;
}
private void HandleCallbacks() {

View File

@@ -470,12 +470,12 @@ namespace ArchiSteamFarm.JSON {
}
// Ensure that amount of items to give is at least amount of items to receive (per game and per type)
foreach (KeyValuePair<uint, Dictionary<Item.EType, uint>> itemsPerGame in itemsToGivePerGame) {
foreach (KeyValuePair<uint, Dictionary<Item.EType, uint>> itemsPerGame in itemsToGivePerGame) {
if (!itemsToReceivePerGame.TryGetValue(itemsPerGame.Key, out Dictionary<Item.EType, uint> otherItemsPerType)) {
return false;
}
foreach (KeyValuePair<Item.EType, uint> itemsPerType in itemsPerGame.Value) {
foreach (KeyValuePair<Item.EType, uint> itemsPerType in itemsPerGame.Value) {
if (!otherItemsPerType.TryGetValue(itemsPerType.Key, out uint otherAmount)) {
return false;
}

View File

@@ -43,7 +43,7 @@ namespace ArchiSteamFarm {
private bool ParsingScheduled;
internal Trading(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
internal Trading(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
public void Dispose() => TradesSemaphore.Dispose();

View File

@@ -97,7 +97,7 @@ namespace ArchiSteamFarm {
for (byte i = 0; i < text.Length; i += split) {
string textPart = string.Join("", text.Skip(i).Take(split));
if (!ulong.TryParse(textPart, NumberStyles.HexNumber, null, out ulong ignored)) {
if (!ulong.TryParse(textPart, NumberStyles.HexNumber, null, out ulong _)) {
return false;
}
}