From 1b552b305b990d58c8773f78874588c55cf08b51 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 16 Jan 2016 04:17:51 +0100 Subject: [PATCH] We don't need double precision here --- ArchiSteamFarm/CardsFarmer.cs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index 984ace146..22d5c82b7 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -42,7 +42,7 @@ namespace ArchiSteamFarm { private readonly Bot Bot; private readonly Timer Timer; - internal readonly ConcurrentDictionary GamesToFarm = new ConcurrentDictionary(); + internal readonly ConcurrentDictionary GamesToFarm = new ConcurrentDictionary(); internal readonly List CurrentGamesFarming = new List(); private bool NowFarming = false; @@ -58,13 +58,13 @@ namespace ArchiSteamFarm { ); } - internal static List GetGamesToFarmSolo(ConcurrentDictionary gamesToFarm) { + internal static List GetGamesToFarmSolo(ConcurrentDictionary gamesToFarm) { if (gamesToFarm == null) { return null; } List result = new List(); - foreach (KeyValuePair keyValue in gamesToFarm) { + foreach (KeyValuePair keyValue in gamesToFarm) { if (keyValue.Value >= 2) { result.Add(keyValue.Key); } @@ -73,7 +73,7 @@ namespace ArchiSteamFarm { return result; } - internal static uint GetAnyGameToFarm(ConcurrentDictionary gamesToFarm) { + internal static uint GetAnyGameToFarm(ConcurrentDictionary gamesToFarm) { if (gamesToFarm == null) { return 0; } @@ -85,14 +85,14 @@ namespace ArchiSteamFarm { return 0; } - internal bool FarmMultiple(ConcurrentDictionary appIDs) { + internal bool FarmMultiple(ConcurrentDictionary appIDs) { if (appIDs.Count == 0) { return true; } - double maxHour = -1; + float maxHour = 0; - foreach (double hour in appIDs.Values) { + foreach (float hour in appIDs.Values) { if (hour > maxHour) { maxHour = hour; } @@ -123,7 +123,7 @@ namespace ArchiSteamFarm { Logging.LogGenericInfo(Bot.BotName, "Now farming: " + appID); if (await Farm(appID).ConfigureAwait(false)) { - double hours; + float hours; GamesToFarm.TryRemove(appID, out hours); return true; } else { @@ -340,12 +340,12 @@ namespace ArchiSteamFarm { } hoursString = Regex.Match(hoursString, @"[0-9\.,]+").Value; - double hours; + float hours; if (string.IsNullOrEmpty(hoursString)) { hours = 0; } else { - hours = double.Parse(hoursString, CultureInfo.InvariantCulture); + hours = float.Parse(hoursString, CultureInfo.InvariantCulture); } GamesToFarm[appID] = hours; @@ -398,7 +398,7 @@ namespace ArchiSteamFarm { return success; } - private bool Farm(double maxHour, ICollection appIDs) { + private bool Farm(float maxHour, ICollection appIDs) { if (maxHour >= 2) { return true; } @@ -414,8 +414,8 @@ namespace ArchiSteamFarm { } // Don't forget to update our GamesToFarm hours - double timePlayed = StatusCheckSleep / 60.0; - foreach (KeyValuePair gameToFarm in GamesToFarm) { + float timePlayed = StatusCheckSleep / 60.0F; + foreach (KeyValuePair gameToFarm in GamesToFarm) { if (!appIDs.Contains(gameToFarm.Key)) { continue; }