public Rank GetRank(long steamId) { var accountId = SteamIdDecoder.ToAccountId(steamId); var rank = Rank.NotRanked; try { var rankId = GetRank(accountId, myCsgoClient).Result; rank = (Rank)rankId; } catch (AggregateException e) { var innerExceptions = e.InnerExceptions; if (innerExceptions.Any(x => x is GameCoordinatorException)) { throw innerExceptions.Single(x => x is GameCoordinatorException); } if (innerExceptions.Any(x => x is TimeoutException)) { var timeoutMessage = innerExceptions.Single(x => x is TimeoutException).Message; myLogger.LogWarning(timeoutMessage); throw new GameCoordinatorException(timeoutMessage); } throw; } return(rank); }
private IList <MatchStatistics> GetMatchPlayerStatistics(CDataGCCStrike15_v2_MatchInfo matchInfo) { var roundStats = matchInfo.roundstatsall; var finalRoundStats = roundStats.Last(); var accountIds = finalRoundStats.reservation.account_ids; var players = new List <MatchStatistics>(); for (var i = 0; i < accountIds.Count; i++) { var steamId = SteamIdDecoder.ToSteamId(accountIds[i]); var playerStatistics = new MatchStatistics { SteamID = steamId, InitialSide = i < 5 ? Side.CounterTerrorists : Side.Terrorists }; players.Add(playerStatistics); } return(players); }
public void ToSteamId_ValidAccountId_ReturnsCorrectSteamId(uint accountId, long expectedSteamId) { var steamId = SteamIdDecoder.ToSteamId(accountId); Assert.Equal(expectedSteamId, steamId); }
public void ToAccountId_ValidSteamId_ReturnsCorrectAccountId(long steamId, uint expectedAccountId) { var accountId = SteamIdDecoder.ToAccountId(steamId); Assert.Equal(expectedAccountId, accountId); }