public PlayerBan BanSteamId(ulong steamId, string reason = null, DateTime?expirationDate = null, string referenceName = null) { Config.RemoveExpiredBans(); if (SteamIdBanned(steamId, out var existingBan)) { return(existingBan); } PlayerBan ban = new PlayerBan(steamId, reason, expirationDate, referenceName); BannedPlayers.Add(ban); Config.Save(); return(ban); }
public PlayerBan BanIp(IPAddress ip, string reason = null, DateTime?expirationDate = null, string referenceName = null) { Config.RemoveExpiredBans(); uint uintIp = ip.ToUint32(); if (IpBanned(ip, out var existingBan)) { return(existingBan); } PlayerBan ban = new PlayerBan(uintIp, reason, expirationDate, referenceName); BannedPlayers.Add(ban); Config.Save(); return(ban); }
private void AddPlayerToBan(object sender, RoutedEventArgs e) { var player = BannedPlayers.FirstOrDefault( p => string.Equals(p.Name, PlayerNameTextBox.Text, StringComparison.OrdinalIgnoreCase)); if (player != null) { if (string.Equals(player.Guild.Name, SelectedPlayerServerName, StringComparison.OrdinalIgnoreCase)) { MessageBox.Show("Данный игрок уже добавлен"); return; } } var bannedPlayer = _explorer.GetCharacter(SelectedPlayerServerName, PlayerNameTextBox.Text, CharacterOptions.GetPetSlots); BannedPlayers.Add(bannedPlayer); }
private void UpdateBannedGuildsAndPeoples() { foreach (var bannedGuild in BannedGuilds.ToArray()) { var guild = _explorer.GetGuild(Region.EU, bannedGuild.Realm, bannedGuild.Name, GuildOptions.GetMembers); Parallel.ForEach(guild.Members, member => { member.FullCharactor = _explorer.GetCharacter(Region.EU, member.GuildCharacter.Realm, member.GuildCharacter.Name, CharacterOptions.GetPetSlots); }); BannedGuilds.Remove(bannedGuild); BannedGuilds.Add(guild); } foreach (var bannedPlayer in BannedPlayers.ToArray()) { var updated = _explorer.GetCharacter(bannedPlayer.Realm, bannedPlayer.Name, CharacterOptions.GetPetSlots); BannedPlayers.Remove(bannedPlayer); BannedPlayers.Add(updated); } }