新增7道,7k的登录接口
This commit is contained in:
parent
b66cea26e8
commit
877a2ff495
@ -24,11 +24,11 @@ namespace Zerolauncher.Manager
|
||||
MessageBox.Show("正在更新游戏数据,请等待1-3秒。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return true;
|
||||
}
|
||||
if (UpDateManager.state)
|
||||
{
|
||||
UpDateManager.DoUpdate();
|
||||
return true;
|
||||
}
|
||||
//if (UpDateManager.state)
|
||||
//{
|
||||
// UpDateManager.DoUpdate();
|
||||
// return true;
|
||||
//}
|
||||
var key = AccToKey(account);
|
||||
if (mGame.ContainsKey(key)) { return false; }
|
||||
if (CacheSha.errorCode != 0) {
|
||||
@ -241,47 +241,47 @@ namespace Zerolauncher.Manager
|
||||
public static Process CheckEngineSafe(string mod)
|
||||
{
|
||||
bool is_first_luancher = EngineManager.CheckEmpy();
|
||||
#region 检测代码
|
||||
if (mod == StaticHandleA.UpdateMode)
|
||||
{
|
||||
if (DataStream.dataStream.ecs.Length > 10)
|
||||
{
|
||||
string? now_bit;
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
{
|
||||
using (FileStream fileStream = File.OpenRead(engine_file))
|
||||
{
|
||||
byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
}
|
||||
}
|
||||
if (DataStream.dataStream.ecs != now_bit)
|
||||
{
|
||||
Trace.WriteLine("lalalala" + DataStream.dataStream.ecs);
|
||||
throw new FileReadException("error esu1!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!is_check && is_first_luancher)
|
||||
{
|
||||
string? now_bit;
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
{
|
||||
using (FileStream fileStream = File.OpenRead(engine_file))
|
||||
{
|
||||
byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
}
|
||||
}
|
||||
if (CacheSha.GetE() != now_bit)
|
||||
{
|
||||
Trace.WriteLine("lalalala1");
|
||||
throw new FileReadException("error esu0!");
|
||||
}
|
||||
if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); }
|
||||
is_check = true;
|
||||
}
|
||||
#endregion
|
||||
//#region 检测代码
|
||||
//if (mod == StaticHandleA.UpdateMode)
|
||||
//{
|
||||
// if (DataStream.dataStream.ecs.Length > 10)
|
||||
// {
|
||||
// string? now_bit;
|
||||
// using (SHA256 sha256 = SHA256.Create())
|
||||
// {
|
||||
// using (FileStream fileStream = File.OpenRead(engine_file))
|
||||
// {
|
||||
// byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
// now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
// }
|
||||
// }
|
||||
// if (DataStream.dataStream.ecs != now_bit)
|
||||
// {
|
||||
// Trace.WriteLine("lalalala" + DataStream.dataStream.ecs);
|
||||
// throw new FileReadException("error esu1!");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else if (!is_check && is_first_luancher)
|
||||
//{
|
||||
// string? now_bit;
|
||||
// using (SHA256 sha256 = SHA256.Create())
|
||||
// {
|
||||
// using (FileStream fileStream = File.OpenRead(engine_file))
|
||||
// {
|
||||
// byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
// now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
// }
|
||||
// }
|
||||
// if (CacheSha.GetE() != now_bit)
|
||||
// {
|
||||
// Trace.WriteLine("lalalala1");
|
||||
// throw new FileReadException("error esu0!");
|
||||
// }
|
||||
// if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); }
|
||||
// is_check = true;
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
@ -48,6 +49,7 @@ namespace Zerolauncher.Manager
|
||||
try
|
||||
{
|
||||
var response = content != null? await client.PostAsync(url, content): await client.GetAsync(url);
|
||||
game.Send($"{StaticHandleS.HintText} response.StatusCode{response.StatusCode}");
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -61,12 +63,15 @@ namespace Zerolauncher.Manager
|
||||
public static async Task DoLogin(SingleGame game)
|
||||
{
|
||||
var client = new HttpClient();
|
||||
client.DefaultRequestVersion = HttpVersion.Version20;
|
||||
client.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
|
||||
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0");
|
||||
string? need_web = null;
|
||||
client.Timeout = TimeSpan.FromSeconds(3);
|
||||
game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的{game.account.serverId}服");
|
||||
switch (game.account.providerId)
|
||||
{
|
||||
case 0:
|
||||
game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的1服");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
{
|
||||
var values = new Dictionary<string, string>
|
||||
@ -121,11 +126,51 @@ namespace Zerolauncher.Manager
|
||||
game.Send($"{StaticHandleS.GameSa} {responseString}");
|
||||
}
|
||||
need_web = null ;
|
||||
break;
|
||||
case 1:
|
||||
need_web = $"http://web.7k7k.com/games/togame.php?target=ddt_7&server_id={game.account.serverId}";
|
||||
{
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{ "username", game.account.userName },
|
||||
{ "password", game.account.userPWD },
|
||||
{"auto", "1" },
|
||||
{"formtype", "index_log" }
|
||||
};
|
||||
var responseString = await AssetNet(client, game, "https://web.7k7k.com/source/Post.php", new FormUrlEncodedContent(values));
|
||||
if (responseString == null) break;
|
||||
//game.Send($"{StaticHandleS.HintText} {responseString}");
|
||||
JObject jsonObj = JObject.Parse(responseString);
|
||||
game.Send($"{StaticHandleS.HintText} {jsonObj["info"]}");
|
||||
if ((int)jsonObj["status"] != 1) break;
|
||||
if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
|
||||
}
|
||||
{
|
||||
HttpResponseMessage response;
|
||||
try
|
||||
{
|
||||
response = await client.GetAsync(need_web);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}");
|
||||
break;
|
||||
}
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
Trace.WriteLine(responseString);
|
||||
responseString = "http://" + response.RequestMessage.RequestUri.ToString().Split("/")[2] + "/" + responseString.Split("movie\" value='")[1].Split("'")[0];
|
||||
//Trace.WriteLine(responseString);
|
||||
game.Send($"{StaticHandleS.GameSa} {responseString}");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
need_web = $"http://www.wan.com/game/play/id/{game.account.serverId}";
|
||||
break;
|
||||
default:
|
||||
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
|
||||
break;
|
||||
}
|
||||
game.Send($"{StaticHandleS.HintText} need web{need_web}");
|
||||
client.Dispose();
|
||||
if (need_web == null) return;
|
||||
for (int i = 6; i > 0; i--)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user