diff --git a/dtlauncher-client-win/App.xaml.cs b/dtlauncher-client-win/App.xaml.cs
index db3624e..bf2b4d1 100644
--- a/dtlauncher-client-win/App.xaml.cs
+++ b/dtlauncher-client-win/App.xaml.cs
@@ -1,35 +1,34 @@
-using System;
-using System.Diagnostics;
-using System.Windows;
-
-namespace dtlauncher_client_win
-{
- ///
- /// Логика взаимодействия для App.xaml
- ///
- public partial class App : Application
- {
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
- string[] args = e.Args;
- try
- {
- if (args.Length > 0 && args[0] == "updated")
- {
- LoginWindow window = new();
- window.ShowDialog();
- }
- else
- {
- Process.Start("cmd", "/c timeout 1 && start dtlauncher.exe");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show($"STARTUP ERROR:\n{ex.Message}\n{ex.StackTrace}");
- }
- //Current.Shutdown();
- }
- }
-}
+using System;
+using System.Diagnostics;
+using System.Windows;
+using DTLib.Filesystem;
+
+namespace dtlauncher_client_win
+{
+ ///
+ /// Логика взаимодействия для App.xaml
+ ///
+ public partial class App : Application
+ {
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+ try
+ {
+ if (e.Args.Length > 0 && e.Args[0] == "updated")
+ {
+ LoginWindow window = new();
+ window.ShowDialog();
+ }
+ else
+ {
+ if (!File.Exists("updater.exe")) throw new Exception("file not found");
+ Process.Start("cmd", "/c timeout 1 && start updater.exe");
+ }
+ }
+ catch (Exception ex)
+ { MessageBox.Show($"STARTUP ERROR:\n{ex.Message}\n{ex.StackTrace}"); }
+ //Current.Shutdown();
+ }
+ }
+}
diff --git a/dtlauncher-client-win/dtlauncher-client-win.csproj b/dtlauncher-client-win/dtlauncher-client-win.csproj
index 65db21c..23d1eb4 100644
--- a/dtlauncher-client-win/dtlauncher-client-win.csproj
+++ b/dtlauncher-client-win/dtlauncher-client-win.csproj
@@ -1,131 +1,132 @@
-
-
-
-
- Debug
- AnyCPU
- {367793EE-4757-4ADD-BF7E-960DC9EB6DF9}
- WinExe
- dtlauncher_client_win
- dtlauncher-client-win
- v4.8
- 9.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
-
-
- AnyCPU
- none
- true
- bin\
- TRACE
- prompt
- 4
- true
-
-
- dtlauncher_client_win.App
-
-
- logo-D.ico
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- LauncherWindow.xaml
-
-
- LoginWindow.xaml
- Code
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- ProgramLabel.xaml
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- Always
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
- {ce793497-2d5c-42d8-b311-e9b32af9cdfb}
- DTLib
-
-
- {e02ea967-fd29-47d2-b25b-ba684b784aee}
- dtscript
-
-
-
-
-
-
-
- del /f /q dtlauncher-client-win.exe.config
-copy dtlauncher-client-win.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher-client-win.exe
-copy client.dtsod ..\..\dtlauncher-server-win\bin\share\client\client.dtsod
-
+
+
+
+
+ Debug
+ AnyCPU
+ {367793EE-4757-4ADD-BF7E-960DC9EB6DF9}
+ WinExe
+ dtlauncher_client_win
+ dtlauncher-client-win
+ v4.8
+ 9.0
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+ true
+
+
+ AnyCPU
+ none
+ true
+ bin\
+ TRACE
+ prompt
+ 4
+ true
+
+
+ dtlauncher_client_win.App
+
+
+ logo-D.ico
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+
+ LauncherWindow.xaml
+
+
+ LoginWindow.xaml
+ Code
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+ ProgramLabel.xaml
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ Always
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ {ce793497-2d5c-42d8-b311-e9b32af9cdfb}
+ DTLib
+
+
+ {e02ea967-fd29-47d2-b25b-ba684b784aee}
+ dtscript
+
+
+
+
+
+
+
+ del /f /q dtlauncher-client-win.exe.config
+copy dtlauncher-client-win.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher-client-win.exe
+copy client.dtsod ..\..\dtlauncher-server-win\bin\share\client\client.dtsod
+
\ No newline at end of file
diff --git a/updater/Updater.cs b/updater/Updater.cs
index bff4d9e..10dc7bd 100644
--- a/updater/Updater.cs
+++ b/updater/Updater.cs
@@ -1,98 +1,98 @@
-using System;
-using System.Diagnostics;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using DTLib;
-using DTLib.Filesystem;
-using DTLib.Network;
-using DTLib.Extensions;
-
-namespace updater
-{
- class Updater
- {
- static readonly string logfile = $"logs\\updater-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
- static Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- static readonly string server_domain = "m1net.keenetic.pro";
- static readonly int server_port = 25001;
-
- static void Main(string[] args)
- {
- try
- {
- Console.Title = "dtlauncher updater";
- Console.InputEncoding = Encoding.Unicode;
- Console.OutputEncoding = Encoding.Unicode;
- PublicLog.LogEvent += Log;
- PublicLog.LogNoTimeEvent += Log;
- // подключение к центральному серверу
- while (true)
- {
- try
- {
- Log("b", "server address: <", "c", server_domain, "b",
- ">\nserver port: <", "c", server_port.ToString(), "b", ">\n");
- mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses(server_domain)[0], server_port));
- Log("g", "connected to server\n");
- break;
- }
- catch (SocketException ex)
- {
- Log("r", $"updater.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
- }
- }
- var fsp = new FSP(mainSocket);
- string recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "requesting hash") throw new Exception("invalid server request");
- mainSocket.SendPackage(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 });
- recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "updater") throw new Exception($"invalid central server answer <{recieved}>");
- // обновление апдейтера
- if (args.Length == 0 || args[0] != "updated")
- {
- fsp.DownloadFile("dtlauncher.exe", "TEMP\\dtlauncher.exe");
- Log("g", "dtlauncher.exe downloaded\n");
- fsp.DownloadFile("DTLib.dll", "TEMP\\DTLib.dll");
- 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");
- }
- else
- {
-
- // установка шрифтов
- /*Log("installing fonts\n");
- Process.Start("fonts\\fontinst.exe");
- Directory.Delete("TEMP");*/
- Log("deleted TEMP\n");
- fsp.DownloadFile("dtlauncher-client-win.exe", "dtlauncher-client-win.exe");
- Process.Start("dtlauncher-client-win.exe", "updated");
- }
- }
- catch (Exception ex)
- {
- Log("r", $"updater.Main() error:\n{ex.Message}\n{ex.StackTrace}\n", "gray", "press any key to close...");
- Console.ReadKey();
- }
- Log("gray", " \n");
- }
-
- // вывод лога в консоль и файл
- public static void Log(params string[] msg)
- {
- if (msg.Length == 1) msg[0] = "[" + DateTime.Now.ToString() + "]: " + msg[0];
- else msg[1] = "[" + DateTime.Now.ToString() + "]: " + msg[1];
- LogNoTime(msg);
- }
- public static void LogNoTime(params string[] msg)
- {
- lock (new object())
- {
- if (msg.Length == 1) File.AppendAllText(logfile, msg[0]);
- else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
- else File.AppendAllText(logfile, msg.MergeToString());
- ColoredConsole.Write(msg);
- }
- }
- }
-}
+using System;
+using System.Diagnostics;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using DTLib;
+using DTLib.Filesystem;
+using DTLib.Network;
+using DTLib.Extensions;
+
+namespace updater
+{
+ class Updater
+ {
+ static readonly string logfile = $"logs\\updater-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
+ static Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ static readonly string server_domain = "m1net.keenetic.pro";
+ static readonly int server_port = 25001;
+
+ static void Main(string[] args)
+ {
+ try
+ {
+ Console.Title = "dtlauncher updater";
+ Console.InputEncoding = Encoding.Unicode;
+ Console.OutputEncoding = Encoding.Unicode;
+ PublicLog.LogEvent += Log;
+ PublicLog.LogNoTimeEvent += Log;
+ // подключение к центральному серверу
+ while (true)
+ {
+ try
+ {
+ Log("b", "server address: <", "c", server_domain, "b",
+ ">\nserver port: <", "c", server_port.ToString(), "b", ">\n");
+ mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses(server_domain)[0], server_port));
+ Log("g", "connected to server\n");
+ break;
+ }
+ catch (SocketException ex)
+ {
+ Log("r", $"updater.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
+ }
+ }
+ var fsp = new FSP(mainSocket);
+ string recieved = mainSocket.GetPackage().BytesToString();
+ if (recieved != "requesting hash") throw new Exception("invalid server request");
+ mainSocket.SendPackage(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 });
+ recieved = mainSocket.GetPackage().BytesToString();
+ if (recieved != "updater") throw new Exception($"invalid central server answer <{recieved}>");
+ // обновление апдейтера
+ if (args.Length == 0 || args[0] != "updated")
+ {
+ fsp.DownloadFile("updater.exe", "TEMP\\updater.exe");
+ Log("g", "updater.exe downloaded\n");
+ fsp.DownloadFile("DTLib.dll", "TEMP\\DTLib.dll");
+ Log("g", "DTLib.dll downloaded\n");
+ Process.Start("cmd", "/c timeout 0 && copy TEMP\\updater.exe updater.exe && copy TEMP\\DTLib.dll DTLib.dll && start updater.exe updated");
+ }
+ else
+ {
+
+ // установка шрифтов
+ /*Log("installing fonts\n");
+ Process.Start("fonts\\fontinst.exe");
+ Directory.Delete("TEMP");*/
+ Log("deleted TEMP\n");
+ fsp.DownloadFile("dtlauncher-client-win.exe", "dtlauncher-client-win.exe");
+ Process.Start("dtlauncher-client-win.exe", "updated");
+ }
+ }
+ catch (Exception ex)
+ {
+ Log("r", $"updater.Main() error:\n{ex.Message}\n{ex.StackTrace}\n", "gray", "press any key to close...");
+ Console.ReadKey();
+ }
+ Log("gray", " \n");
+ }
+
+ // вывод лога в консоль и файл
+ public static void Log(params string[] msg)
+ {
+ if (msg.Length == 1) msg[0] = "[" + DateTime.Now.ToString() + "]: " + msg[0];
+ else msg[1] = "[" + DateTime.Now.ToString() + "]: " + msg[1];
+ LogNoTime(msg);
+ }
+ public static void LogNoTime(params string[] msg)
+ {
+ lock (new object())
+ {
+ if (msg.Length == 1) File.AppendAllText(logfile, msg[0]);
+ else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
+ else File.AppendAllText(logfile, msg.MergeToString());
+ ColoredConsole.Write(msg);
+ }
+ }
+ }
+}
diff --git a/updater/updater.csproj b/updater/updater.csproj
index a2c206c..08c9829 100644
--- a/updater/updater.csproj
+++ b/updater/updater.csproj
@@ -1,94 +1,94 @@
-
-
-
-
- Debug
- AnyCPU
- {4784D974-A342-4202-9430-90FE5AC00FC7}
- Exe
- updater
- dtlauncher
- v4.8
- 9.0
- 512
- true
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- AnyCPU
- false
- none
- true
- bin\
- DEBUG;TRACE
- prompt
- 4
- true
-
-
- logo-D.ico
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.8 %28x86 и x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
- {ce793497-2d5c-42d8-b311-e9b32af9cdfb}
- DTLib
-
-
-
-
- del /f /q dtlauncher.exe.config
-copy dtlauncher.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher.exe
-copy DTLib.dll ..\..\dtlauncher-server-win\bin\share\client\DTLib.dll
-copy dtlauncher.exe ..\..\release\dtlauncher.exe
-copy DTLib.dll ..\..\release\DTLib.dll
-
-
-
+
+
+
+
+ Debug
+ AnyCPU
+ {4784D974-A342-4202-9430-90FE5AC00FC7}
+ Exe
+ updater
+ updater
+ v4.8
+ 9.0
+ 512
+ true
+ true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ AnyCPU
+ false
+ none
+ true
+ bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ true
+
+
+ logo-D.ico
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.8 %28x86 и x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
+
+
+ {ce793497-2d5c-42d8-b311-e9b32af9cdfb}
+ DTLib
+
+
+
+
+ del /f /q updater.exe.config
+copy updater.exe ..\..\dtlauncher-server-win\bin\share\client\updater.exe
+copy DTLib.dll ..\..\dtlauncher-server-win\bin\share\client\DTLib.dll
+copy updater.exe ..\..\release\updater.exe
+copy DTLib.dll ..\..\release\DTLib.dll
+
+
+
\ No newline at end of file