改了一亿个东西,修了一亿个 BUG

This commit is contained in:
2021-10-19 17:42:18 +02:00
parent 5b907309e0
commit 888ddce4ef
40 changed files with 1870 additions and 1715 deletions

41
ReplayFile/Player.cs Normal file
View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
namespace AnotherReplayReader.ReplayFile
{
internal sealed class Player
{
public static readonly IReadOnlyDictionary<string, string> ComputerNames = new Dictionary<string, string>
{
{ "E", "简单" },
{ "M", "中等" },
{ "H", "困难" },
{ "B", "凶残" },
};
public string PlayerName { get; }
public uint PlayerIp { get; }
public int FactionId { get; }
public int Team { get; }
public Player(string[] playerEntry)
{
var 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]);
}
}
}
}