using System.Collections.Generic; namespace AnotherReplayReader.ReplayFile { internal sealed class Player { public static readonly IReadOnlyDictionary ComputerNames = new Dictionary { { "E", "简单" }, { "M", "中等" }, { "H", "困难" }, { "B", "凶残" }, }; public bool IsComputer { get; } public string PlayerName { get; } public uint PlayerIp { get; } public int FactionId { get; } public int Team { get; } public Player(string[] playerEntry) { IsComputer = playerEntry[0][0] == 'C'; PlayerName = playerEntry[0].Substring(1); if (IsComputer) { PlayerName = ComputerNames[PlayerName]; PlayerIp = 0; FactionId = int.Parse(playerEntry[2]); Team = int.Parse(playerEntry[4]); } else { PlayerIp = uint.Parse(playerEntry[1], System.Globalization.NumberStyles.HexNumber); FactionId = int.Parse(playerEntry[5]); Team = int.Parse(playerEntry[7]); } if (PlayerName.Length == 20) { PlayerName = Ra3.BattleNet.Database.Utils.ChineseEncoding.DecodeChineseFromBase64(PlayerName); } } } }