Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5129f68dad | |||
| 8e3535ecf6 | |||
| 52393d8d67 | |||
| 9f11d1b60a | |||
| 877a2ff495 | |||
| b66cea26e8 | |||
| 85e1cc90ba | |||
| 5fd102c0dc | |||
| d888391758 | |||
| 8f2f5f79b6 | |||
| b87eef10fe | |||
| f6f5da37b6 |
@ -39,14 +39,14 @@
|
||||
<TextBlock Text="Contact me" HorizontalAlignment="Center" Foreground="#FF81EB78"/>
|
||||
<TextBlock HorizontalAlignment="Center">
|
||||
<Hyperlink NavigateUri="https://github.com/1415ddfer/ZeroHelper" Click="Hyperlink_Click">
|
||||
My GitHub
|
||||
@52Pojie
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">
|
||||
<!--<TextBlock HorizontalAlignment="Center">
|
||||
<Hyperlink NavigateUri="http://www.example.com" Click="Hyperlink_Click_1">
|
||||
ddfgame@foxmail.com
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</TextBlock>-->
|
||||
</StackPanel>
|
||||
<Label/>
|
||||
</DockPanel>
|
||||
|
||||
@ -23,7 +23,7 @@ namespace Zerolauncher.AboutDialog
|
||||
|
||||
private void Hyperlink_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("http://github.com/1415ddfer/ZeroHelper") { UseShellExecute = true });
|
||||
Process.Start(new ProcessStartInfo("https://www.52pojie.cn/home.php?mod=space&uid=1235138") { UseShellExecute = true });
|
||||
}
|
||||
|
||||
private void Hyperlink_Click_1(object sender, RoutedEventArgs e)
|
||||
|
||||
37
App.xaml.cs
37
App.xaml.cs
@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using Zerolauncher.Manager;
|
||||
|
||||
@ -11,6 +12,7 @@ namespace Zerolauncher
|
||||
public partial class App : Application
|
||||
{
|
||||
public static bool needUpdate = false;
|
||||
static Mutex? mutex;
|
||||
|
||||
static bool TryDeleteDirectory(string path, bool recursive)
|
||||
{
|
||||
@ -25,8 +27,43 @@ namespace Zerolauncher
|
||||
}
|
||||
}
|
||||
|
||||
static bool CheckProcess()
|
||||
{
|
||||
Process[] processes = Process.GetProcesses();
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
bool processExist = false;
|
||||
foreach (Process p in processes)
|
||||
{
|
||||
if (p.ProcessName == currentProcess.ProcessName && p.Id != currentProcess.Id)
|
||||
{
|
||||
processExist = true;
|
||||
}
|
||||
}
|
||||
return processExist;
|
||||
}
|
||||
|
||||
[DllImport("User32.dll")]
|
||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
if (CheckProcess())
|
||||
{
|
||||
Trace.WriteLine("应用程序已经在运行,将其置于前台并退出");
|
||||
// 应用程序已经在运行,将其置于前台并退出
|
||||
var currentProcess = Process.GetCurrentProcess();
|
||||
foreach (var process in Process.GetProcessesByName(currentProcess.ProcessName))
|
||||
{
|
||||
if (process.Id != currentProcess.Id)
|
||||
{
|
||||
SetForegroundWindow(process.MainWindowHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭当前的应用程序实例
|
||||
Shutdown();
|
||||
return;
|
||||
}
|
||||
base.OnStartup(e);
|
||||
|
||||
Task.Run(async () =>
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
xmlns:MyNamespace="clr-namespace:Zerolauncher.controls"
|
||||
AllowsTransparency="True" WindowStyle="None" Background="Transparent"
|
||||
Title="零蛋登陆器" Height="300" Width="500" MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
||||
|
||||
<Grid>
|
||||
<!-- 使用透明背景的PNG图片作为窗口的背景 -->
|
||||
<Image Source="/res/1.png" Stretch="Fill"/>
|
||||
@ -20,7 +19,7 @@
|
||||
<MyNamespace:AirButton Background="Transparent" Height="21" Width="30" Click="Button_Click_3" DockPanel.Dock="Right" BorderBrush="Transparent" Style="{StaticResource ChangeButtonIsMouseOver}">
|
||||
<Image Source="/res/btn_close1.png"/>
|
||||
</MyNamespace:AirButton>
|
||||
<MyNamespace:AirButton Background="Transparent" Height="21" Width="30" DockPanel.Dock="Right" BorderBrush="Transparent" Style="{StaticResource ChangeButtonIsMouseOver}">
|
||||
<MyNamespace:AirButton Background="Transparent" Height="21" Width="30" DockPanel.Dock="Right" BorderBrush="Transparent" Style="{StaticResource ChangeButtonIsMouseOver}" Click="AirButton_Click_1">
|
||||
<Image Source="/res/btn_mini1.png"/>
|
||||
</MyNamespace:AirButton>
|
||||
<MyNamespace:AirButton Background="Transparent" Height="20" Width="30" BorderBrush="Transparent" Style="{StaticResource ChangeButtonIsMouseOver}" Margin="5,0,0,0" Click="AirButton_Click">
|
||||
@ -28,7 +27,7 @@
|
||||
</MyNamespace:AirButton>
|
||||
<Label/>
|
||||
</DockPanel>
|
||||
<ScrollViewer x:Name="memberBG" VerticalScrollBarVisibility="Auto" Margin="10,3,10,10">
|
||||
<ScrollViewer x:Name="memberBG" VerticalScrollBarVisibility="Auto" Margin="15,3,10,10">
|
||||
<WrapPanel Name="mLayout">
|
||||
</WrapPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
@ -133,5 +133,9 @@ namespace Zerolauncher
|
||||
ab.ShowDialog();
|
||||
}
|
||||
|
||||
private void AirButton_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,6 +81,7 @@ namespace Zerolauncher.Manager
|
||||
var group = DataStream.dataStream.Groups[teamIndex];
|
||||
group.Accounts.RemoveAt(memberId);
|
||||
DataStream.write();
|
||||
reloadData();
|
||||
MainWindow.Instance.ReloadBtn();
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ namespace Zerolauncher.Manager
|
||||
try
|
||||
{
|
||||
client.Timeout = TimeSpan.FromMinutes(3);
|
||||
response = await client.GetAsync($"{StaticUrl.QMessageMain}{StaticUrl.LoveMessage}");
|
||||
response = await client.GetAsync($"{StaticUrl.QMessageMain}{StaticUrl.MasterMessage}");
|
||||
}
|
||||
catch (Exception _ex)
|
||||
{
|
||||
|
||||
@ -24,12 +24,11 @@ namespace Zerolauncher.Manager
|
||||
MessageBox.Show("正在更新游戏数据,请等待1-3秒。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return true;
|
||||
}
|
||||
if (UpDateManager.state)
|
||||
{
|
||||
Trace.WriteLine("lalalala2");
|
||||
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) {
|
||||
@ -171,27 +170,34 @@ namespace Zerolauncher.Manager
|
||||
|
||||
private void Handle(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
Trace.WriteLine($"from client:{e.Data}");
|
||||
var lines = e.Data == null? [""] : e.Data.Split(" ", 2); // 切成两半
|
||||
switch (lines[0])
|
||||
{
|
||||
case StaticHandleC.StartDone:
|
||||
case StaticHandleC.LoadDone:
|
||||
if (gameMode == StaticHandleA.UpdateMode)
|
||||
{
|
||||
UpDateManager.DoUpdate1();
|
||||
return;
|
||||
}
|
||||
if(restartUrl == null)
|
||||
{
|
||||
Send($"{StaticHandleS.ShowWindow} {ServicesStaticInfo.ServicesName[account.providerId]}-{account.nickName}");
|
||||
break;
|
||||
case StaticHandleC.StartDone:
|
||||
if (gameMode == StaticHandleA.UpdateMode)
|
||||
{
|
||||
UpDateManager.DoUpdate2();
|
||||
return;
|
||||
}
|
||||
if (restartUrl == null)
|
||||
{
|
||||
Task.Run(async delegate
|
||||
{
|
||||
if (lines[1] == "True") await Task.Delay(5000);
|
||||
_ =LoginManager.DoLogin(this);
|
||||
_ = LoginManager.DoLogin(this);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Send($"{StaticHandleS.ShowWindow} {ServicesStaticInfo.ServicesName[account.providerId]}-{account.nickName}");
|
||||
Send($"{StaticHandleS.GameSa} {restartUrl}");
|
||||
restartUrl = null;
|
||||
}
|
||||
@ -236,45 +242,47 @@ namespace Zerolauncher.Manager
|
||||
public static Process CheckEngineSafe(string mod)
|
||||
{
|
||||
bool is_first_luancher = EngineManager.CheckEmpy();
|
||||
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;
|
||||
}
|
||||
//#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;
|
||||
|
||||
@ -6,6 +7,7 @@ namespace Zerolauncher.Manager
|
||||
{
|
||||
internal class LoginManager
|
||||
{
|
||||
|
||||
//private static readonly HttpClient client = new HttpClient();
|
||||
|
||||
public static async Task SendPostRequest()
|
||||
@ -42,25 +44,36 @@ namespace Zerolauncher.Manager
|
||||
Console.WriteLine(responseString);
|
||||
}
|
||||
|
||||
public static void GameTest()
|
||||
public static async Task<string?> AssetNet(HttpClient client, SingleGame game, string url, FormUrlEncodedContent? content =null)
|
||||
{
|
||||
//Account account = new Account
|
||||
//{
|
||||
// userName = "b1783488228",
|
||||
// userPWD = "565656",
|
||||
// serverId = "179"
|
||||
//};
|
||||
//SingleGame game = new SingleGame(account);
|
||||
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)
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 3:
|
||||
case 0:
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target={(game.account.providerId == 3? "ddts":"ddt")}&server_id=S{game.account.serverId}";
|
||||
{
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
@ -79,49 +92,28 @@ namespace Zerolauncher.Manager
|
||||
{ "username", game.account.userName },
|
||||
{ "password", game.account.userPWD }
|
||||
};
|
||||
|
||||
var content = new FormUrlEncodedContent(values);
|
||||
HttpResponseMessage? response = null;
|
||||
try
|
||||
{
|
||||
response = await client.PostAsync("http://ptlogin.4399.com/ptlogin/login.do?v=1", content);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
break;
|
||||
}
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
var responseString = await AssetNet(client, game, "http://ptlogin.4399.com/ptlogin/login.do?v=1", new FormUrlEncodedContent(values));
|
||||
// eventHandles.__errorCallback('密码错误');
|
||||
if (responseString == null) break;
|
||||
if (responseString.Contains("eventHandles.__errorCallback"))
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 登录异常:{responseString.Split("eventHandles.__errorCallback('")[1].Split("'")[0]}");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
break;
|
||||
}
|
||||
if(!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
|
||||
if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
|
||||
}
|
||||
{
|
||||
HttpResponseMessage? response = null;
|
||||
try
|
||||
{
|
||||
response = await client.PostAsync("http://web.4399.com/stat/togame.php?target=ddt&server_id=S" + game.account.serverId, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
break;
|
||||
}
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
var responseString = await AssetNet(client, game, need_web);
|
||||
if (responseString == null) break;
|
||||
if (!responseString.Contains("name=\"game_box\""))
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
Trace.WriteLine(responseString);
|
||||
if (responseString.Contains("维护")) game.Send($"{StaticHandleS.HintText} 检测到服务器在维护中,请耐心等候官方开服");
|
||||
break;
|
||||
}
|
||||
responseString = responseString.Split("name=\"game_box\"")[1].Split("src=\"")[1].Split("\"")[0];
|
||||
HttpResponseMessage response;
|
||||
try
|
||||
{
|
||||
response = await client.PostAsync(responseString, null);
|
||||
@ -129,15 +121,68 @@ namespace Zerolauncher.Manager
|
||||
catch (Exception ex)
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}");
|
||||
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}";
|
||||
break;
|
||||
}
|
||||
|
||||
responseString = await response.Content.ReadAsStringAsync();
|
||||
if (game.account.providerId == 3)
|
||||
{
|
||||
responseString = responseString.Split("\"movie\" value='")[1].Split("'", 2)[0];
|
||||
}else
|
||||
{
|
||||
responseString = "http://" + response.RequestMessage.RequestUri.ToString().Split("/")[2] + "/" + responseString.Split("movie\" value='")[1].Split("'")[0];
|
||||
Trace.WriteLine(responseString);
|
||||
}
|
||||
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();
|
||||
if (!responseString.Contains("movie\" value='"))
|
||||
{
|
||||
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确");
|
||||
if (responseString.Contains("维护")) game.Send($"{StaticHandleS.HintText} 检测到服务器在维护中,请耐心等候官方开服");
|
||||
break;
|
||||
}
|
||||
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;
|
||||
// case 3:
|
||||
//need_web = $"https://web.4399.com/stat/togame.php?target=ddts&server_id=S{game.account.serverId}";
|
||||
// break;
|
||||
default:
|
||||
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
|
||||
break;
|
||||
@ -149,7 +194,7 @@ namespace Zerolauncher.Manager
|
||||
await Task.Delay(1000);
|
||||
if (!game.Send($"{StaticHandleS.HintText} 自动登录失败,将在{i}后启用网页登录,关闭窗口取消")) { return; }
|
||||
}
|
||||
game.Send($"{StaticHandleS.UseBrowser} {need_web}");
|
||||
game.Send($"{StaticHandleS.UseBrowser} {need_web} {game.account.providerId + 1} {game.account.serverId} {game.account.userName} {game.account.userPWD}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,17 +21,17 @@ namespace Zerolauncher.Manager
|
||||
bool needMian= false;
|
||||
if(checkMain)
|
||||
{
|
||||
//string filePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
string filePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
string? now_bit;
|
||||
//using (SHA256 sha256 = SHA256.Create())
|
||||
//{
|
||||
// using (FileStream fileStream = File.OpenRead(filePath))
|
||||
// {
|
||||
// byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
// now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
// }
|
||||
//}
|
||||
now_bit = "67FD2BCB9F6756A82621840896DCE80BB4ACEF22A8D1FF98FC835BE291F5CC84";
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
{
|
||||
using (FileStream fileStream = File.OpenRead(filePath))
|
||||
{
|
||||
byte[] hashBytes = sha256.ComputeHash(fileStream);
|
||||
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
|
||||
}
|
||||
}
|
||||
//now_bit = "170CD25DCCF3FFCCFAA423B85E1715E7CD28959333C4C5F86FB1E73666359998";
|
||||
needMian = now_bit == CacheSha.GetM() && now_bit != null;
|
||||
}
|
||||
if(!needEngine)
|
||||
@ -85,14 +85,14 @@ namespace Zerolauncher.Manager
|
||||
}
|
||||
|
||||
public static void DoUpdate1()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
updateProcess.Send($"{StaticHandleS.ShowWindow} 自助更新");
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
|
||||
public static void DoUpdate2()
|
||||
{
|
||||
updateProcess.Send($"{StaticHandleS.UpdateInfo} {UpDateData.tis}");
|
||||
updateProcess.Send($"{StaticHandleS.UseBrowser} {UpDateData.lanzou + UpDateData.auto_packet_url}");
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnDownLoadDone(string path)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{
|
||||
class ServicesStaticInfo
|
||||
{
|
||||
public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道"];
|
||||
public static string[] ServicesShortName = ["43", "7k", "7d"];
|
||||
public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道", "4399经典"];
|
||||
public static string[] ServicesShortName = ["43", "7k", "7d", "典"];
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,16 +10,19 @@
|
||||
public const string GameSa = "f0";
|
||||
public const string CloseGame = "g0";
|
||||
public const string UpdateInfo = "h0";
|
||||
public const string VerifyDone = "i0";
|
||||
}
|
||||
|
||||
class StaticHandleC
|
||||
{
|
||||
public const string StartDone = "0a";
|
||||
public const string BrowserDone = "0b";
|
||||
public const string StartGame = "0c";
|
||||
public const string GameDone = "0d";
|
||||
public const string Version = "0e";
|
||||
public const string DownloadDone = "0f";
|
||||
public const string LoadDone = "0a";
|
||||
public const string StartDone = "0b";
|
||||
public const string BrowserDone = "0c";
|
||||
public const string StartGame = "0d";
|
||||
public const string GameDone = "0e";
|
||||
public const string Version = "0f";
|
||||
public const string DownloadDone = "0g";
|
||||
public const string TakeVerify = "0i";
|
||||
}
|
||||
|
||||
class StaticHandleA
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
</ResourceDictionary>
|
||||
@ -4,11 +4,11 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="75" d:DesignWidth="60" Margin="5">
|
||||
d:DesignHeight="75" d:DesignWidth="65" Margin="5">
|
||||
<Grid>
|
||||
<DockPanel>
|
||||
<Image Name="icon" DockPanel.Dock="Top" Source="/res/player_ico1.png" Width="60" Height="60"/>
|
||||
<Label Name="text" DockPanel.Dock="Bottom" Content="43-测试账号" FontSize="9" Padding="0"/>
|
||||
<Label Name="text" DockPanel.Dock="Bottom" Content="43-测试账号" FontSize="9" Padding="0" Width="65"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -1,167 +0,0 @@
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// 不能为空验证
|
||||
/// </summary>
|
||||
public class NotNullValidationRule : ValidationRule
|
||||
{
|
||||
public NotNullValidationRule()
|
||||
{
|
||||
ValidatesOnTargetUpdated = true;
|
||||
}
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value as string) || string.IsNullOrWhiteSpace(value as string))
|
||||
{
|
||||
return new ValidationResult(false, "不能为空!");
|
||||
}
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义正则表达式验证
|
||||
/// </summary>
|
||||
/*
|
||||
一、校验数字的表达式
|
||||
1. 数字:^[0-9]*$
|
||||
2. n位的数字:^\d{n}$
|
||||
3. 至少n位的数字:^\d{n,}$
|
||||
4. m-n位的数字:^\d{m,n}$
|
||||
5. 零和非零开头的数字:^(0|[1-9][0-9]*)$
|
||||
6. 非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(.[0-9]{1,2})?$
|
||||
7. 带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,2})?$
|
||||
8. 正数、负数、和小数:^(\-|\+)?\d+(\.\d+)?$
|
||||
9. 有两位小数的正实数:^[0-9]+(.[0-9]{2})?$
|
||||
10. 有1~3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$
|
||||
11. 非零的正整数:^[1-9]\d*$ 或 ^([1-9][0-9]*){1,3}$ 或 ^\+?[1-9][0-9]*$
|
||||
12. 非零的负整数:^\-[1-9][]0-9"*$ 或 ^-[1-9]\d*$
|
||||
13. 非负整数:^\d+$ 或 ^[1-9]\d*|0$
|
||||
14. 非正整数:^-[1-9]\d*|0$ 或 ^((-\d+)|(0+))$
|
||||
15. 非负浮点数:^\d+(\.\d+)?$ 或 ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$
|
||||
16. 非正浮点数:^((-\d+(\.\d+)?)|(0+(\.0+)?))$ 或 ^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$
|
||||
17. 正浮点数:^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 或 ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
|
||||
18. 负浮点数:^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 或 ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
|
||||
19. 浮点数:^(-?\d+)(\.\d+)?$ 或 ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$
|
||||
二、校验字符的表达式
|
||||
1. 汉字:^[\u4e00-\u9fa5]{0,}$
|
||||
2. 英文和数字:^[A-Za-z0-9]+$ 或 ^[A-Za-z0-9]{4,40}$
|
||||
3. 长度为3-20的所有字符:^.{3,20}$
|
||||
4. 由26个英文字母组成的字符串:^[A-Za-z]+$
|
||||
5. 由26个大写英文字母组成的字符串:^[A-Z]+$
|
||||
6. 由26个小写英文字母组成的字符串:^[a-z]+$
|
||||
7. 由数字和26个英文字母组成的字符串:^[A-Za-z0-9]+$
|
||||
8. 由数字、26个英文字母或者下划线组成的字符串:^\w+$ 或 ^\w{3,20}$
|
||||
9. 中文、英文、数字包括下划线:^[\u4E00-\u9FA5A-Za-z0-9_]+$
|
||||
10. 中文、英文、数字但不包括下划线等符号:^[\u4E00-\u9FA5A-Za-z0-9]+$ 或 ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$
|
||||
11. 可以输入含有^%&',;=?$\"等字符:[^%&',;=?$\x22]+ 12 禁止输入含有~的字符:[^~\x22]+
|
||||
三、特殊需求表达式
|
||||
1. Email地址:^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
|
||||
2. 域名:[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?
|
||||
3. InternetURL:[a-zA-z]+://[^\s]* 或 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
|
||||
4. 手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
|
||||
5. 电话号码("XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX):^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
|
||||
6. 国内电话号码(0511-4405222、021-87888822):\d{3}-\d{8}|\d{4}-\d{7}
|
||||
7. 身份证号(15位、18位数字):^\d{15}|\d{18}$
|
||||
8. 短身份证号码(数字、字母x结尾):^([0-9]){7,18}(x|X)?$ 或 ^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$
|
||||
9. 帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
|
||||
10. 密码(以字母开头,长度在6~18之间,只能包含字母、数字和下划线):^[a-zA-Z]\w{5,17}$
|
||||
11. 强密码(必须包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间):^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
|
||||
12. 日期格式:^\d{4}-\d{1,2}-\d{1,2}
|
||||
13. 一年的12个月(01~09和1~12):^(0?[1-9]|1[0-2])$
|
||||
14. 一个月的31天(01~09和1~31):^((0?[1-9])|((1|2)[0-9])|30|31)$
|
||||
15. 钱的输入格式:
|
||||
16. 1.有四种钱的表示形式我们可以接受:"10000.00" 和 "10,000.00", 和没有 "分" 的 "10000" 和 "10,000":^[1-9][0-9]*$
|
||||
17. 2.这表示任意一个不以0开头的数字,但是,这也意味着一个字符"0"不通过,所以我们采用下面的形式:^(0|[1-9][0-9]*)$
|
||||
18. 3.一个0或者一个不以0开头的数字.我们还可以允许开头有一个负号:^(0|-?[1-9][0-9]*)$
|
||||
19. 4.这表示一个0或者一个可能为负的开头不为0的数字.让用户以0开头好了.把负号的也去掉,因为钱总不能是负的吧.下面我们要加的是说明可能的小数部分:^[0-9]+(.[0-9]+)?$
|
||||
20. 5.必须说明的是,小数点后面至少应该有1位数,所以"10."是不通过的,但是 "10" 和 "10.2" 是通过的:^[0-9]+(.[0-9]{2})?$
|
||||
21. 6.这样我们规定小数点后面必须有两位,如果你认为太苛刻了,可以这样:^[0-9]+(.[0-9]{1,2})?$
|
||||
22. 7.这样就允许用户只写一位小数.下面我们该考虑数字中的逗号了,我们可以这样:^[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$
|
||||
23 8.1到3个数字,后面跟着任意个 逗号+3个数字,逗号成为可选,而不是必须:^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$
|
||||
24. 备注:这就是最终结果了,别忘了"+"可以用"*"替代如果你觉得空字符串也可以接受的话(奇怪,为什么?)最后,别忘了在用函数时去掉去掉那个反斜杠,一般的错误都在这里
|
||||
25. xml文件:^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
|
||||
26. 中文字符的正则表达式:[\u4e00-\u9fa5]
|
||||
27. 双字节字符:[^\x00-\xff] (包括汉字在内,可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1))
|
||||
28. 空白行的正则表达式:\n\s*\r (可以用来删除空白行)
|
||||
29. HTML标记的正则表达式:<(\S*?)[^>]*>.*?</\1>|<.*? /> (网上流传的版本太糟糕,上面这个也仅仅能部分,对于复杂的嵌套标记依旧无能为力)
|
||||
30. 首尾空白字符的正则表达式:^\s*|\s*$或(^\s*)|(\s*$) (可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等),非常有用的表达式)
|
||||
31. 腾讯QQ号:[1-9][0-9]{4,} (腾讯QQ号从10000开始)
|
||||
32. 中国邮政编码:[1-9]\d{5}(?!\d) (中国邮政编码为6位数字)
|
||||
33. IP地址:\d+\.\d+\.\d+\.\d+ (提取IP地址时有用)
|
||||
34. IP地址:((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
|
||||
*/
|
||||
public class CustomRegularValidationRule : ValidationRule
|
||||
{
|
||||
public CustomRegularValidationRule()
|
||||
{
|
||||
ValidatesOnTargetUpdated = true;
|
||||
}
|
||||
public string RegularString { get; set; } // 正则表达式规则
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
string str = value as string;
|
||||
if (!string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
// 检查输入的字符串是否符合当前正则规范
|
||||
if (!Regex.IsMatch(str, RegularString))
|
||||
{
|
||||
return new ValidationResult(false, "内容格式不正确");
|
||||
}
|
||||
}
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 长度限制
|
||||
/// </summary>
|
||||
class LengthLimitValidationRule : ValidationRule
|
||||
{
|
||||
public LengthLimitValidationRule()
|
||||
{
|
||||
ValidatesOnTargetUpdated = true;
|
||||
}
|
||||
public double Minimum { get; set; }
|
||||
public double Maximum { get; set; }
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
if (value == null) return ValidationResult.ValidResult;
|
||||
double number = value.ToString().Length;
|
||||
if (number > Maximum || number < Minimum)
|
||||
{
|
||||
return new ValidationResult(false, string.Format("值长度限制在 {0} 到 {1}", Minimum, Maximum));
|
||||
}
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ip规则验证
|
||||
/// </summary>
|
||||
public class IPAddressRule : ValidationRule
|
||||
{
|
||||
public IPAddressRule()
|
||||
{
|
||||
ValidatesOnTargetUpdated = true;
|
||||
}
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
string IPAddress = value as string;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(IPAddress))
|
||||
{
|
||||
string IPAddressFormartRegex = @"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$";
|
||||
|
||||
// 检查输入的字符串是否符合IP地址格式
|
||||
if (!Regex.IsMatch(IPAddress, IPAddressFormartRegex))
|
||||
{
|
||||
return new ValidationResult(false, "IP地址格式不正确");
|
||||
}
|
||||
}
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,15 @@ namespace Zerolauncher.dialog
|
||||
edit_pwd.Password = acc.userPWD;
|
||||
edit_nick.Text = acc.nickName;
|
||||
}
|
||||
return;
|
||||
// 私服用
|
||||
if (ServicesStaticInfo.ServicesName.Length == 1)
|
||||
{
|
||||
cb_pid.SelectedIndex = 0;
|
||||
edit_sid.Text = "1";
|
||||
cb_pid.IsEditable = false;
|
||||
edit_sid.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
</Style>
|
||||
</TextBox.Style>
|
||||
</TextBox>
|
||||
<DockPanel Grid.Row="5" Margin="2">
|
||||
<DockPanel Margin="7">
|
||||
<Button DockPanel.Dock="Right" Background="Transparent" Click="Button_Click" BorderBrush="Transparent">
|
||||
<Image Source="/res/25.png"/>
|
||||
</Button>
|
||||
|
||||
@ -34,10 +34,8 @@ namespace Zerolauncher.dialog
|
||||
MessageBoxResult result = MessageBox.Show("即将放生此队伍以及队伍里所有的账号\n将会为你带来114点功德\n您确定要执行此操作吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
if (!AccountManager.DeleteTeam())
|
||||
{
|
||||
MessageBox.Show("少爷这已经是最后一个队伍了!\n请新建一个队伍后再放生这个吧~", "提示");
|
||||
}
|
||||
if (!AccountManager.DeleteTeam()) MessageBox.Show("少爷这已经是最后一个队伍了!\n请新建一个队伍后再放生这个吧~", "提示");
|
||||
else EditTeamDialog.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="169" d:DesignWidth="290">
|
||||
<DockPanel Margin="5">
|
||||
<TextBlock DockPanel.Dock="Top" Margin="5" Text="文本格式:一行一个账号,如:
 服务器---区号---账号---密码---备注
服务器填代号:
 4399是0,7k7k是1,第七大道是2" Foreground="#FFB44242"/>
|
||||
<TextBlock DockPanel.Dock="Top" Margin="5" Text="文本格式:一行一个账号,如:
 服务器---区号---账号---密码---备注
服务器填代号:
 如[0, 4399大区]意味着4399大区的代号是0,
 具体查看添加账号时,以列表显示的为准" Foreground="#FFB44242"/>
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
||||
<Button DockPanel.Dock="Right" Content="选择文件" Click="Button_Click"/>
|
||||
<TextBox Name="input_split" DockPanel.Dock="Right" Text="---" Width="100"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user