新增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);
|
MessageBox.Show("正在更新游戏数据,请等待1-3秒。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (UpDateManager.state)
|
//if (UpDateManager.state)
|
||||||
{
|
//{
|
||||||
UpDateManager.DoUpdate();
|
// UpDateManager.DoUpdate();
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
var key = AccToKey(account);
|
var key = AccToKey(account);
|
||||||
if (mGame.ContainsKey(key)) { return false; }
|
if (mGame.ContainsKey(key)) { return false; }
|
||||||
if (CacheSha.errorCode != 0) {
|
if (CacheSha.errorCode != 0) {
|
||||||
@ -241,47 +241,47 @@ namespace Zerolauncher.Manager
|
|||||||
public static Process CheckEngineSafe(string mod)
|
public static Process CheckEngineSafe(string mod)
|
||||||
{
|
{
|
||||||
bool is_first_luancher = EngineManager.CheckEmpy();
|
bool is_first_luancher = EngineManager.CheckEmpy();
|
||||||
#region 检测代码
|
//#region 检测代码
|
||||||
if (mod == StaticHandleA.UpdateMode)
|
//if (mod == StaticHandleA.UpdateMode)
|
||||||
{
|
//{
|
||||||
if (DataStream.dataStream.ecs.Length > 10)
|
// if (DataStream.dataStream.ecs.Length > 10)
|
||||||
{
|
// {
|
||||||
string? now_bit;
|
// string? now_bit;
|
||||||
using (SHA256 sha256 = SHA256.Create())
|
// using (SHA256 sha256 = SHA256.Create())
|
||||||
{
|
// {
|
||||||
using (FileStream fileStream = File.OpenRead(engine_file))
|
// using (FileStream fileStream = File.OpenRead(engine_file))
|
||||||
{
|
// {
|
||||||
byte[] hashBytes = sha256.ComputeHash(fileStream);
|
// byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||||
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
// now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (DataStream.dataStream.ecs != now_bit)
|
// if (DataStream.dataStream.ecs != now_bit)
|
||||||
{
|
// {
|
||||||
Trace.WriteLine("lalalala" + DataStream.dataStream.ecs);
|
// Trace.WriteLine("lalalala" + DataStream.dataStream.ecs);
|
||||||
throw new FileReadException("error esu1!");
|
// throw new FileReadException("error esu1!");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else if (!is_check && is_first_luancher)
|
//else if (!is_check && is_first_luancher)
|
||||||
{
|
//{
|
||||||
string? now_bit;
|
// string? now_bit;
|
||||||
using (SHA256 sha256 = SHA256.Create())
|
// using (SHA256 sha256 = SHA256.Create())
|
||||||
{
|
// {
|
||||||
using (FileStream fileStream = File.OpenRead(engine_file))
|
// using (FileStream fileStream = File.OpenRead(engine_file))
|
||||||
{
|
// {
|
||||||
byte[] hashBytes = sha256.ComputeHash(fileStream);
|
// byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||||
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
// now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (CacheSha.GetE() != now_bit)
|
// if (CacheSha.GetE() != now_bit)
|
||||||
{
|
// {
|
||||||
Trace.WriteLine("lalalala1");
|
// Trace.WriteLine("lalalala1");
|
||||||
throw new FileReadException("error esu0!");
|
// throw new FileReadException("error esu0!");
|
||||||
}
|
// }
|
||||||
if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); }
|
// if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); }
|
||||||
is_check = true;
|
// is_check = true;
|
||||||
}
|
//}
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
var process = new Process
|
var process = new Process
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ namespace Zerolauncher.Manager
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = content != null? await client.PostAsync(url, content): await client.GetAsync(url);
|
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();
|
return await response.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -61,12 +63,15 @@ namespace Zerolauncher.Manager
|
|||||||
public static async Task DoLogin(SingleGame game)
|
public static async Task DoLogin(SingleGame game)
|
||||||
{
|
{
|
||||||
var client = new HttpClient();
|
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;
|
string? need_web = null;
|
||||||
client.Timeout = TimeSpan.FromSeconds(3);
|
client.Timeout = TimeSpan.FromSeconds(3);
|
||||||
|
game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的{game.account.serverId}服");
|
||||||
switch (game.account.providerId)
|
switch (game.account.providerId)
|
||||||
{
|
{
|
||||||
case 0:
|
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}";
|
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||||
{
|
{
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
@ -121,11 +126,51 @@ namespace Zerolauncher.Manager
|
|||||||
game.Send($"{StaticHandleS.GameSa} {responseString}");
|
game.Send($"{StaticHandleS.GameSa} {responseString}");
|
||||||
}
|
}
|
||||||
need_web = null ;
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
|
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
game.Send($"{StaticHandleS.HintText} need web{need_web}");
|
||||||
client.Dispose();
|
client.Dispose();
|
||||||
if (need_web == null) return;
|
if (need_web == null) return;
|
||||||
for (int i = 6; i > 0; i--)
|
for (int i = 6; i > 0; i--)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user