From 40b79ddda00a7853248c7c04e5bf8460b7c79a1f Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 20 Oct 2019 21:38:55 +0200 Subject: [PATCH] Misc --- ArchiSteamFarm/CardsFarmer.cs | 5 ++--- ArchiSteamFarm/Commands.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index f3be66988..d8dbbccd0 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -70,13 +70,12 @@ namespace ArchiSteamFarm { 0 ); - internal readonly ConcurrentHashSet CurrentGamesFarming = new ConcurrentHashSet(); - internal readonly ConcurrentList GamesToFarm = new ConcurrentList(); - private readonly Bot Bot; + private readonly ConcurrentHashSet CurrentGamesFarming = new ConcurrentHashSet(); private readonly SemaphoreSlim EventSemaphore = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim FarmingInitializationSemaphore = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim FarmingResetSemaphore = new SemaphoreSlim(0, 1); + private readonly ConcurrentList GamesToFarm = new ConcurrentList(); private readonly Timer IdleFarmingTimer; private readonly ConcurrentDictionary LocallyIgnoredAppIDs = new ConcurrentDictionary(); diff --git a/ArchiSteamFarm/Commands.cs b/ArchiSteamFarm/Commands.cs index b80370c42..f3382463d 100644 --- a/ArchiSteamFarm/Commands.cs +++ b/ArchiSteamFarm/Commands.cs @@ -2557,17 +2557,17 @@ namespace ArchiSteamFarm { return (FormatBotResponse(Strings.BotStatusLocked), Bot); } - if (!Bot.CardsFarmer.NowFarming || (Bot.CardsFarmer.CurrentGamesFarming.Count == 0)) { + if (!Bot.CardsFarmer.NowFarming || (Bot.CardsFarmer.CurrentGamesFarmingReadOnly.Count == 0)) { return (FormatBotResponse(Strings.BotStatusNotIdling), Bot); } - if (Bot.CardsFarmer.CurrentGamesFarming.Count > 1) { - return (FormatBotResponse(string.Format(Strings.BotStatusIdlingList, string.Join(", ", Bot.CardsFarmer.CurrentGamesFarming.Select(game => game.AppID + " (" + game.GameName + ")")), Bot.CardsFarmer.GamesToFarm.Count, Bot.CardsFarmer.GamesToFarm.Sum(game => game.CardsRemaining), Bot.CardsFarmer.TimeRemaining.ToHumanReadable())), Bot); + if (Bot.CardsFarmer.CurrentGamesFarmingReadOnly.Count > 1) { + return (FormatBotResponse(string.Format(Strings.BotStatusIdlingList, string.Join(", ", Bot.CardsFarmer.CurrentGamesFarmingReadOnly.Select(game => game.AppID + " (" + game.GameName + ")")), Bot.CardsFarmer.GamesToFarmReadOnly.Count, Bot.CardsFarmer.GamesToFarmReadOnly.Sum(game => game.CardsRemaining), Bot.CardsFarmer.TimeRemaining.ToHumanReadable())), Bot); } - CardsFarmer.Game soloGame = Bot.CardsFarmer.CurrentGamesFarming.First(); + CardsFarmer.Game soloGame = Bot.CardsFarmer.CurrentGamesFarmingReadOnly.First(); - return (FormatBotResponse(string.Format(Strings.BotStatusIdling, soloGame.AppID, soloGame.GameName, soloGame.CardsRemaining, Bot.CardsFarmer.GamesToFarm.Count, Bot.CardsFarmer.GamesToFarm.Sum(game => game.CardsRemaining), Bot.CardsFarmer.TimeRemaining.ToHumanReadable())), Bot); + return (FormatBotResponse(string.Format(Strings.BotStatusIdling, soloGame.AppID, soloGame.GameName, soloGame.CardsRemaining, Bot.CardsFarmer.GamesToFarmReadOnly.Count, Bot.CardsFarmer.GamesToFarmReadOnly.Sum(game => game.CardsRemaining), Bot.CardsFarmer.TimeRemaining.ToHumanReadable())), Bot); } [ItemCanBeNull] @@ -2594,7 +2594,7 @@ namespace ArchiSteamFarm { HashSet botsRunning = validResults.Where(result => result.Bot.KeepRunning).Select(result => result.Bot).ToHashSet(); - string extraResponse = string.Format(Strings.BotStatusOverview, botsRunning.Count, validResults.Count, botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarm.Count), botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarm.Sum(game => game.CardsRemaining))); + string extraResponse = string.Format(Strings.BotStatusOverview, botsRunning.Count, validResults.Count, botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarmReadOnly.Count), botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarmReadOnly.Sum(game => game.CardsRemaining))); return string.Join(Environment.NewLine, validResults.Select(result => result.Response).Union(extraResponse.ToEnumerable())); }