Пример #1
0
 /// <summary>
 /// Remove a player with a given battletag.
 /// </summary>
 /// <param name="battletag">The battletag of the player to remove.</param>
 /// <returns>True: Player removed | False: No player removed</returns>
 public bool Remove(string battletag)
 {
     if (!OverwatchAPIHelpers.IsValidBattletag(battletag))
     {
         throw new InvalidBattletagException();
     }
     return(OverwatchPlayers.RemoveAll(x => x.Username.Equals(battletag, StringComparison.OrdinalIgnoreCase)) > 0);
 }
Пример #2
0
 public OverwatchPlayer(string username, Platform platform = Platform.pc, Region region = Region.none, string profileurl = null)
 {
     if (!new Regex(@"\w+#\d+").IsMatch(username) && platform == Platform.pc)
     {
         throw new InvalidBattletagException();
     }
     Username             = username;
     BattletagUrlFriendly = username.Replace("#", "-");
     Region   = region;
     Platform = platform;
     if ((Region != Region.none || platform != Platform.pc) && profileurl == null)
     {
         ProfileURL = OverwatchAPIHelpers.ProfileURL(Username, Region, Platform);
     }
 }