分离玩家信息插件,以及更新检测
This commit is contained in:
44
IpAndPlayer.cs
Normal file
44
IpAndPlayer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user