更新框架代码
This commit is contained in:
parent
f34713b9f3
commit
b5c7241fcb
@ -28,7 +28,7 @@ namespace Zerolauncher.AboutDialog
|
||||
|
||||
private void Hyperlink_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("已拷贝到粘贴板", "提示");
|
||||
MessageBox.Show("已拷贝到粘贴板呢喵", "提示");
|
||||
Clipboard.SetDataObject("ddfgame@foxmail.com", true);
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,11 @@ namespace Zerolauncher
|
||||
member.text.Content = ServicesStaticInfo.ServicesShortName[account.providerId] + "-" + account.nickName;
|
||||
mLayout.Children.Add(member);
|
||||
}
|
||||
if (i ==0)
|
||||
{
|
||||
EditMemberDialog.CreateDailog(null);
|
||||
MessageBox.Show("下次右键账号和窗口空白处可以打菜单喵", "小提示");
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadBtn()
|
||||
|
||||
@ -15,13 +15,9 @@ namespace Zerolauncher.Manager
|
||||
if (File.Exists(path))
|
||||
{
|
||||
dataStream = JsonConvert.DeserializeObject<Data>(Encoding.UTF8.GetString(Decompress(File.ReadAllBytes(path))));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataStream = JsonConvert.DeserializeObject<Data>(
|
||||
"{\"teamIndex\":0,\"Groups\":[{\"Name\":\"队伍1\", \"Accounts\": [{\"providerId\":0,\"userName\":\"test\",\"userPWD\":\"test\",\"nickName\":\"测试账号\",\"serverId\":\"1\"}]}], \"ecs\": \"\"}");
|
||||
}
|
||||
|
||||
dataStream = JsonConvert.DeserializeObject<Data>("{\"teamIndex\":0,\"Groups\":[{\"Name\":\"队伍1\", \"Accounts\": []}], \"ecs\": \"\"}");
|
||||
}
|
||||
|
||||
public static void write()
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Zerolauncher.Manager
|
||||
{
|
||||
if (UpDateData.is_check == false)
|
||||
{
|
||||
MessageBox.Show("正在更新游戏数据,请等待1-3秒。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
MessageBox.Show("正在更新游戏数据,请等待1-3秒喵。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return true;
|
||||
}
|
||||
//if (UpDateManager.state)
|
||||
@ -35,13 +35,13 @@ namespace Zerolauncher.Manager
|
||||
switch (CacheSha.errorCode)
|
||||
{
|
||||
case 1:
|
||||
MessageBox.Show("发生网络错误==EMS。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("发生网络错误==EMS。\n 请检查网络喵", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case 2:
|
||||
MessageBox.Show("发生游戏服务错误==EMS。\n 请联系管理员", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("发生游戏服务错误==EMS。\n 请联系管理员喵", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("发生未知错误==EMS。\n 请联系管理员", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("发生未知错误==EMS。\n 请联系管理员喵", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -58,18 +58,18 @@ namespace Zerolauncher.Manager
|
||||
switch (CacheSha.errorCode)
|
||||
{
|
||||
case 1:
|
||||
MessageBox.Show("检查更新出错。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("检查更新出错喵。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case 2:
|
||||
MessageBox.Show("软件已停止服务或服务错误。\n 请联系管理员", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("软件已停止服务或服务错误喵。\n 请联系管理员", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("检查更新出错。", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("检查更新出错喵。", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
MessageBoxResult result = MessageBox.Show($"大厅组件需要更新\n是否更新?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
|
||||
MessageBoxResult result = MessageBox.Show($"大厅组件需要更新\n是否更新?喵", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
try
|
||||
@ -79,7 +79,8 @@ namespace Zerolauncher.Manager
|
||||
}
|
||||
catch (Exception _ex)
|
||||
{
|
||||
MessageBox.Show("执行自动更新失败!,\n请手动访问链接重新下载大厅文件或联系管理员。", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("执行自动更新失败!,\n请手动访问链接重新下载大厅文件或联系管理员喵。", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
Process.Start(new ProcessStartInfo(UpDateData.lanzou + UpDateData.auto_packet_url) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,9 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
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" Width="65"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="btn_diy" Content="自定义图片"/>
|
||||
<Button x:Name="btn_clut" Content="截取游戏" Grid.Row="1"/>
|
||||
<!--<Button x:Name="btn_diy" Content="自定义图片"/>-->
|
||||
<Button x:Name="btn_clut" Content="注册账号" Grid.Row="1" Click="OpenRegWeb"/>
|
||||
<Image Grid.Column="1" Grid.RowSpan="2" Source="/res/player_ico1.png"/>
|
||||
</Grid>
|
||||
<DockPanel Grid.ColumnSpan="1" Margin="2">
|
||||
|
||||
@ -22,7 +22,7 @@ namespace Zerolauncher.dialog
|
||||
{
|
||||
if(string.IsNullOrEmpty(edit_name.Text))
|
||||
{
|
||||
MessageBox.Show("昵称不能为空!", "提示");
|
||||
MessageBox.Show("昵称不能为空喵!", "提示");
|
||||
return;
|
||||
}
|
||||
if (isEditModle) AccountManager.editTeamName(edit_name.Text); else TeamManager.addTeam(edit_name.Text);
|
||||
@ -31,11 +31,13 @@ namespace Zerolauncher.dialog
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBoxResult result = MessageBox.Show("即将放生此队伍以及队伍里所有的账号\n将会为你带来114点功德\n您确定要执行此操作吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
||||
MessageBoxResult result = MessageBox.Show("放生此队伍以及队伍里所有的账号\n为你带来114514点功德\n要执行此操作喵?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
if (!AccountManager.DeleteTeam()) MessageBox.Show("少爷这已经是最后一个队伍了!\n请新建一个队伍后再放生这个吧~", "提示");
|
||||
else EditTeamDialog.Close();
|
||||
if (!AccountManager.DeleteTeam())
|
||||
{
|
||||
MessageBox.Show("已经是最后一个队伍了喵!\n新建一个队伍后再放生这个~", "提示");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
dialog/RegDialog.xaml
Normal file
60
dialog/RegDialog.xaml
Normal file
@ -0,0 +1,60 @@
|
||||
<Window x:Class="Zerolauncher.dialog.RegDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="注册账号.."
|
||||
MinHeight="200"
|
||||
MinWidth="300"
|
||||
SizeToContent="WidthAndHeight"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
FocusManager.FocusedElement="{Binding ElementName=leftMarginTextBox}">
|
||||
<Grid Margin="10">
|
||||
<Grid.Resources>
|
||||
<!-- Default settings for controls -->
|
||||
<Style TargetType="{x:Type Label}">
|
||||
<Setter Property="Margin" Value="0,3,5,5" />
|
||||
<Setter Property="Padding" Value="0,0,0,5" />
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Margin" Value="0,0,0,5" />
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Width" Value="70" />
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Margin" Value="5,0,0,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Left,Top,Right,Bottom margins-->
|
||||
<Button Width="200" Margin="0, 0, 0, 30" Height="50" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="2" Click="FleshPic">
|
||||
<Image x:Name="CapPic" Source="/res/captcha.jpg"/>
|
||||
</Button>
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="2">验证码:</Label>
|
||||
<TextBox Name="rightMarginTextBox" Grid.Column="1" Grid.Row="2" />
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="3">注册邮箱:</Label>
|
||||
<TextBox Name="bottomMarginTextBox" Grid.Column="1" Grid.Row="3" />
|
||||
|
||||
<!-- Accept or Cancel -->
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Name="okButton" IsDefault="True" Click="okButton_Click" >确定</Button>
|
||||
<Button Name="cancelButton" IsCancel="True" Click="cancelButton_Click">取消</Button>
|
||||
</StackPanel>
|
||||
</Grid >
|
||||
</Window>
|
||||
94
dialog/RegDialog.xaml.cs
Normal file
94
dialog/RegDialog.xaml.cs
Normal file
@ -0,0 +1,94 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Zerolauncher.Manager;
|
||||
|
||||
namespace Zerolauncher.dialog
|
||||
{
|
||||
/// <summary>
|
||||
/// RegDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class RegDialog : Window
|
||||
{
|
||||
private HttpClient client;
|
||||
private string user;
|
||||
private string password;
|
||||
public RegDialog(String acc, String pwd)
|
||||
{
|
||||
user = acc;
|
||||
password = pwd;
|
||||
InitializeComponent();
|
||||
client = new();
|
||||
FleshPic(null, null);
|
||||
}
|
||||
|
||||
private async void FleshPic(object _, RoutedEventArgs e)
|
||||
{
|
||||
var main_ip = UpDateData.game_url;
|
||||
HttpResponseMessage? response = null;
|
||||
try
|
||||
{
|
||||
response = await client.GetAsync($"http://{main_ip}/module/captcha.php");
|
||||
if (response != null)
|
||||
{
|
||||
foreach (var item in response.Headers)
|
||||
Console.WriteLine($"{item.Key}");
|
||||
}
|
||||
//var bin = response.Content.ReadAsStream();
|
||||
//verify = ocr.RunInference(new Bitmap(bin));
|
||||
//using (var fileStream = File.Create("tmp.png"))
|
||||
//{
|
||||
// bin.Seek(0, SeekOrigin.Begin);//设置复制开始的地方
|
||||
// bin.CopyTo(fileStream);
|
||||
//}
|
||||
using (var stream = response.Content.ReadAsStream())
|
||||
{
|
||||
BitmapImage bitmap = new BitmapImage();
|
||||
bitmap.BeginInit();
|
||||
bitmap.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmap.StreamSource = stream;
|
||||
bitmap.EndInit();
|
||||
bitmap.Freeze(); // 为了线程安全
|
||||
|
||||
CapPic.Source = bitmap; // 设置Image控件的Source
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($" 网络发生错误,类型:{ex.GetType().Name},消息:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async void okButton_Click(object _, RoutedEventArgs e)
|
||||
{
|
||||
var main_ip = UpDateData.game_url;
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{ "rUsername", user },
|
||||
{ "rPassword", password },
|
||||
{ "rPasswords", password },
|
||||
{ "rEmail", bottomMarginTextBox.Text },
|
||||
{ "rCode", rightMarginTextBox.Text }
|
||||
};
|
||||
var content = new FormUrlEncodedContent(values);
|
||||
try
|
||||
{
|
||||
var response = await client.PostAsync($"http://{main_ip}/form/register.php", content);
|
||||
var src = await response.Content.ReadAsStringAsync();
|
||||
var jsonObj = JObject.Parse(src);
|
||||
MessageBox.Show(jsonObj["content"].ToString(), jsonObj["title"].ToString());
|
||||
if(int.Parse(jsonObj["type"].ToString()) == 0) Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"类型:{ex.GetType().Name},消息:{ex.Message}", "发生错误喵");
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,39 +34,30 @@ namespace Zerolauncher.dialog
|
||||
var accTexts = lines[i].Split(input_split.Text);
|
||||
if (accTexts.Length != 5)
|
||||
{
|
||||
MessageBox.Show($"文本在{i}行非法!\n{lines[i]}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"文本在{i}行非法喵!\n{lines[i]}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
var acc = new AccountNew { };
|
||||
var acc = new Account { };
|
||||
if (!int.TryParse(accTexts[0], out acc.providerId))
|
||||
{
|
||||
MessageBox.Show($"输入的服务商代号错误!在{i}行\n错误:[{lines[i]}]无法转换成服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"输入的服务器代号错误喵!在{i}行\n错误:[{lines[i]}]无法转换成服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
if(0 < acc.providerId || acc.providerId > ServicesStaticInfo.ServicesName.Length)
|
||||
{
|
||||
MessageBox.Show($"输入的服务商代号错误!在{i}行\n错误:[{acc.providerId}]不是有效的服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
if (!int.TryParse(accTexts[1], out acc.serverId))
|
||||
{
|
||||
MessageBox.Show($"输入的服务器代号错误!在{i}行\n错误:[{lines[i]}]无法转换成服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
if (0 < acc.providerId || acc.providerId > ServicesStaticInfo.ServerIds.Length)
|
||||
{
|
||||
MessageBox.Show($"输入的服务器代号错误!在{i}行\n错误:[{acc.providerId}]不是有效的服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"输入的服务器代号错误喵!在{i}行\n错误:[{acc.providerId}]不是有效的服务器代号", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
acc.serverId = accTexts[1];
|
||||
acc.userName = accTexts[2];
|
||||
acc.userPWD = accTexts[3];
|
||||
acc.nickName = accTexts[4];
|
||||
if (!AccountManager.AddAccounts(acc))
|
||||
{
|
||||
MessageBox.Show($"文本在{i}行出错!\n警告:[{acc.nickName}]昵称冲突,将跳过添加此账号", "Warring", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"文本在{i}行出错喵!\n警告:[{acc.nickName}]昵称冲突,将跳过添加此账号", "Warring", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
MessageBox.Show("添加完成!", "提示");
|
||||
MessageBox.Show("添加完成喵!", "提示");
|
||||
AccountManager.saveEdit();
|
||||
AddMemebersDialog.Close();
|
||||
}
|
||||
|
||||
BIN
res/captcha.jpg
Normal file
BIN
res/captcha.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue
Block a user