Fix crash

This commit is contained in:
JustArchi 2015-12-28 15:52:58 +01:00
parent 40b1e8f4c2
commit d287674d69
3 changed files with 12 additions and 9 deletions

View file

@ -24,6 +24,7 @@
using HtmlAgilityPack;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
@ -41,7 +42,7 @@ namespace ArchiSteamFarm {
private readonly Bot Bot;
private readonly Timer Timer;
internal readonly Dictionary<uint, double> GamesToFarm = new Dictionary<uint, double>();
internal readonly ConcurrentDictionary<uint, double> GamesToFarm = new ConcurrentDictionary<uint, double>();
internal readonly List<uint> CurrentGamesFarming = new List<uint>();
private bool NowFarming = false;
@ -57,7 +58,7 @@ namespace ArchiSteamFarm {
);
}
internal static List<uint> GetGamesToFarmSolo(Dictionary<uint, double> gamesToFarm) {
internal static List<uint> GetGamesToFarmSolo(ConcurrentDictionary<uint, double> gamesToFarm) {
if (gamesToFarm == null) {
return null;
}
@ -72,7 +73,7 @@ namespace ArchiSteamFarm {
return result;
}
internal static uint GetAnyGameToFarm(Dictionary<uint, double> gamesToFarm) {
internal static uint GetAnyGameToFarm(ConcurrentDictionary<uint, double> gamesToFarm) {
if (gamesToFarm == null) {
return 0;
}
@ -84,7 +85,7 @@ namespace ArchiSteamFarm {
return 0;
}
internal bool FarmMultiple(Dictionary<uint, double> appIDs) {
internal bool FarmMultiple(ConcurrentDictionary<uint, double> appIDs) {
if (appIDs.Count == 0) {
return true;
}
@ -122,7 +123,8 @@ namespace ArchiSteamFarm {
Logging.LogGenericInfo(Bot.BotName, "Now farming: " + appID);
if (await Farm(appID).ConfigureAwait(false)) {
GamesToFarm.Remove(appID);
double hours;
GamesToFarm.TryRemove(appID, out hours);
return true;
} else {
CurrentGamesFarming.Clear();

View file

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
[assembly: AssemblyVersion("1.2.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]

View file

@ -22,10 +22,11 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>