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
17 changed files with 212 additions and 369 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

@ -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,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) {
@ -170,6 +170,7 @@ 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])
{ {
@ -241,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

@ -2,13 +2,12 @@
using System.Diagnostics; using System.Diagnostics;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Runtime.ConstrainedExecution;
using System.Text.RegularExpressions;
namespace Zerolauncher.Manager 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()
@ -45,138 +44,145 @@ 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:
game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的1服"); need_web = $"http://web.4399.com/stat/togame.php?target={(game.account.providerId == 3? "ddts":"ddt")}&server_id=S{game.account.serverId}";
{
HttpResponseMessage response;
try
{
response = await client.GetAsync("http://180.97.189.249:2023");
}
catch (Exception ex)
{
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
need_web = $"http://180.97.189.249:2023";
break;
}
var responseString = await response.Content.ReadAsStringAsync();
int count = 0;
while (responseString.Contains("adfwkey"))
{
if (count++ <= 10)
{
game.Send($"{StaticHandleS.HintText} 网络被服务器拦截多次,请重试或联系管理员");
need_web = $"http://180.97.189.249:2023";
break;
}
var key = responseString.Split("adfwkey=")[1].Split("\"", 2)[0];
game.Send($"{StaticHandleS.HintText} 被服务验证拦截-验证码key:{key}");
try
{
response = await client.GetAsync("http://180.97.189.249:2023");
}
catch (Exception ex)
{
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
need_web = $"http://180.97.189.249:2023";
break;
}
responseString = await response.Content.ReadAsStringAsync();
}
}
{ {
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
{ "lUsername", game.account.userName }, { "loginFrom", "uframe" },
{ "lPassword", game.account.userPWD } { "postLoginHandler", "default" },
{ "layoutSelfAdapting", "true" },
{ "externalLogin", "qq" },
{ "displayMode", "popup" },
{ "layout", "vertical" },
{ "appId", "www_home" },
{ "mainDivId", "popup_login_div" },
{ "includeFcmInfo", "false" },
{ "userNameLabel", "4399用户名" },
{ "userNameTip", "请输入4399用户名" },
{ "welcomeTip", "欢迎回到4399" },
{ "username", game.account.userName },
{ "password", game.account.userPWD }
}; };
var content = new FormUrlEncodedContent(values); 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]}");
break;
}
if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
}
{
var responseString = await AssetNet(client, game, need_web);
if (responseString == null) break;
if (!responseString.Contains("name=\"game_box\""))
{
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确");
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; HttpResponseMessage response;
try try
{ {
response = await client.PostAsync("http://180.97.189.249:2023/form/login.php", content); response = await client.PostAsync(responseString, null);
} }
catch (Exception ex) catch (Exception ex)
{ {
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}"); game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}");
need_web = $"http://180.97.189.249:2023";
break; break;
} }
var 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];
}
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); JObject jsonObj = JObject.Parse(responseString);
game.Send($"{StaticHandleS.HintText} {jsonObj["title"]}"); game.Send($"{StaticHandleS.HintText} {jsonObj["info"]}");
game.Send($"{StaticHandleS.HintText} {jsonObj["content"]}"); if ((int)jsonObj["status"] != 1) break;
if ((int)jsonObj["type"] != 0) if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
{
need_web = $"http://180.97.189.249:2023";
break;
}
if(!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
} }
{ {
HttpResponseMessage response; HttpResponseMessage response;
try try
{ {
response = await client.GetAsync("http://180.97.189.249:2023/Play/Play.php?id=1"); response = await client.GetAsync(need_web);
} }
catch (Exception ex) catch (Exception ex)
{ {
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}"); game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}");
need_web = $"http://180.97.189.249:2023";
break; break;
} }
var responseString = await response.Content.ReadAsStringAsync(); var responseString = await response.Content.ReadAsStringAsync();
if (!responseString.Contains("var swfPath")) if (!responseString.Contains("movie\" value='"))
{ {
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确1"); game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确");
need_web = $"http://180.97.189.249:2023"; if (responseString.Contains("维护")) game.Send($"{StaticHandleS.HintText} 检测到服务器在维护中,请耐心等候官方开服");
break; break;
} }
//responseString = "" + responseString.Split("var swfPath")[1].Split("};")[0] + "};"; responseString = "http://" + response.RequestMessage.RequestUri.ToString().Split("/")[2] + "/" + responseString.Split("movie\" value='")[1].Split("'")[0];
string pattern = @"var swfPath = ""(.*?)"";(.*?){(.*?)};"; //Trace.WriteLine(responseString);
Match match = Regex.Match(responseString, pattern, RegexOptions.Singleline); game.Send($"{StaticHandleS.GameSa} {responseString}");
if (!match.Success)
{
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确2");
//Trace.WriteLine($"---------{responseString}|");
need_web = $"http://180.97.189.249:2023";
break;
}
string url = match.Groups[1].Value;
string parameters = match.Groups[3].Value;
string patternParams = @"(\w+): ""(.*?)""";
MatchCollection matches = Regex.Matches(parameters, patternParams);
url += "?";
foreach (Match m in matches)
{
url += $"{m.Groups[1].Value}={WebUtility.UrlEncode(m.Groups[2].Value)}&";
}
url = url.TrimEnd('&');
Trace.WriteLine(url);
game.Send($"{StaticHandleS.GameSa} {url}");
} }
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;
@ -188,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

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

View File

@ -10,6 +10,7 @@
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
@ -21,6 +22,7 @@
public const string GameDone = "0e"; public const string GameDone = "0e";
public const string Version = "0f"; public const string Version = "0f";
public const string DownloadDone = "0g"; 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,7 +33,7 @@ namespace Zerolauncher.dialog
edit_pwd.Password = acc.userPWD; edit_pwd.Password = acc.userPWD;
edit_nick.Text = acc.nickName; edit_nick.Text = acc.nickName;
} }
//return; return;
// 私服用 // 私服用
if (ServicesStaticInfo.ServicesName.Length == 1) if (ServicesStaticInfo.ServicesName.Length == 1)
{ {

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"/>