some fixes

This commit is contained in:
Timerix22 2022-03-13 17:18:34 +03:00
parent c201f11ce1
commit 4ae26cab92
4 changed files with 356 additions and 356 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows; using System.Windows;
using DTLib.Filesystem;
namespace dtlauncher_client_win namespace dtlauncher_client_win
{ {
@ -12,23 +13,21 @@ namespace dtlauncher_client_win
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e)
{ {
base.OnStartup(e); base.OnStartup(e);
string[] args = e.Args;
try try
{ {
if (args.Length > 0 && args[0] == "updated") if (e.Args.Length > 0 && e.Args[0] == "updated")
{ {
LoginWindow window = new(); LoginWindow window = new();
window.ShowDialog(); window.ShowDialog();
} }
else else
{ {
Process.Start("cmd", "/c timeout 1 && start dtlauncher.exe"); if (!File.Exists("updater.exe")) throw new Exception("file <updater.exe> not found");
Process.Start("cmd", "/c timeout 1 && start updater.exe");
} }
} }
catch (Exception ex) catch (Exception ex)
{ { MessageBox.Show($"STARTUP ERROR:\n{ex.Message}\n{ex.StackTrace}"); }
MessageBox.Show($"STARTUP ERROR:\n{ex.Message}\n{ex.StackTrace}");
}
//Current.Shutdown(); //Current.Shutdown();
} }
} }

View File

@ -65,6 +65,7 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="LauncherConfig.cs" />
<Compile Include="LauncherWindow.xaml.cs"> <Compile Include="LauncherWindow.xaml.cs">
<DependentUpon>LauncherWindow.xaml</DependentUpon> <DependentUpon>LauncherWindow.xaml</DependentUpon>
</Compile> </Compile>

View File

@ -51,11 +51,11 @@ namespace updater
// обновление апдейтера // обновление апдейтера
if (args.Length == 0 || args[0] != "updated") if (args.Length == 0 || args[0] != "updated")
{ {
fsp.DownloadFile("dtlauncher.exe", "TEMP\\dtlauncher.exe"); fsp.DownloadFile("updater.exe", "TEMP\\updater.exe");
Log("g", "dtlauncher.exe downloaded\n"); Log("g", "updater.exe downloaded\n");
fsp.DownloadFile("DTLib.dll", "TEMP\\DTLib.dll"); fsp.DownloadFile("DTLib.dll", "TEMP\\DTLib.dll");
Log("g", "DTLib.dll downloaded\n"); Log("g", "DTLib.dll downloaded\n");
Process.Start("cmd", "/c timeout 0 && copy TEMP\\dtlauncher.exe dtlauncher.exe && copy TEMP\\DTLib.dll DTLib.dll && start dtlauncher.exe updated"); Process.Start("cmd", "/c timeout 0 && copy TEMP\\updater.exe updater.exe && copy TEMP\\DTLib.dll DTLib.dll && start updater.exe updated");
} }
else else
{ {

View File

@ -7,7 +7,7 @@
<ProjectGuid>{4784D974-A342-4202-9430-90FE5AC00FC7}</ProjectGuid> <ProjectGuid>{4784D974-A342-4202-9430-90FE5AC00FC7}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>updater</RootNamespace> <RootNamespace>updater</RootNamespace>
<AssemblyName>dtlauncher</AssemblyName> <AssemblyName>updater</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@ -83,10 +83,10 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>del /f /q dtlauncher.exe.config <PostBuildEvent>del /f /q updater.exe.config
copy dtlauncher.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher.exe copy updater.exe ..\..\dtlauncher-server-win\bin\share\client\updater.exe
copy DTLib.dll ..\..\dtlauncher-server-win\bin\share\client\DTLib.dll copy DTLib.dll ..\..\dtlauncher-server-win\bin\share\client\DTLib.dll
copy dtlauncher.exe ..\..\release\dtlauncher.exe copy updater.exe ..\..\release\updater.exe
copy DTLib.dll ..\..\release\DTLib.dll copy DTLib.dll ..\..\release\DTLib.dll
</PostBuildEvent> </PostBuildEvent>