分离玩家信息插件,以及更新检测
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
using AnotherReplayReader.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
using static System.Text.Json.JsonSerializer;
|
||||
|
||||
namespace AnotherReplayReader
|
||||
{
|
||||
@@ -113,17 +110,11 @@ namespace AnotherReplayReader
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> UpdateIpTable(IPAddress ip, string idText)
|
||||
private async Task<bool> UpdateIpTable(IPAddress ip, string idText)
|
||||
{
|
||||
var bytes = ip.GetAddressBytes();
|
||||
var ipNum = (uint)bytes[0] * 256 * 256 * 256 + bytes[1] * 256 * 256 + bytes[2] * 256 + bytes[3];
|
||||
var text = HttpUtility.UrlEncode(idText);
|
||||
|
||||
var key = HttpUtility.UrlEncode(Auth.GetKey());
|
||||
var request = WebRequest.Create($"https://lanyi.altervista.org/playertable/playertable.php?do=setIP&ip={ipNum}&id={text}&key={key}");
|
||||
using var response = await request.GetResponseAsync().ConfigureAwait(false);
|
||||
using var stream = response.GetResponseStream();
|
||||
return await DeserializeAsync<bool>(stream).ConfigureAwait(false);
|
||||
return await _identity.UpdateIpTable(checked((uint)ipNum), idText).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnIpFieldChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user