Compare commits

...

12 Commits
love ... master

Author SHA1 Message Date
5129f68dad fix web login 2024-07-09 02:23:49 +08:00
8e3535ecf6 add 43经典 2024-07-05 16:32:50 +08:00
52393d8d67 优化布局,修复逻辑 2024-04-25 16:29:23 +08:00
9f11d1b60a adding new login add fixing when update 2024-04-24 20:21:50 +08:00
877a2ff495 新增7道,7k的登录接口 2024-04-22 00:19:47 +08:00
b66cea26e8 fix about with 52pojie 2024-03-29 21:20:21 +08:00
85e1cc90ba clear code 2024-03-22 23:06:41 +08:00
5fd102c0dc 优化界面 2024-03-22 22:21:37 +08:00
d888391758 优化部分细节 2024-03-22 19:45:11 +08:00
8f2f5f79b6 new protolcool 2024-03-22 17:35:07 +08:00
b87eef10fe fix sf code index 2024-03-19 21:50:20 +08:00
f6f5da37b6 add sf code 2024-03-19 21:45:36 +08:00
19 changed files with 280 additions and 346 deletions

View File

@ -39,14 +39,14 @@
<TextBlock Text="Contact me" HorizontalAlignment="Center" Foreground="#FF81EB78"/> <TextBlock Text="Contact me" HorizontalAlignment="Center" Foreground="#FF81EB78"/>
<TextBlock HorizontalAlignment="Center"> <TextBlock HorizontalAlignment="Center">
<Hyperlink NavigateUri="https://github.com/1415ddfer/ZeroHelper" Click="Hyperlink_Click"> <Hyperlink NavigateUri="https://github.com/1415ddfer/ZeroHelper" Click="Hyperlink_Click">
My GitHub @52Pojie
</Hyperlink> </Hyperlink>
</TextBlock> </TextBlock>
<TextBlock HorizontalAlignment="Center"> <!--<TextBlock HorizontalAlignment="Center">
<Hyperlink NavigateUri="http://www.example.com" Click="Hyperlink_Click_1"> <Hyperlink NavigateUri="http://www.example.com" Click="Hyperlink_Click_1">
ddfgame@foxmail.com ddfgame@foxmail.com
</Hyperlink> </Hyperlink>
</TextBlock> </TextBlock>-->
</StackPanel> </StackPanel>
<Label/> <Label/>
</DockPanel> </DockPanel>

View File

@ -23,7 +23,7 @@ namespace Zerolauncher.AboutDialog
private void Hyperlink_Click(object sender, RoutedEventArgs e) 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) private void Hyperlink_Click_1(object sender, RoutedEventArgs e)

View File

@ -1,5 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using Zerolauncher.Manager; using Zerolauncher.Manager;
@ -11,6 +12,7 @@ namespace Zerolauncher
public partial class App : Application public partial class App : Application
{ {
public static bool needUpdate = false; public static bool needUpdate = false;
static Mutex? mutex;
static bool TryDeleteDirectory(string path, bool recursive) 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) 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); base.OnStartup(e);
Task.Run(async () => Task.Run(async () =>

View File

@ -4,7 +4,6 @@
xmlns:MyNamespace="clr-namespace:Zerolauncher.controls" xmlns:MyNamespace="clr-namespace:Zerolauncher.controls"
AllowsTransparency="True" WindowStyle="None" Background="Transparent" AllowsTransparency="True" WindowStyle="None" Background="Transparent"
Title="零蛋登陆器" Height="300" Width="500" MouseLeftButtonDown="Window_MouseLeftButtonDown"> Title="零蛋登陆器" Height="300" Width="500" MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Grid> <Grid>
<!-- 使用透明背景的PNG图片作为窗口的背景 --> <!-- 使用透明背景的PNG图片作为窗口的背景 -->
<Image Source="/res/1.png" Stretch="Fill"/> <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}"> <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"/> <Image Source="/res/btn_close1.png"/>
</MyNamespace:AirButton> </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"/> <Image Source="/res/btn_mini1.png"/>
</MyNamespace:AirButton> </MyNamespace:AirButton>
<MyNamespace:AirButton Background="Transparent" Height="20" Width="30" BorderBrush="Transparent" Style="{StaticResource ChangeButtonIsMouseOver}" Margin="5,0,0,0" Click="AirButton_Click"> <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> </MyNamespace:AirButton>
<Label/> <Label/>
</DockPanel> </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 Name="mLayout">
</WrapPanel> </WrapPanel>
</ScrollViewer> </ScrollViewer>

View File

@ -133,5 +133,9 @@ namespace Zerolauncher
ab.ShowDialog(); ab.ShowDialog();
} }
private void AirButton_Click_1(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
} }
} }

