分离玩家信息插件,以及更新检测

This commit is contained in:
2021-10-22 08:54:04 +02:00
parent 2a96f8efac
commit 08700abd4f
25 changed files with 860 additions and 234 deletions

44
IpAndPlayer.cs Normal file
View File

@@ -0,0 +1,44 @@
using AnotherReplayReader.Utils;
using System.Text.Json.Serialization;
namespace AnotherReplayReader
{
public sealed class IpAndPlayer
{
public static string SimpleIPToString(uint ip)
{
return $"{ip / 256 / 256 / 256}.{ip / 256 / 256 % 256}.{ip / 256 % 256}.{ip % 256}";
}
[JsonPropertyName("IP")]
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
public uint Ip
{
get => _ip;
set
{
_ip = value;
IpString = SimpleIPToString(_ip);
}
}
[JsonIgnore]
public string IpString { get; private set; } = "0.0.0.0";
[JsonPropertyName("ID")]
public string Id
{
get => _id;
set
{
_id = value;
_pinyin = _id.ToPinyin();
}
}
[JsonIgnore]
public string? PinyinId => _pinyin;
private uint _ip;
private string _id = string.Empty;
private string? _pinyin;
}
}