release
This commit is contained in:
parent
e18a94cca3
commit
f774879a1b
24
App.xaml.cs
24
App.xaml.cs
@ -19,7 +19,7 @@ namespace Zerolauncher
|
||||
Directory.Delete(path, recursive);
|
||||
return true;
|
||||
}
|
||||
catch (IOException)
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -28,18 +28,6 @@ namespace Zerolauncher
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
if (e.Args.Length == 1)
|
||||
{
|
||||
switch (e.Args[0])
|
||||
{
|
||||
case "updateDone":
|
||||
{
|
||||
for (int i = 0; i < 3 && !TryDeleteDirectory(@"./cache", true); i++)
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@ -50,9 +38,17 @@ namespace Zerolauncher
|
||||
UpDateManager.DoUpdate();
|
||||
}
|
||||
});
|
||||
Task.Run(async () =>
|
||||
{
|
||||
if (Directory.Exists("./cache/"))
|
||||
{
|
||||
for (int i = 0; i < 3 && !TryDeleteDirectory(@"./cache", true); i++) await Task.Delay(3000);
|
||||
}
|
||||
});
|
||||
DataStream.Load();
|
||||
_ = WebApiManager.StartListener();
|
||||
AccountManager.initLoadData(); }
|
||||
AccountManager.initLoadData();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
|
||||
@ -17,9 +17,8 @@ namespace Zerolauncher.Manager
|
||||
return string.Format("{0}{1}{2}", account.providerId, account.serverId, account.userName);
|
||||
}
|
||||
|
||||
public static bool CreateGame(Account account, out bool showDialog)
|
||||
public static bool CreateGame(Account account)
|
||||
{
|
||||
showDialog = false;
|
||||
if (UpDateData.is_check == false)
|
||||
{
|
||||
MessageBox.Show("正在更新游戏数据,请等待1-3秒。\n 请检查网络", "错误", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
@ -27,7 +26,7 @@ namespace Zerolauncher.Manager
|
||||
}
|
||||
if (UpDateData.state)
|
||||
{
|
||||
showDialog = true;
|
||||
UpDateManager.DoUpdate();
|
||||
return true;
|
||||
}
|
||||
var key = AccToKey(account);
|
||||
@ -57,9 +56,9 @@ namespace Zerolauncher.Manager
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CreateGame(int memberId, out bool showDialog)
|
||||
public static bool CreateGame(int memberId)
|
||||
{
|
||||
return CreateGame(AccountManager.accountsList[memberId], out showDialog);
|
||||
return CreateGame(AccountManager.accountsList[memberId]);
|
||||
}
|
||||
|
||||
public static int CheckGameState(Account account)
|
||||
@ -237,7 +236,7 @@ namespace Zerolauncher.Manager
|
||||
bool is_first_luancher = EngineManager.CheckEmpy();
|
||||
if (mod == StaticHandleA.UpdateMode)
|
||||
{
|
||||
if (DataStream.dataStream.ecs != "")
|
||||
if (DataStream.dataStream.ecs.Length > 10)
|
||||
{
|
||||
string? now_bit;
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
|
||||
@ -84,10 +84,14 @@ namespace Zerolauncher.Manager
|
||||
}
|
||||
|
||||
public static void DoUpdate1()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
updateProcess.Send($"{StaticHandleS.ShowWindow} 自助更新");
|
||||
updateProcess.Send($"{StaticHandleS.UseBrowser} {UpDateData.lanzou + UpDateData.auto_packet_url}");
|
||||
await Task.Delay(1000);
|
||||
updateProcess.Send($"{StaticHandleS.UpdateInfo} {UpDateData.tis}");
|
||||
updateProcess.Send($"{StaticHandleS.UseBrowser} {UpDateData.lanzou + UpDateData.auto_packet_url}");
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnDownLoadDone(string path)
|
||||
@ -95,15 +99,16 @@ namespace Zerolauncher.Manager
|
||||
updateProcess.Send(StaticHandleS.CloseGame);
|
||||
try
|
||||
{
|
||||
if (Directory.Exists("./cache/")) Directory.Delete("./cache/", true);
|
||||
ZipFile.ExtractToDirectory(path, "./cache/");
|
||||
File.Delete(path);
|
||||
}catch(Exception e)
|
||||
{
|
||||
MessageBox.Show($"尝试更新文件时发生错误\n{e.Message}", "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
|
||||
MessageBox.Show($"尝试更新文件时发生错误\n{e.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
App.needUpdate = true;
|
||||
MainWindow.Instance.Close();
|
||||
Application.Current.Dispatcher.Invoke(() => Application.Current.Shutdown());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ namespace Zerolauncher.Manager
|
||||
break;
|
||||
case "/LoginGame":
|
||||
{
|
||||
if (EngineManager.CreateGame(acc, out _))
|
||||
if (EngineManager.CreateGame(acc))
|
||||
{
|
||||
rb = new ResponesBody(0, 0, $"Account [{nick}] successful to start.");
|
||||
}
|
||||
|
||||
@ -19,6 +19,13 @@
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="runtimes\**" />
|
||||
<EmbeddedResource Remove="runtimes\**" />
|
||||
<None Remove="runtimes\**" />
|
||||
<Page Remove="runtimes\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="res\1.png" />
|
||||
<None Remove="res\2.png" />
|
||||
|
||||
@ -35,9 +35,7 @@ namespace Zerolauncher.controls
|
||||
if (!isMouseDown) return;
|
||||
RenderTransform = new TranslateTransform(0, 0);
|
||||
if (e.ChangedButton == MouseButton.Right) return;
|
||||
bool needDialog;
|
||||
if (!EngineManager.CreateGame(memberId, out needDialog)) MessageBox.Show("账号已启动!请勿重复启动", "提示");
|
||||
if (needDialog) UpdateDialog.CreateDailog();
|
||||
if (!EngineManager.CreateGame(memberId)) MessageBox.Show("账号已启动!请勿重复启动", "提示");
|
||||
};
|
||||
|
||||
// 鼠标离开事件
|
||||
|
||||
Loading…
Reference in New Issue
Block a user