View File

@ -81,6 +81,7 @@ namespace Zerolauncher.Manager
var group = DataStream.dataStream.Groups[teamIndex]; var group = DataStream.dataStream.Groups[teamIndex];
group.Accounts.RemoveAt(memberId); group.Accounts.RemoveAt(memberId);
DataStream.write(); DataStream.write();
reloadData();
MainWindow.Instance.ReloadBtn(); MainWindow.Instance.ReloadBtn();
} }

View File

@ -37,7 +37,7 @@ namespace Zerolauncher.Manager
try try
{ {
client.Timeout = TimeSpan.FromMinutes(3); client.Timeout = TimeSpan.FromMinutes(3);
response = await client.GetAsync($"{StaticUrl.QMessageMain}{StaticUrl.LoveMessage}"); response = await client.GetAsync($"{StaticUrl.QMessageMain}{StaticUrl.MasterMessage}");
} }
catch (Exception _ex) catch (Exception _ex)
{ {

View File

@ -24,12 +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)
{ //{
Trace.WriteLine("lalalala2"); // 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) {
@ -171,27 +170,34 @@ namespace Zerolauncher.Manager
private void Handle(object sender, DataReceivedEventArgs e) private void Handle(object sender, DataReceivedEventArgs e)
{ {
Trace.WriteLine($"from client:{e.Data}");
var lines = e.Data == null? [""] : e.Data.Split(" ", 2); // 切成两半 var lines = e.Data == null? [""] : e.Data.Split(" ", 2); // 切成两半
switch (lines[0]) switch (lines[0])
{ {
case StaticHandleC.StartDone: case StaticHandleC.LoadDone:
if (gameMode == StaticHandleA.UpdateMode) if (gameMode == StaticHandleA.UpdateMode)
{ {
UpDateManager.DoUpdate1(); UpDateManager.DoUpdate1();
return; return;
} }
if(restartUrl == null)
{
Send($"{StaticHandleS.ShowWindow} {ServicesStaticInfo.ServicesName[account.providerId]}-{account.nickName}"); 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 Task.Run(async delegate
{ {
if (lines[1] == "True") await Task.Delay(5000); if (lines[1] == "True") await Task.Delay(5000);
_ =LoginManager.DoLogin(this); _ = LoginManager.DoLogin(this);
}); });
} }
else else
{ {
Send($"{StaticHandleS.ShowWindow} {ServicesStaticInfo.ServicesName[account.providerId]}-{account.nickName}");
Send($"{StaticHandleS.GameSa} {restartUrl}"); Send($"{StaticHandleS.GameSa} {restartUrl}");
restartUrl = null; restartUrl = null;
} }
@ -236,45 +242,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();
if (mod == StaticHandleA.UpdateMode) //#region 检测代码
{ //if (mod == StaticHandleA.UpdateMode)
if (DataStream.dataStream.ecs.Length > 10) //{
{ // if (DataStream.dataStream.ecs.Length > 10)
string? now_bit; // {
using (SHA256 sha256 = SHA256.Create()) // string? now_bit;
{ // using (SHA256 sha256 = SHA256.Create())
using (FileStream fileStream = File.OpenRead(engine_file)) // {
{ // using (FileStream fileStream = File.OpenRead(engine_file))
byte[] hashBytes = sha256.ComputeHash(fileStream); // {
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty); // byte[] hashBytes = sha256.ComputeHash(fileStream);
} // 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); // {
throw new FileReadException("error esu1!"); // Trace.WriteLine("lalalala" + DataStream.dataStream.ecs);
} // throw new FileReadException("error esu1!");
} // }
} // }
else if (!is_check && is_first_luancher) //}
{ //else if (!is_check && is_first_luancher)
string? now_bit; //{
using (SHA256 sha256 = SHA256.Create()) // string? now_bit;
{ // using (SHA256 sha256 = SHA256.Create())
using (FileStream fileStream = File.OpenRead(engine_file)) // {
{ // using (FileStream fileStream = File.OpenRead(engine_file))
byte[] hashBytes = sha256.ComputeHash(fileStream); // {
now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty); // byte[] hashBytes = sha256.ComputeHash(fileStream);
} // now_bit = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
} // }
if (CacheSha.GetE() != now_bit) // }
{ // if (CacheSha.GetE() != now_bit)
Trace.WriteLine("lalalala1"); // {
throw new FileReadException("error esu0!"); // Trace.WriteLine("lalalala1");
} // throw new FileReadException("error esu0!");
if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); } // }
is_check = true; // if (DataStream.dataStream.ecs != now_bit) { DataStream.dataStream.ecs = now_bit; DataStream.write(); }
} // is_check = true;
//}
//#endregion
var process = new Process var process = new Process
{ {

View File

@ -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;
@ -6,6 +7,7 @@ namespace Zerolauncher.Manager
{ {
internal class LoginManager internal class LoginManager
{ {
//private static readonly HttpClient client = new HttpClient(); //private static readonly HttpClient client = new HttpClient();
public static async Task SendPostRequest() public static async Task SendPostRequest()
@ -42,25 +44,36 @@ namespace Zerolauncher.Manager
Console.WriteLine(responseString); 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 try
//{ {
// userName = "b1783488228", var response = content != null? await client.PostAsync(url, content): await client.GetAsync(url);
// userPWD = "565656", game.Send($"{StaticHandleS.HintText} response.StatusCode{response.StatusCode}");
// serverId = "179" return await response.Content.ReadAsStringAsync();
//}; }
//SingleGame game = new SingleGame(account); catch (Exception ex)
{
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
return null;
}
} }
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 3:
case 0: 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> var values = new Dictionary<string, string>
{ {
@ -79,49 +92,28 @@ namespace Zerolauncher.Manager
{ "username", game.account.userName }, { "username", game.account.userName },
{ "password", game.account.userPWD } { "password", game.account.userPWD }
}; };
var responseString = await AssetNet(client, game, "http://ptlogin.4399.com/ptlogin/login.do?v=1", new FormUrlEncodedContent(values));
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();
// eventHandles.__errorCallback('密码错误'); // eventHandles.__errorCallback('密码错误');
if (responseString == null) break;
if (responseString.Contains("eventHandles.__errorCallback")) if (responseString.Contains("eventHandles.__errorCallback"))
{ {
game.Send($"{StaticHandleS.HintText} 登录异常:{responseString.Split("eventHandles.__errorCallback('")[1].Split("'")[0]}"); 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; break;
} }
if(!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return; if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
} }
{ {
HttpResponseMessage? response = null; var responseString = await AssetNet(client, game, need_web);
try if (responseString == null) break;
{
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();
if (!responseString.Contains("name=\"game_box\"")) if (!responseString.Contains("name=\"game_box\""))
{ {
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确"); 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; break;
} }
responseString = responseString.Split("name=\"game_box\"")[1].Split("src=\"")[1].Split("\"")[0]; responseString = responseString.Split("name=\"game_box\"")[1].Split("src=\"")[1].Split("\"")[0];
HttpResponseMessage response;
try try
{ {
response = await client.PostAsync(responseString, null); response = await client.PostAsync(responseString, null);
@ -129,15 +121,68 @@ namespace Zerolauncher.Manager
catch (Exception ex) catch (Exception ex)
{ {
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}"); 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; break;
} }
responseString = await response.Content.ReadAsStringAsync(); 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]; 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}"); game.Send($"{StaticHandleS.GameSa} {responseString}");
} }
break; 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: default:
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}"); game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
break; break;
@ -149,7 +194,7 @@ namespace Zerolauncher.Manager
await Task.Delay(1000); await Task.Delay(1000);
if (!game.Send($"{StaticHandleS.HintText} 自动登录失败,将在{i}后启用网页登录,关闭窗口取消")) { return; } 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}");
} }
} }
} }

