Enhance concurrent access with ArchiBoT concurrent hashset

This commit is contained in:
JustArchi
2016-05-13 19:39:54 +02:00
parent 622f060575
commit 4b50596709
5 changed files with 206 additions and 10 deletions

View File

@@ -188,6 +188,21 @@ namespace ArchiSteamFarm {
PlayGames(new HashSet<uint> { gameID });
}
internal void PlayGames(ConcurrentHashSet<uint> gameIDs) {
if ((gameIDs == null) || !Client.IsConnected) {
return;
}
ClientMsgProtobuf<CMsgClientGamesPlayed> request = new ClientMsgProtobuf<CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);
foreach (uint gameID in gameIDs.Where(gameID => gameID != 0)) {
request.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed {
game_id = new GameID(gameID)
});
}
Client.Send(request);
}
internal void PlayGames(HashSet<uint> gameIDs) {
if ((gameIDs == null) || !Client.IsConnected) {
return;