View File

@ -21,17 +21,17 @@ namespace Zerolauncher.Manager
bool needMian= false; bool needMian= false;
if(checkMain) if(checkMain)
{ {
//string filePath = Process.GetCurrentProcess().MainModule.FileName; string filePath = Process.GetCurrentProcess().MainModule.FileName;
string? now_bit; string? now_bit;
//using (SHA256 sha256 = SHA256.Create()) using (SHA256 sha256 = SHA256.Create())
//{ {
// using (FileStream fileStream = File.OpenRead(filePath)) using (FileStream fileStream = File.OpenRead(filePath))
// { {
// 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);
// } }
//} }
now_bit = "67FD2BCB9F6756A82621840896DCE80BB4ACEF22A8D1FF98FC835BE291F5CC84"; //now_bit = "170CD25DCCF3FFCCFAA423B85E1715E7CD28959333C4C5F86FB1E73666359998";
needMian = now_bit == CacheSha.GetM() && now_bit != null; needMian = now_bit == CacheSha.GetM() && now_bit != null;
} }
if(!needEngine) if(!needEngine)
@ -85,14 +85,14 @@ namespace Zerolauncher.Manager
} }
public static void DoUpdate1() public static void DoUpdate1()
{
Task.Run(async () =>
{ {
updateProcess.Send($"{StaticHandleS.ShowWindow} 自助更新"); updateProcess.Send($"{StaticHandleS.ShowWindow} 自助更新");
await Task.Delay(1000); }
public static void DoUpdate2()
{
updateProcess.Send($"{StaticHandleS.UpdateInfo} {UpDateData.tis}"); updateProcess.Send($"{StaticHandleS.UpdateInfo} {UpDateData.tis}");
updateProcess.Send($"{StaticHandleS.UseBrowser} {UpDateData.lanzou + UpDateData.auto_packet_url}"); updateProcess.Send($"{StaticHandleS.UseBrowser} {UpDateData.lanzou + UpDateData.auto_packet_url}");
});
} }
public static void OnDownLoadDone(string path) public static void OnDownLoadDone(string path)

View File

@ -2,7 +2,7 @@
{ {
class ServicesStaticInfo class ServicesStaticInfo
{ {
public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道"]; public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道", "4399经典"];
public static string[] ServicesShortName = ["43", "7k", "7d"]; public static string[] ServicesShortName = ["43", "7k", "7d", "典"];
} }
} }

View File

@ -10,16 +10,19 @@
public const string GameSa = "f0"; public const string GameSa = "f0";
public const string CloseGame = "g0"; public const string CloseGame = "g0";
public const string UpdateInfo = "h0"; public const string UpdateInfo = "h0";
public const string VerifyDone = "i0";
} }
class StaticHandleC class StaticHandleC
{ {
public const string StartDone = "0a"; public const string LoadDone = "0a";
public const string BrowserDone = "0b"; public const string StartDone = "0b";
public const string StartGame = "0c"; public const string BrowserDone = "0c";
public const string GameDone = "0d"; public const string StartGame = "0d";
public const string Version = "0e"; public const string GameDone = "0e";
public const string DownloadDone = "0f"; public const string Version = "0f";
public const string DownloadDone = "0g";
public const string TakeVerify = "0i";
} }
class StaticHandleA class StaticHandleA

View File

@ -1,3 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>

View File

@ -4,11 +4,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="75" d:DesignWidth="60" Margin="5"> d:DesignHeight="75" d:DesignWidth="65" Margin="5">
<Grid> <Grid>
<DockPanel> <DockPanel>
<Image Name="icon" DockPanel.Dock="Top" Source="/res/player_ico1.png" Width="60" Height="60"/> <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> </DockPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -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-4405222021-87888822)\d{3}-\d{8}|\d{4}-\d{7}
7. (1518)^\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(0109112)^(0?[1-9]|1[0-2])$
14. 31(0109131)^((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.00.^(0|-?[1-9][0-9]*)$
19. 4.00.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.13, +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] ((2ASCII字符计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;
}
}

View File

@ -33,6 +33,15 @@ namespace Zerolauncher.dialog
edit_pwd.Password = acc.userPWD; edit_pwd.Password = acc.userPWD;
edit_nick.Text = acc.nickName; 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) private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)

View File

@ -27,7 +27,7 @@
</Style> </Style>
</TextBox.Style> </TextBox.Style>
</TextBox> </TextBox>
<DockPanel Grid.Row="5" Margin="2"> <DockPanel Margin="7">
<Button DockPanel.Dock="Right" Background="Transparent" Click="Button_Click" BorderBrush="Transparent"> <Button DockPanel.Dock="Right" Background="Transparent" Click="Button_Click" BorderBrush="Transparent">
<Image Source="/res/25.png"/> <Image Source="/res/25.png"/>
</Button> </Button>

View File

@ -34,10 +34,8 @@ namespace Zerolauncher.dialog
MessageBoxResult result = MessageBox.Show("即将放生此队伍以及队伍里所有的账号\n将会为你带来114点功德\n您确定要执行此操作吗", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel); MessageBoxResult result = MessageBox.Show("即将放生此队伍以及队伍里所有的账号\n将会为你带来114点功德\n您确定要执行此操作吗", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
if (result == MessageBoxResult.OK) if (result == MessageBoxResult.OK)
{ {
if (!AccountManager.DeleteTeam()) if (!AccountManager.DeleteTeam()) MessageBox.Show("少爷这已经是最后一个队伍了!\n请新建一个队伍后再放生这个吧~", "提示");
{ else EditTeamDialog.Close();
MessageBox.Show("少爷这已经是最后一个队伍了!\n请新建一个队伍后再放生这个吧~", "提示");
}
} }
} }

View File

@ -6,7 +6,7 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="169" d:DesignWidth="290"> d:DesignHeight="169" d:DesignWidth="290">
<DockPanel Margin="5"> <DockPanel Margin="5">
<TextBlock DockPanel.Dock="Top" Margin="5" Text="文本格式:一行一个账号,如:&#x0a; 服务器---区号---账号---密码---备注&#x0a;服务器填代号:&#x0a; 4399是07k7k是1第七大道是2" Foreground="#FFB44242"/> <TextBlock DockPanel.Dock="Top" Margin="5" Text="文本格式:一行一个账号,如:&#x0a; 服务器---区号---账号---密码---备注&#x0a;服务器填代号:&#x0a; 如[0, 4399大区]意味着4399大区的代号是0&#x0a; 具体查看添加账号时,以列表显示的为准" Foreground="#FFB44242"/>
<DockPanel DockPanel.Dock="Bottom"> <DockPanel DockPanel.Dock="Bottom">
<Button DockPanel.Dock="Right" Content="选择文件" Click="Button_Click"/> <Button DockPanel.Dock="Right" Content="选择文件" Click="Button_Click"/>
<TextBox Name="input_split" DockPanel.Dock="Right" Text="---" Width="100"/> <TextBox Name="input_split" DockPanel.Dock="Right" Text="---" Width="100"/>