diff --git a/.gitignore b/.gitignore
index c65ebad..e3d3fd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,365 +1,20 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-##
-## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
-# User-specific files
-*.rsuser
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Mono auto generated files
-mono_crash.*
-
# Build results
+[Bb]in/
+.bin/
[Dd]ebug/
-[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
-x64/
-x86/
-[Ww][Ii][Nn]32/
-[Aa][Rr][Mm]/
-[Aa][Rr][Mm]64/
-bld/
-[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
-# Visual Studio 2015/2017 cache/options directory
+# IDE files
.vs/
+.vscode/
.vshistory/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
+.idea/
+.editorconfig
-# Visual Studio 2017 auto generated files
-Generated\ Files/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUnit
-*.VisualState.xml
-TestResult.xml
-nunit-*.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# Benchmark Results
-BenchmarkDotNet.Artifacts/
-
-# .NET Core
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-# ASP.NET Scaffolding
-ScaffoldingReadMe.txt
-
-# StyleCop
-StyleCopReport.xml
-
-# Files built by Visual Studio
-*_i.c
-*_p.c
-*_h.h
-*.ilk
-*.meta
-*.obj
-*.iobj
-*.pch
-*.pdb
-*.ipdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*_wpftmp.csproj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-*.editorconfig
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# Visual Studio Trace Files
-*.e2e
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# AxoCover is a Code Coverage Tool
-.axoCover/*
-!.axoCover/settings.json
-
-# Coverlet is a free, cross platform Code Coverage Tool
-coverage*.json
-coverage*.xml
-coverage*.info
-
-# Visual Studio code coverage results
-*.coverage
-*.coveragexml
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# Note: Comment the next line if you want to checkin your web deploy settings,
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# NuGet Symbol Packages
-*.snupkg
-# The packages folder can be ignored because of Package Restore
-**/[Pp]ackages/*
-# except build/, which is used as an MSBuild target.
-!**/[Pp]ackages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/[Pp]ackages/repositories.config
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-*.appx
-*.appxbundle
-*.appxupload
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!?*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-# Including strong name files can present a security risk
-# (https://github.com/github/gitignore/pull/2483#issue-259490424)
-#*.snk
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-ServiceFabricBackup/
-*.rptproj.bak
-
-# SQL Server files
-*.mdf
-*.ldf
-*.ndf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-*.rptproj.rsuser
-*- [Bb]ackup.rdl
-*- [Bb]ackup ([0-9]).rdl
-*- [Bb]ackup ([0-9][0-9]).rdl
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-node_modules/
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
-*.vbw
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# CodeRush personal settings
-.cr/personal
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
-
-# Cake - Uncomment if you are using it
-# tools/**
-# !tools/packages.config
-
-# Tabs Studio
-*.tss
-
-# Telerik's JustMock configuration file
-*.jmconfig
-
-# BizTalk build output
-*.btp.cs
-*.btm.cs
-*.odx.cs
-*.xsd.cs
-
-# OpenCover UI analysis results
-OpenCover/
-
-# Azure Stream Analytics local run output
-ASALocalRun/
-
-# MSBuild Binary and Structured Log
-*.binlog
-
-# NVidia Nsight GPU debugger configuration file
-*.nvuser
-
-# MFractors (Xamarin productivity tool) working folder
-.mfractor/
-
-# Local History for Visual Studio
-.localhistory/
-
-# BeatPulse healthcheck temp database
-healthchecksdb
-
-# Backup folder for Package Reference Convert tool in Visual Studio 2017
-MigrationBackup/
-
-# Ionide (cross platform F# VS Code tools) working folder
-.ionide/
-
-# Fody - auto-generated XML schema
-FodyWeavers.xsd
+#backups
+.old*/
\ No newline at end of file
diff --git a/DTLib b/DTLib
new file mode 120000
index 0000000..d061026
--- /dev/null
+++ b/DTLib
@@ -0,0 +1 @@
+../DTLib/DTLib
\ No newline at end of file
diff --git a/dtlauncher-client-win/App.config b/dtlauncher-client-win/App.config
deleted file mode 100644
index 193aecc..0000000
--- a/dtlauncher-client-win/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dtlauncher-client-win/App.xaml.cs b/dtlauncher-client-win/App.xaml.cs
deleted file mode 100644
index db3624e..0000000
--- a/dtlauncher-client-win/App.xaml.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-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();
- }
- }
-}
diff --git a/dtlauncher-client-win/LauncherWindow.xaml.cs b/dtlauncher-client-win/LauncherWindow.xaml.cs
deleted file mode 100644
index 0001c31..0000000
--- a/dtlauncher-client-win/LauncherWindow.xaml.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using System.Net.Sockets;
-using System.Text;
-using System.Windows;
-using DTLib;
-using DTLib.Filesystem;
-
-namespace dtlauncher_client_win
-{
- ///
- /// Логика взаимодействия для LauncherWindow.xaml
- ///
- public partial class LauncherWindow : Window
- {
- public Socket mainSocket;
- string logfile;
- public delegate void LaunchDel();
- public LaunchDel Launch = () => { };
- public delegate void InstallDel();
- public LaunchDel Install = () => { };
- public ProgramLabel[] programsArray;
- public int PreviousProgramNum = 0;
-
- public LauncherWindow(Socket _socket, string _logfile, string _log)
- {
- try
- {
- InitializeComponent();
- mainSocket = _socket;
- logfile = _logfile;
- LogBox.Text += _log;
- PublicLog.LogEvent += Log;
- PublicLog.LogNoTimeEvent += Log;
- Closed += AppClose;
- // переключение вкладок кнопками
- var green = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(44, 220, 17));
- var white = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
- HomeButton.Click += (s, e) =>
- {
- LogGrid.Visibility = Visibility.Hidden;
- SettingsGrid.Visibility = Visibility.Hidden;
- HomeGrid.Visibility = Visibility.Visible;
- LogButton.Foreground = white;
- SettingsButton.Foreground = white;
- HomeButton.Foreground = green;
- };
- LogButton.Click += (s, e) =>
- {
- HomeGrid.Visibility = Visibility.Hidden;
- SettingsGrid.Visibility = Visibility.Hidden;
- LogGrid.Visibility = Visibility.Visible;
- HomeButton.Foreground = white;
- SettingsButton.Foreground = white;
- LogButton.Foreground = green;
- };
- SettingsButton.Click += (s, e) =>
- {
- HomeGrid.Visibility = Visibility.Hidden;
- LogGrid.Visibility = Visibility.Hidden;
- SettingsGrid.Visibility = Visibility.Visible;
- HomeButton.Foreground = white;
- LogButton.Foreground = white;
- SettingsButton.Foreground = green;
- };
- // считывание дескрипторов программ
- string[] descriptors = Directory.GetFiles("descriptors", "*.desc");
- programsArray = new ProgramLabel[descriptors.Length];
- Log(descriptors.Length + " descriptors found\n");
- for (int i = 0; i < descriptors.Length; i++)
- {
- programsArray[i] = new ProgramLabel(descriptors[i], i, this);
- ProgramsPanel.Children.Add(programsArray[i]);
- Log(programsArray[i].Text + " added to ProgramsPanel\n");
- }
- LaunchButton.Click += (s, e) => Launch();
- InstallButton.Click += (s, e) => Install();
- //mainSocket.FSP_Download(new FSP_FileObject("share\\file.arc", "downloads\\file.arc"));
- }
- catch (Exception ex)
- {
- string mes = $"LauncherWindow() error:\n{ex.Message}\n{ex.StackTrace}\n";
- MessageBox.Show(mes);
- Log(mes);
- }
- }
-
- public void Log(string msg)
- {
- if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
- File.AppendAllText(logfile, msg);
- LogBox.Text += msg;
- }
-
- public void Log(params string[] input)
- {
- if (input.Length == 1) Log(input[0]);
- if (input.Length % 2 == 0)
- {
- StringBuilder strB = new();
- for (ushort i = 0; i < input.Length; i++)
- strB.Append(input[++i]);
- Log(strB.ToString());
- }
- else throw new Exception("error in Log(): every text string must have color string before");
- }
-
- void AppClose(object sender, EventArgs e)
- {
- if (mainSocket.Connected)
- {
- mainSocket.Shutdown(SocketShutdown.Both);
- mainSocket.Close();
- }
- Log("dtlauncher closing\n");
- App.Current.Shutdown();
- }
- }
-}
\ No newline at end of file
diff --git a/dtlauncher-client-win/LoginWindow.xaml b/dtlauncher-client-win/LoginWindow.xaml
deleted file mode 100644
index 920d886..0000000
--- a/dtlauncher-client-win/LoginWindow.xaml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dtlauncher-client-win/LoginWindow.xaml.cs b/dtlauncher-client-win/LoginWindow.xaml.cs
deleted file mode 100644
index 0e8f4a3..0000000
--- a/dtlauncher-client-win/LoginWindow.xaml.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.Windows;
-using DTLib;
-using DTLib.Dtsod;
-using DTLib.Filesystem;
-using DTLib.Network;
-using DTLib.Extensions;
-
-namespace dtlauncher_client_win
-{
- ///
- /// Логика взаимодействия для LoginWindow.xaml
- ///
- public partial class LoginWindow : Window
- {
- public Socket mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- public string logfile = $"logs\\client-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
- DtsodV21 config;
-
- public LoginWindow()
- {
- try
- {
- InitializeComponent();
- LogBox.Text = " \n"; // костыль для работы Log()
- Directory.Create("logs");
- Directory.Create("downloads");
- Directory.Create("installed");
- Directory.Create("installscripts");
- Directory.Create("launchinfo");
- PublicLog.LogEvent += Log;
- PublicLog.LogNoTimeEvent += Log;
- LoginButton.Click += Login;
- RegisterButton.Click += Register;
- Log("[" + DateTime.Now.ToString() + "]: launcher is starting\n");
- config = new(File.ReadAllText("client.dtsod"));
- Closed += AppClose;
- }
- catch (Exception e)
- {
- Log("error:\n" + e.Message + "\n" + e.StackTrace + '\n');
- }
- }
-
- void Register(object sender, EventArgs e)
- {
- try
- {
- var hasher = new Hasher();
- string filename = $"register-{LoginBox.Text}.req";
- string content = hasher.HashCycled(hasher.Hash(LoginBox.Text.ToBytes(), PasswBox.Password.ToBytes()), 512).HashToString() + ": " + LoginBox.Text;
- //File.WriteAllText(filename, hasher.HashCycled(hasher.Hash(LoginBox.Text.ToBytes(), PasswBox.Password.ToBytes()), 512).HashToString() + ": " + LoginBox.Text);
- //Log($"request file created:{Directory.GetCurrentDirectory()}\\register-{LoginBox.Text}.req {hasher.Hash(LoginBox.Text.ToBytes(), PasswBox.Password.ToBytes()).Length}");
- if (mainSocket.Connected)
- {
- mainSocket.Shutdown(SocketShutdown.Both);
- mainSocket.Close();
- mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- }
- Log($"server address: <{config["server_domain"]}>\nserver port: <{config["server_port"]}>\n");
- mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses(config["server_domain"])[0], (int)config["server_port"]));
- Log("g", "connecting to server...\n");
- mainSocket.ReceiveTimeout = 2000;
- string recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "requesting hash") throw new Exception($"Login() error: invalid request <{recieved}> <{recieved.Length}>");
- 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}>");
- mainSocket.SendPackage("register new user".ToBytes());
- recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "ok") throw new Exception($"invalid central server answer <{recieved}>");
- mainSocket.SendPackage(content.ToBytes());
- Log("g", "registration request sent\n");
- //mainSocket.SendPackage(filename.ToBytes());
- //mainSocket.FSP_Upload(filename);
- //mainSocket.Shutdown(SocketShutdown.Both);
- //mainSocket.Close();
- }
- catch (Exception ex)
- {
- string mes = $"LoginWindow.Register() error:\n{ex.Message}\n{ex.StackTrace}\n";
- MessageBox.Show(mes);
- Log(mes);
- }
- }
-
- void Login(object sender, EventArgs e)
- {
- try
- {
- if (mainSocket.Connected)
- {
- mainSocket.Shutdown(SocketShutdown.Both);
- mainSocket.Close();
- mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- }
- Log($"server address: <{config["server_domain"]}>\nserver port: <{config["server_port"]}>\n");
- mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses(config["server_domain"])[0], (int)config["server_port"]));
- Log("g", "connecting to server...\n");
- mainSocket.ReceiveTimeout = 2000;
- string recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "requesting hash") throw new Exception($"Login() error: invalid request <{recieved}> <{recieved.Length}>");
- var hasher = new Hasher();
- mainSocket.SendPackage(hasher.HashCycled(hasher.Hash(LoginBox.Text.ToBytes(), PasswBox.Password.ToBytes()), 512));
- recieved = mainSocket.GetPackage().BytesToString();
- if (recieved != "success") throw new Exception($"Login() error: invalid server answer <{recieved}>");
- Log("succesfully connected\n");
- // вызов нового окна
- PublicLog.LogEvent -= Log;
- PublicLog.LogNoTimeEvent -= Log;
- var lauWin = new LauncherWindow(mainSocket, logfile, LogBox.Text);
- lauWin.Show();
- Closed -= AppClose;
- Close();
- }
- catch (Exception ex)
- {
- string mes = $"LoginWindow.Login() error:\n{ex.Message}\n{ex.StackTrace}\n";
- MessageBox.Show(mes);
- Log(mes);
- }
- }
-
- public void Log(string msg)
- {
- if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
- File.AppendAllText(logfile, msg);
- LogBox.Text += msg;
- }
-
- public void Log(params string[] input)
- {
- if (input.Length == 1) Log(input[0]);
- if (input.Length % 2 == 0)
- {
- StringBuilder strB = new();
- for (ushort i = 0; i < input.Length; i++)
- strB.Append(input[++i]);
- Log(strB.ToString());
- }
- else throw new Exception("error in Log(): every text string must have color string before");
- }
-
- void AppClose(object sender, EventArgs e)
- {
- if (mainSocket.Connected)
- {
- mainSocket.Shutdown(SocketShutdown.Both);
- mainSocket.Close();
- }
- Log("dtlauncher closing\n");
- App.Current.Shutdown();
- }
- }
-}
diff --git a/dtlauncher-client-win/ProgramLabel.xaml b/dtlauncher-client-win/ProgramLabel.xaml
deleted file mode 100644
index f6a6073..0000000
--- a/dtlauncher-client-win/ProgramLabel.xaml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dtlauncher-client-win/ProgramLabel.xaml.cs b/dtlauncher-client-win/ProgramLabel.xaml.cs
deleted file mode 100644
index a1cca9f..0000000
--- a/dtlauncher-client-win/ProgramLabel.xaml.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media.Imaging;
-using DTLib.Dtsod;
-
-namespace dtlauncher_client_win
-{
- ///
- /// Логика взаимодействия для ProgramLabel.xaml
- ///
- public partial class ProgramLabel : UserControl
- {
- public static DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ProgramLabel));
- public string Text
- {
- get => (string)GetValue(TextProperty);
- set => SetValue(TextProperty, value);
- }
-
- public static DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(BitmapImage), typeof(ProgramLabel));
- public BitmapImage Icon
- {
- get => (BitmapImage)GetValue(IconProperty);
- set => SetValue(IconProperty, value);
- }
-
- public static DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ProgramLabel));
- public CornerRadius CornerRadius
- {
- get => (CornerRadius)GetValue(CornerRadiusProperty);
- set => SetValue(CornerRadiusProperty, value);
- }
-
- public int Number;
- LauncherWindow Window;
- //public string background;
- //public string description;
- //public string installScript;
- //public string installDir;
- DtsodV21 descriptor;
- DtsodV21 launchinfo;
-
- public ProgramLabel() => InitializeComponent();
-
- public ProgramLabel(string descriptorFile, int number, LauncherWindow window)
- {
- try
- {
- InitializeComponent();
- Window = window;
- Number = number;
- descriptor = new(File.ReadAllText(descriptorFile));
- launchinfo = new(File.ReadAllText("launchinfo\\" + descriptor["id"]));
- FontSize = 14;
- Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
- Text = descriptor["name"];
- NameLabel.Content = descriptor["name"];
- IconImage.Source = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "\\icons\\" + descriptor["id"], UriKind.Absolute));
- //background = Directory.GetCurrentDirectory() + "\\descriptors\\" + descriptor["background"];
- //installScript = descriptor["script"];
- //installDir = descriptor["installdir"];
- //launchInfo = descriptor["LaunchInfo"];
- //description = descriptor["description"].Replace("\\n", "\n");
- //Window.Log(Text + " " + Icon + " " + Number);
- }
- catch (Exception ex)
- {
- string mes = $"ProgramLabel() error:\n{ex.Message}\n{ex.StackTrace}\n";
- MessageBox.Show(mes);
- Window.Log(mes);
- }
- }
-
- void ProgramShow(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- try
- {
- Window.programsArray[Window.PreviousProgramNum].Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
- Window.programsArray[Window.PreviousProgramNum].FontWeight = FontWeights.Normal;
- Window.programsArray[Window.PreviousProgramNum].FontSize = 14;
- Window.PreviousProgramNum = Number;
- Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(170, 170, 240));
- FontWeight = FontWeights.Bold;
- FontSize = 13;
- Window.NameLabel.Content = Text;
- Window.DescriptionBox.Text = descriptor["description"];
- Window.BackgroundImage.Source = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "\\backgrounds\\" + descriptor["id"], UriKind.Absolute));
- Window.Launch = () =>
- {
- switch (descriptor["id"])
- {
- case "anarx_1.12":
- Window.Install();
- Window.Log($"launching file <{launchinfo["launchfile"]}>\n");
- Process.Start(launchinfo["launchfile"]);
- break;
- default:
- Window.Log($"launching file <{launchinfo["launchfile"]}>\n");
- Process.Start(launchinfo["launchfile"]);
- break;
- }
- };
- Window.Install = () =>
- {
- Window.Log($"launching installation script <{descriptor["id"]}>\n");
- var scriptrunner = new DTScript.ScriptRunner
- {
- debug = false,
- mainSocket = Window.mainSocket
- };
- scriptrunner.RunScriptFile("installscripts\\" + descriptor["id"]);
- };
- }
- catch (Exception ex)
- {
- string mes = $"ProgramLabel.ProgramShow() error:\n{ex.Message}\n{ex.StackTrace}\n";
- MessageBox.Show(mes);
- Window.Log(mes);
- }
- }
- }
-}
diff --git a/dtlauncher-client-win/Properties/AssemblyInfo.cs b/dtlauncher-client-win/Properties/AssemblyInfo.cs
deleted file mode 100644
index bbd57be..0000000
--- a/dtlauncher-client-win/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// Общие сведения об этой сборке предоставляются следующим набором
-// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
-// связанные со сборкой.
-[assembly: AssemblyTitle("dtlauncher-client-win")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("dtlauncher-client-win")]
-[assembly: AssemblyCopyright("Copyright © 2021")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
-// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
-// из модели COM, установите атрибут ComVisible для этого типа в значение true.
-[assembly: ComVisible(false)]
-
-//Чтобы начать создание локализуемых приложений, задайте
-//CultureYouAreCodingWith в файле .csproj
-//в . Например, при использовании английского (США)
-//в своих исходных файлах установите в en-US. Затем отмените преобразование в комментарий
-//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
-//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
- //(используется, если ресурс не найден на странице,
- // или в словарях ресурсов приложения)
- ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
- //(используется, если ресурс не найден на странице,
- // в приложении или в каких-либо словарях ресурсов для конкретной темы)
-)]
-
-
-// Сведения о версии для сборки включают четыре следующих значения:
-//
-// Основной номер версии
-// Дополнительный номер версии
-// Номер сборки
-// Номер редакции
-//
-// Можно задать все значения или принять номера сборки и редакции по умолчанию
-// используя "*", как показано ниже:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dtlauncher-client-win/Properties/Resources.Designer.cs b/dtlauncher-client-win/Properties/Resources.Designer.cs
deleted file mode 100644
index 615ca67..0000000
--- a/dtlauncher-client-win/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// Этот код был создан программным средством.
-// Версия среды выполнения: 4.0.30319.42000
-//
-// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
-// код создан повторно.
-//
-//------------------------------------------------------------------------------
-
-
-namespace dtlauncher_client_win.Properties
-{
- ///
- /// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
- ///
- // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
- // класс с помощью таких средств, как ResGen или Visual Studio.
- // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
- // с параметром /str или заново постройте свой VS-проект.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dtlauncher_client_win.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Переопределяет свойство CurrentUICulture текущего потока для всех
- /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/dtlauncher-client-win/Properties/Resources.resx b/dtlauncher-client-win/Properties/Resources.resx
deleted file mode 100644
index af7dbeb..0000000
--- a/dtlauncher-client-win/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/dtlauncher-client-win/Properties/Settings.Designer.cs b/dtlauncher-client-win/Properties/Settings.Designer.cs
deleted file mode 100644
index 1c4561e..0000000
--- a/dtlauncher-client-win/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-
-namespace dtlauncher_client_win.Properties
-{
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/dtlauncher-client-win/Properties/Settings.settings b/dtlauncher-client-win/Properties/Settings.settings
deleted file mode 100644
index 033d7a5..0000000
--- a/dtlauncher-client-win/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dtlauncher-client-win/client.dtsod b/dtlauncher-client-win/client.dtsod
deleted file mode 100644
index b50a03d..0000000
--- a/dtlauncher-client-win/client.dtsod
+++ /dev/null
@@ -1,2 +0,0 @@
-server_domain: "m1net.keenetic.pro";
-server_port: 25001;
\ No newline at end of file
diff --git a/dtlauncher-client-win/dtlauncher-client-win.csproj b/dtlauncher-client-win/dtlauncher-client-win.csproj
deleted file mode 100644
index 65db21c..0000000
--- a/dtlauncher-client-win/dtlauncher-client-win.csproj
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
- 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/dtlauncher-client-win/logo-D.ico b/dtlauncher-client-win/logo-D.ico
deleted file mode 100644
index 9b68a7e..0000000
Binary files a/dtlauncher-client-win/logo-D.ico and /dev/null differ
diff --git a/dtlauncher-server-win/App.config b/dtlauncher-server-win/App.config
deleted file mode 100644
index 193aecc..0000000
--- a/dtlauncher-server-win/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dtlauncher-server-win/DtlauncherServer.cs b/dtlauncher-server-win/DtlauncherServer.cs
deleted file mode 100644
index 03f79e3..0000000
--- a/dtlauncher-server-win/DtlauncherServer.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.Threading;
-using DTLib;
-using DTLib.Dtsod;
-using DTLib.Filesystem;
-using DTLib.Network;
-using DTLib.Extensions;
-
-namespace dtlauncher_server
-{
- class DtlauncherServer
- {
- static readonly string logfile = $"logs\\dtlauncher-server-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
- static readonly Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- static DtsodV21 config;
- static DTLib.Loggers.DefaultLogger Info = new("logs", "dtlaunchet_server");
-
- //static readonly Dictionary users = new();
-
- static void Main()
- {
- try
- {
- Console.Title = "dtlauncher server";
- Console.InputEncoding = Encoding.Unicode;
- Console.OutputEncoding = Encoding.Unicode;
- PublicLog.LogEvent += Info.Log;
- PublicLog.LogNoTimeEvent += Info.Log;
- /*var outBuilder = new StringBuilder();
- string time = DateTime.Now.ToString().Replace(':', '-').Replace(' ', '_');
- foreach (var _file in Directory.GetFiles(@"D:\!dtlauncher-server\share\public\Conan_Exiles"))
- {
- var file = _file.Remove(0, 35);
- outBuilder.Append("Download(\"");
- outBuilder.Append(file);
- outBuilder.Append("\", \"downloads\\");
- outBuilder.Append(file);
- outBuilder.Append("\");\n");
- outBuilder.Append("Run(\"cmd\", \"/c unarc.exe x -dpinstalled downloads\\");
- outBuilder.Append(file);
- outBuilder.Append(" >> logs\\installation-Conan_Exiles-");
- outBuilder.Append(time);
- outBuilder.Append(".log\");\n");
- outBuilder.Append("FileDelete(\"downloads\\");
- outBuilder.Append(file);
- outBuilder.Append("\");\n");
- }
- Info.Log("c", "\n\n" + outBuilder.ToString() + "\n\n");*/
- config = config = new(File.ReadAllText("server.dtsod"));
- int f = (int)config["server_port"];
- Info.Log("b", "local address: <", "c", config["server_ip"], "b",
- ">\npublic address: <", "c", OldNetwork.GetPublicIP(), "b",
- ">\nport: <", "c", config["server_port"].ToString(), "b", ">\n");
- mainSocket.Bind(new IPEndPoint(IPAddress.Parse(config["server_ip"]), (int)config["server_port"]));
- mainSocket.Listen(1000);
- Info.Log("g", "server started succesfully\n");
- //
- /*DTLib.Timer userCkeckTimer = new(true, 3000, () =>
- {
- foreach (Socket usr in users.Keys)
- {
- if (usr.)
- {
- Info.Log("y", $"closing unused user <{usr.RemoteEndPoint.Serialize()[0]}> thread\n");
- users[usr].Abort();
- users.Remove(usr);
- }
- }
- });*/
- // запуск отдельного потока для каждого юзера
- while (true)
- {
- Socket userSocket = mainSocket.Accept();
- var userThread = new Thread(new ParameterizedThreadStart((obj) => UserHandle((Socket)obj)));
- //users.Add(userSocket, userThread);
- userThread.Start(userSocket);
- }
- }
- catch (Exception ex)
- {
- Info.Log("r", $"dtlauncher_server.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
- mainSocket.Close();
- }
- Info.Log("press any key to close... ");
- Console.ReadKey();
- Info.Log("gray", "\n");
- }
-
- // запускается для каждого юзера в отдельном потоке
- static void UserHandle(Socket handlerSocket)
- {
- Info.Log("b", "user connecting... ");
- //Socket fspSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- //fspSocket.Bind()
- FSP fsp = new(handlerSocket);
- try
- {
- handlerSocket.SendPackage("requesting hash".ToBytes());
- byte[] hash = handlerSocket.GetPackage();
- // запрос от апдейтера
- if (hash.HashToString() == "ffffffffffffffff")
- {
- Info.LogNoTime("c", "client is updater\n");
- CreateManifest("share\\client\\");
- Info.Log("g", "client files manifest created\n");
- handlerSocket.SendPackage("updater".ToBytes());
- while (true)
- {
- if (handlerSocket.Available >= 2)
- {
- string request = handlerSocket.GetPackage().BytesToString();
- string recieved, filepath;
- switch (request)
- {
- case "requesting file download":
- filepath = "share\\client\\" + handlerSocket.GetPackage().BytesToString();
- fsp.UploadFile(filepath);
- break;
- case "register new user":
- Info.Log("b", "new user registration requested\n");
- handlerSocket.SendPackage("ok".ToBytes());
- //filepath = handlerSocket.GetPackage().BytesToString();
- //if (!filePath.EndsWith(".req")) throw new Exception($"wrong registration request file: <{filepath}>");
- //Info.Log("b", $"downloading file registration_requests\\{filepath}\n");
- //handlerSocket.FSP_Download($"registration_requests\\{filepath}");
- recieved = handlerSocket.GetPackage().BytesToString();
- filepath = $"registration_requests\\{recieved.Remove(0, recieved.IndexOf(':') + 2)}.req";
- File.WriteAllText(filepath, recieved);
- Info.Log("b", $"text wrote to file <", "c", "registration_requests\\{filepath}", "b", ">\n");
- break;
- default:
- throw new Exception("unknown request: " + request);
- }
- }
- else Thread.Sleep(10);
- }
- }
- // запрос от лаунчера
- else
- {
- Info.LogNoTime("c", "client is launcher\n");
- string login;
- lock (new object())
- {
- login = OldFilework.ReadFromConfig("users.db", hash.HashToString());
- }
- handlerSocket.SendPackage("success".ToBytes());
- Info.Log("g", "user <", "c", login, "g", "> succesfully logined\n");
- while (true)
- {
- if (handlerSocket.Available >= 64)
- {
- string request = handlerSocket.GetPackage().BytesToString();
- switch (request)
- {
- // ответ на NetWork.Ping()
- /*case "ping":
- handlerSocket.Send("pong".ToBytes());
- break;*/
- // отправка списка активных серверов
- /*case "requesting servers list":
-
- break;*/
- case "requesting file download":
- fsp.UploadFile("share\\public\\" + handlerSocket.GetPackage().BytesToString());
- break;
- default:
- throw new Exception("unknown request: " + request);
- }
- }
- else Thread.Sleep(10);
- }
- }
- }
- catch (Exception ex)
- {
- Info.Log("y", $"UserStart() error:\n message:\n {ex.Message}\n{ex.StackTrace}\n");
- handlerSocket.Shutdown(SocketShutdown.Both);
- handlerSocket.Close();
- Thread.CurrentThread.Abort();
- }
- }
-
- // вычисляет и записывает в manifest.dtsod хеши файлов из files_list.dtsod
- public static void CreateManifest(string dir)
- {
- if (!dir.EndsWith("\\")) dir += "\\";
- List files = Directory.GetAllFiles(dir);
- if (files.Contains(dir + "manifest.dtsod")) files.Remove(dir + "manifest.dtsod");
- StringBuilder manifestBuilder = new();
- Hasher hasher = new();
- for (int i = 0; i < files.Count; i++)
- {
- files[i] = files[i].Remove(0, dir.Length);
- manifestBuilder.Append(files[i]);
- manifestBuilder.Append(": \"");
- byte[] hash = hasher.HashFile(dir + files[i]);
- manifestBuilder.Append(hash.HashToString());
- manifestBuilder.Append("\";\n");
- }
- File.WriteAllText(dir + "manifest.dtsod", manifestBuilder.ToString());
- }
- }
-}
diff --git a/dtlauncher-server-win/Properties/AssemblyInfo.cs b/dtlauncher-server-win/Properties/AssemblyInfo.cs
deleted file mode 100644
index 340af78..0000000
--- a/dtlauncher-server-win/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// Общие сведения об этой сборке предоставляются следующим набором
-// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
-// связанные со сборкой.
-[assembly: AssemblyTitle("dtlauncher-server-win")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("dtlauncher-server-win")]
-[assembly: AssemblyCopyright("Copyright © 2021")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
-// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
-// из модели COM, установите атрибут ComVisible для этого типа в значение true.
-[assembly: ComVisible(false)]
-
-//Чтобы начать создание локализуемых приложений, задайте
-//CultureYouAreCodingWith в файле .csproj
-//в . Например, при использовании английского (США)
-//в своих исходных файлах установите в en-US. Затем отмените преобразование в комментарий
-//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
-//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
- //(используется, если ресурс не найден на странице,
- // или в словарях ресурсов приложения)
- ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
- //(используется, если ресурс не найден на странице,
- // в приложении или в каких-либо словарях ресурсов для конкретной темы)
-)]
-
-
-// Сведения о версии для сборки включают четыре следующих значения:
-//
-// Основной номер версии
-// Дополнительный номер версии
-// Номер сборки
-// Номер редакции
-//
-// Можно задать все значения или принять номера сборки и редакции по умолчанию
-// используя "*", как показано ниже:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dtlauncher-server-win/Properties/Resources.Designer.cs b/dtlauncher-server-win/Properties/Resources.Designer.cs
deleted file mode 100644
index 9d42357..0000000
--- a/dtlauncher-server-win/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// Этот код был создан программным средством.
-// Версия среды выполнения: 4.0.30319.42000
-//
-// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
-// код создан повторно.
-//
-//------------------------------------------------------------------------------
-
-
-namespace dtlauncher_server_win.Properties
-{
- ///
- /// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
- ///
- // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
- // класс с помощью таких средств, как ResGen или Visual Studio.
- // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
- // с параметром /str или заново постройте свой VS-проект.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dtlauncher_server_win.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Переопределяет свойство CurrentUICulture текущего потока для всех
- /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/dtlauncher-server-win/Properties/Resources.resx b/dtlauncher-server-win/Properties/Resources.resx
deleted file mode 100644
index af7dbeb..0000000
--- a/dtlauncher-server-win/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/dtlauncher-server-win/Properties/Settings.Designer.cs b/dtlauncher-server-win/Properties/Settings.Designer.cs
deleted file mode 100644
index cb2dff3..0000000
--- a/dtlauncher-server-win/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-
-namespace dtlauncher_server_win.Properties
-{
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/dtlauncher-server-win/Properties/Settings.settings b/dtlauncher-server-win/Properties/Settings.settings
deleted file mode 100644
index 033d7a5..0000000
--- a/dtlauncher-server-win/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dtlauncher-server-win/dtlauncher-server-win.csproj b/dtlauncher-server-win/dtlauncher-server-win.csproj
deleted file mode 100644
index 4f0e977..0000000
--- a/dtlauncher-server-win/dtlauncher-server-win.csproj
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {8B9889A7-93DC-4914-92D1-8209BD3BA71A}
- Exe
- dtlauncher_server_win
- dtlauncher-server-win
- v4.8
- 9.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- AnyCPU
- none
- true
- bin\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- Always
-
-
-
-
-
-
-
- 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-server-win.exe.config
-
-
\ No newline at end of file
diff --git a/dtlauncher-server-win/server.dtsod b/dtlauncher-server-win/server.dtsod
deleted file mode 100644
index 8e75aa5..0000000
--- a/dtlauncher-server-win/server.dtsod
+++ /dev/null
@@ -1,2 +0,0 @@
-server_ip: "10.1.10.44";
-server_port: 25001;
\ No newline at end of file
diff --git a/dtlauncher.sln b/dtlauncher.sln
index da664fa..3dc48b7 100644
--- a/dtlauncher.sln
+++ b/dtlauncher.sln
@@ -1,49 +1,37 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.31815.197
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtlauncher-client-win", "dtlauncher-client-win\dtlauncher-client-win.csproj", "{367793EE-4757-4ADD-BF7E-960DC9EB6DF9}"
- ProjectSection(ProjectDependencies) = postProject
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB} = {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtlauncher-server-win", "dtlauncher-server-win\dtlauncher-server-win.csproj", "{8B9889A7-93DC-4914-92D1-8209BD3BA71A}"
- ProjectSection(ProjectDependencies) = postProject
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB} = {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "updater", "updater\updater.csproj", "{4784D974-A342-4202-9430-90FE5AC00FC7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtscript", "dtscript\dtscript.csproj", "{E02EA967-FD29-47D2-B25B-BA684B784AEE}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib", "..\DTLib\DTLib\DTLib.csproj", "{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sulution Files", "Sulution Files", "{09AA971D-CD70-4D93-BBA9-810C842830D8}"
- ProjectSection(SolutionItems) = preProject
- .gitignore = .gitignore
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Build|Any CPU = Build|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {367793EE-4757-4ADD-BF7E-960DC9EB6DF9}.Build|Any CPU.ActiveCfg = Build|Any CPU
- {367793EE-4757-4ADD-BF7E-960DC9EB6DF9}.Build|Any CPU.Build.0 = Build|Any CPU
- {8B9889A7-93DC-4914-92D1-8209BD3BA71A}.Build|Any CPU.ActiveCfg = Build|Any CPU
- {8B9889A7-93DC-4914-92D1-8209BD3BA71A}.Build|Any CPU.Build.0 = Build|Any CPU
- {4784D974-A342-4202-9430-90FE5AC00FC7}.Build|Any CPU.ActiveCfg = Build|Any CPU
- {4784D974-A342-4202-9430-90FE5AC00FC7}.Build|Any CPU.Build.0 = Build|Any CPU
- {E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.ActiveCfg = Build|Any CPU
- {E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.Build.0 = Build|Any CPU
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.ActiveCfg = Release-net48|Any CPU
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.Build.0 = Release-net48|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {E6569C0C-DD32-4F7D-AD4C-DBC5434D2F8C}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32104.313
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "launcher-server", "launcher-server\launcher-server.csproj", "{1F4D14EB-AF48-4B6C-A91B-B294D4281173}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "launcher-client-win", "launcher-client-win\launcher-client-win.csproj", "{A1F770F3-F6B1-4854-9BF0-093F85064B88}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib", "..\DTLib\DTLib\DTLib.csproj", "{04B926C4-E9E8-4BDB-90E6-5D34C9F738C4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1F4D14EB-AF48-4B6C-A91B-B294D4281173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F4D14EB-AF48-4B6C-A91B-B294D4281173}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F4D14EB-AF48-4B6C-A91B-B294D4281173}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F4D14EB-AF48-4B6C-A91B-B294D4281173}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A1F770F3-F6B1-4854-9BF0-093F85064B88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A1F770F3-F6B1-4854-9BF0-093F85064B88}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A1F770F3-F6B1-4854-9BF0-093F85064B88}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A1F770F3-F6B1-4854-9BF0-093F85064B88}.Release|Any CPU.Build.0 = Release|Any CPU
+ {04B926C4-E9E8-4BDB-90E6-5D34C9F738C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {04B926C4-E9E8-4BDB-90E6-5D34C9F738C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {04B926C4-E9E8-4BDB-90E6-5D34C9F738C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {04B926C4-E9E8-4BDB-90E6-5D34C9F738C4}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {96D7F599-27F9-420C-835D-FAF63EE78D0E}
+ EndGlobalSection
+EndGlobal
diff --git a/dtlauncher.sln.DotSettings.user b/dtlauncher.sln.DotSettings.user
new file mode 100644
index 0000000..f591ba1
--- /dev/null
+++ b/dtlauncher.sln.DotSettings.user
@@ -0,0 +1,2 @@
+
+ INFO
\ No newline at end of file
diff --git a/dtscript/App.config b/dtscript/App.config
deleted file mode 100644
index 4bfa005..0000000
--- a/dtscript/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/dtscript/MainClass.cs b/dtscript/MainClass.cs
deleted file mode 100644
index 609f0e7..0000000
--- a/dtscript/MainClass.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using DTLib;
-using DTLib.Filesystem;
-
-namespace DTScript;
-
-public class MainClass
-{
- static DTLib.Loggers.DefaultLogger Info = new("logs", "dtlaunchet_server");
-
- static void Main(string[] args)
- {
- try
- {
- Directory.Create("dtscript-logs");
- PublicLog.LogEvent += Info.Log;
- PublicLog.LogNoTimeEvent += Info.Log;
- var scripter = new ScriptRunner();
- if (args.Length == 0 || args.Length > 2) throw new Exception("enter script file path\n");
- else if (args.Length == 1) scripter.RunScriptFile(args[0]);
- else if (args.Length == 2 && args[0] == "-debug")
- {
- scripter.debug = true;
- scripter.Debug("y", "debug is enabled\n");
- scripter.RunScriptFile(args[1]);
- }
- else throw new Exception("unknown args\n");
- }
- catch (Exception ex)
- { Info.Log("r", $"dtscript.Main() error:\n{ex.Message}\n{ex.StackTrace}\n"); }
- Info.Log("gray", " \n");
- }
-}
diff --git a/dtscript/Properties/AssemblyInfo.cs b/dtscript/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2f86bb2..0000000
--- a/dtscript/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// Общие сведения об этой сборке предоставляются следующим набором
-// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
-// связанные с этой сборкой.
-[assembly: AssemblyTitle("dtscript")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("dtscript")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
-// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
-// из модели COM задайте для атрибута ComVisible этого типа значение true.
-[assembly: ComVisible(false)]
-
-// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
-[assembly: Guid("e02ea967-fd29-47d2-b25b-ba684b784aee")]
-
-// Сведения о версии сборки состоят из указанных ниже четырех значений:
-//
-// Основной номер версии
-// Дополнительный номер версии
-// Номер сборки
-// Номер редакции
-//
-// Можно задать все значения или принять номера сборки и редакции по умолчанию
-// используя "*", как показано ниже:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dtscript/ScriptRunner.cs b/dtscript/ScriptRunner.cs
deleted file mode 100644
index 8b4dacf..0000000
--- a/dtscript/ScriptRunner.cs
+++ /dev/null
@@ -1,465 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Net.Sockets;
-using System.Linq;
-using DTLib;
-using DTLib.Filesystem;
-using DTLib.Network;
-
-namespace DTScript;
-
-//
-// основной класс скриптового интерпретатора
-//
-public class ScriptRunner
-{
- // выводит текст через DTLib если дебаг включен
- public bool debug = false;
- public Socket mainSocket;
- public FSP fsp;
-
- internal void Debug(params string[] msg)
- {
- if (debug) PublicLog.Log(msg);
- }
-
- // cчитывание текста из файла и запуск выполнения
- public void RunScriptFile(string scriptfile)
- {
- Debug("g", @"----\ " + scriptfile + " /----\n");
- try { Execute(SplitScript(File.ReadAllText(scriptfile))); }
- catch (Exception e) { PublicLog.Log("r", $"dtscript RunScriptFile() error:\n{e.Message}\n{e.StackTrace}\n", "gray", " \n"); }
- }
-
- int globalindex = -1;
- List> Storage = new();
-
- object GetValue(string key)
- {
- Debug("m", "GetValue(", "c", "<", "b", key, "c", ">", "m", ")\n");
- for (int i = 0; i <= globalindex; i++)
- if (Storage[i].ContainsKey(key)) return Storage[i][key];
- throw new Exception($"GetValue() exception: storage doesn't contain key<{key}>");
- }
-
- void SetValue(string key, object value)
- {
- Debug("m", "SetValue(", "c", "<", "b", key, "c", "> ", "c", "<", "b", value.ToString(), "c", ">", "m", ")\n");
- for (int i = 0; i <= globalindex; i++)
- if (Storage[i].ContainsKey(key))
- {
- Storage[i][key] = value;
- Debug(Storage[i][key].ToString());
- return;
- }//throw new Exception($"SetValue() exception: storage alredy contains key<{key}>");
- Storage[globalindex].Add(key, value);
- }
-
- dynamic Execute(List script)
- {
- Debug("y", " executing...\n");
- // создание локального
- globalindex++;
- List subscript;
- Storage.Add(new Dictionary());
- // запуск цикла
- for (int index = 0; index < script.Count; index++)
- {
- if (debug)
- {
- PublicLog.Log(new string[] {
- "y","\noperator: ", "m",script[index].Operator, "y"," options: ", "c", "<", "b", script[index].Options[0], "c", ">"});
- for (ushort n = 1; n < script[index].Options.Length; n++)
- PublicLog.Log("w", ", ", "c", "<", "b", script[index].Options[n], "c", ">");
- PublicLog.Log("\n");
- }
- switch (script[index].Operator)
- {
- case "return":
- Debug("g", "script ended");
- return GetValue(script[index].Options[0]);
- case "Run":
- var proc = new Process();
- proc.StartInfo.FileName = script[index].Options[0].Replace("\"", "");
- proc.StartInfo.Arguments = script[index].Options[1].Replace("\"", "");
- /*if (script[index].Options.Length == 3 && script[index].Options[2] == "true")
- {
- proc.StartInfo.CreateNoWindow = true;
- Debug("g", $"process {script[index].Operator} started in hidden mode\n");
- }
- else if (script[index].Options.Length == 3 && script[index].Options[2] == "false")
- {
- proc.StartInfo.CreateNoWindow = false;
- Debug("g", $"process {script[index].Operator} started in not hidden mode\n");
- }
- else throw new Exception("invalid arguments in Run().\n it must be: Run(string exe_file, string arguments, true/false nowindow)\n");
- proc.StartInfo.UseShellExecute = false;*/
- proc.Start();
- proc.WaitForExit();
- proc.Close();
- break;
- case "Log":
- Debug("y", $"Log() has {script[index].Options.Length} args\n");
- PublicLog.Log(CalcString(script[index].Options.ToList()));
- break;
- case "ShowFiles":
- Debug("y", $"Log() has {script[index].Options.Length} args\n");
- foreach (string file in Directory.GetFiles(CalcString(script[index].Options.ToList())))
- PublicLog.Log(file + '\n');
- break;
- case "bool":
- if (script[index].Options.Length > 2 && script[index].Options[1] == "=")
- {
- List expr = new();
- for (ushort n = 2; n < script[index].Options.Length; n++)
- expr.Add(script[index].Options[n]);
- // сравнение и добавление результата в storage[globalindex]
- SetValue(script[index].Options[0], Compare(expr));
- Debug(new string[] {"y"," bool ","b", script[index].Options[0],
- "w", " = ", "c", GetValue(script[index].Options[0]).ToString() + '\n'});
- }
- else throw new Exception("error: incorrect bool defination\n");
- break;
- case "num":
- if (script[index].Options.Length > 2 && script[index].Options[1] == "=")
- {
- List expr = new();
- for (ushort n = 2; n < script[index].Options.Length; n++)
- {
- expr.Add(script[index].Options[n]);
- }
- SetValue(script[index].Options[0], (double)Calc(expr));
- Debug(new string[] {"y"," num ","b", script[index].Options[0],
- "w", " = ", "c", GetValue(script[index].Options[0]).ToString() + '\n'});
- }
- else throw new Exception("Execute() error: incorrect double defination\n");
- break;
- case "string":
- if (script[index].Options.Length > 2 && script[index].Options[1] == "=")
- {
- List expr = new();
- for (ushort n = 2; n < script[index].Options.Length; n++)
- {
- expr.Add(script[index].Options[n]);
- }
- SetValue(script[index].Options[0], CalcString(expr));
- Debug(new string[] {"y"," string ","b", script[index].Options[0],
- "w", " = ", "c", GetValue(script[index].Options[0]).ToString() + '\n'});
- }
- break;
- case "while":
- if (script[index + 1].Operator != "{") throw new Exception("Execute() error: expect { after for()");
- subscript = SplitScript(script[index + 1].Options[0]);
- while (Compare(script[index].Options.ToList()))
- {
- Execute(subscript);
- }
- index++;
- break;
- case "if":
- if (script[index + 1].Operator != "{") throw new Exception("Execute() error: expect { after for()");
- subscript = SplitScript(script[index + 1].Options[0]);
- if (Compare(script[index].Options.ToList()))
- {
- Execute(subscript);
- }
- index++;
- break;
- case "Download":
- if (fsp is null) fsp = new(mainSocket);
- fsp.DownloadFile(script[index].Options[0], script[index].Options[1]);
- break;
- case "DirDelete":
- Directory.Delete(script[index].Options[0]);
- break;
- case "FileDelete":
- File.Delete(script[index].Options[0]);
- break;
- case "FileWrite":
- File.Create(script[index].Options[0]);
- File.WriteAllText(script[index].Options[0], script[index].Options[1]);
- break;
- case "FileAppend":
- File.Create(script[index].Options[0]);
- File.AppendAllText(script[index].Options[0], script[index].Options[1]);
- break;
- default:
- throw new Exception($"Execute() error: invalid construct: {script[index].Operator}\n");
- }
- }
- Storage.RemoveAt(globalindex);
- globalindex--;
- return null;
-
- // операции со строками
- string CalcString(List expr)
- {
- Debug("m", "CalcString(");
- foreach (string part in expr)
- Debug("c", "<", "b", part, "c", ">");
- Debug("m", ")", "y", " started\n");
- // извлечение значений переменных
- for (ushort n = 0; n < expr.Count; n++)
- {
- switch (expr[n][0])
- {
- case '+':
- break;
- case '"':
- if (!expr[n].EndsWith("\"")) throw new Exception("Calc() error: invalid value <" + expr[n] + ">\n");
- break;
- default:
- expr[n] = GetValue(expr[n]).ToString();
- break;
- }
- }
- // вычисление
- string rezult = "";
- for (ushort i = 0; i < expr.Count; i++)
- {
-
- if (expr[i] == "+")
- {
- i++;
- rezult += expr[i];
- }
- else rezult = i == 0 ? expr[0] : throw new Exception($"error in Calc(): arg {expr[i]}\n");
- }
- if (rezult.Contains("\\n")) rezult = rezult.Replace("\\n", "\n");
- if (rezult.Contains("\"")) rezult = rezult.Replace("\"", "");
- Debug("y", " returns <", "b", $"{rezult}", "y", ">\n");
- return rezult;
- }
- // операции с числами
- double Calc(List expr)
- {
- Debug("m", "Calc(");
- foreach (string part in expr)
- Debug("c", "<", "b", part, "c", ">");
- Debug("m", ")", "y", " started\n");
- // извлечение значений переменных
- for (ushort n = 0; n < expr.Count; n++)
- {
- switch (expr[n][0])
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '+':
- case '-':
- case '*':
- case '/':
- break;
- default:
- expr[n] = GetValue(expr[n]).ToString();
- break;
- }
- }
- // вычисление
- double rezult = new();
- for (ushort i = 0; i < expr.Count; i++)
- switch (expr[i][0])
- {
- case '+':
- i++;
- rezult += Convert.ToDouble(expr[i]);
- break;
- case '-':
- i++;
- rezult -= Convert.ToDouble(expr[i]);
- break;
- case '*':
- i++;
- rezult *= Convert.ToDouble(expr[i]);
- break;
- case '/':
- i++;
- rezult /= Convert.ToDouble(expr[i]);
- break;
- default:
- if (i == 0) rezult += Convert.ToDouble(expr[i]);
- else throw new Exception($"error in Calc(): arg {expr[i]}\n");
- break;
- }
- Debug("y", " returns <", "b", $"{rezult}", "y", ">\n");
- return rezult;
- }
- // сравнение
- bool Compare(List expr)
- {
- Debug("m", "Compare(");
- foreach (string part in expr)
- Debug("c", "<", "b", part, "c", ">");
- Debug("m", ")", "y", " started\n");
- // вычисление значений правой и левой части неравенства
- char act = '\0';
- double rezult_0 = new(), rezult_1;
- var _expr = new List();
- for (ushort n = 0; n < expr.Count; n++)
- {
- Debug("m", $" <{expr[n]}>\n");
- switch (expr[n][0])
- {
- case '<':
- case '>':
- act = expr[n][0];
- rezult_0 = Calc(_expr);
- _expr.Clear();
- break;
- case '!':
- case '=':
- act = expr[n][0];
- rezult_0 = Calc(_expr);
- _expr.Clear();
- n++;
- break;
- default:
- _expr.Add(expr[n]);
- break;
- }
- }
- Debug("y", " rezult_0 = <", "b", rezult_0.ToString(), "y", ">\n");
- rezult_1 = Calc(_expr);
- Debug("y", " rezult_1 = <", "b", rezult_1.ToString(), "y", ">\n");
- Debug("y", " act = <", "b", act.ToString(), "y", ">\n");
- bool output = act switch
- {
- '<' => rezult_0 < rezult_1,
- '>' => rezult_0 > rezult_1,
- '!' => rezult_0 != rezult_1,
- '=' => rezult_0 == rezult_1,
- _ => throw new Exception($"error: incorrect comparsion symbol: <{act}>\n"),
- };
- Debug("y", " return <", "c", $"{output}", "y", ">\n");
- return output;
- }
- }
-
- List SplitScript(string text)
- {
- // лист для хранения обработанного текста
- List script = new();
- string construct = "";
- string option = "";
- List options = new();
- for (int index = 0; index < text.Length; index++)
- {
- switch (text[index])
- {
- // конец распознания конструкта
- case ';':
- Debug(text[index].ToString() + '\n');
- // добавление конструкта и его параметров в лист
- if (construct != "") script.Add(new Construction(construct, options));
- construct = "";
- option = "";
- options.Clear();
- break;
- // распознание параметров конструкта
- case '(':
- Debug(text[index].ToString());
- while (text[index] != ')')
- {
- index++;
- switch (text[index])
- {
- case '"':
- Debug("g", text[index].ToString());
- do
- {
- option += text[index];
- index++;
- Debug("g", text[index].ToString());
- } while (text[index] != '"');
- option += text[index];
- break;
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- break;
- case ')':
- case ',':
- Debug(text[index].ToString());
- options.Add(option);
- option = "";
- break;
- // математика
- case '+':
- case '-':
- case '*':
- case '/':
- case '!':
- case '=':
- Debug(text[index].ToString());
- if (option != "") options.Add(option);
- option = "";
- options.Add(text[index].ToString());
- break;
- default:
- option += text[index];
- Debug("c", text[index].ToString());
- break;
- }
- }
- if (debug && text[index + 1] == ';') PublicLog.Log("y", "\n " + options.Count + " options have read\n");
- break;
- // очистка конструкта от лишних символов
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- break;
- //
- case '{':
- Debug("SplitScript() found <{>");
- // добавление конструкта и его параметров в лист
- if (construct != "") script.Add(new Construction(construct, options));
- options.Clear();
- option = "";
- construct = "";
- index++;
- short bracketBalance = 1;
- while (bracketBalance != 0)
- {
- if (text[index] == '{') bracketBalance++;
- if (text[index] == '}') bracketBalance--;
- option += text[index];
- index++;
- }
- option.Remove(option.Length - 1);
- script.Add(new Construction("{", new List { option }));
- option = "";
- break;
- case '}':
- //throw new Exception($"SplitScript() error: unexpected '}}' on line {line}\n");
- break;
- default:
- construct += text[index];
- Debug("m", text[index].ToString());
- break;
- }
- }
- // возврат листа
- return script;
- }
-
- class Construction
- {
- public string Operator { get; private set; }
- public string[] Options { get; private set; }
- public Construction(string oper, List opts)
- {
- Operator = oper;
- Options = opts.ToArray();
- }
- }
-}
diff --git a/dtscript/dtscript.csproj b/dtscript/dtscript.csproj
deleted file mode 100644
index 1be41bd..0000000
--- a/dtscript/dtscript.csproj
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {E02EA967-FD29-47D2-B25B-BA684B784AEE}
- Exe
- dtscript
- dtscript
- v4.8
- 512
- true
- true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- AnyCPU
- none
- true
- bin\
- TRACE
- prompt
- 4
- true
- preview
-
-
- DTScript.MainClass
-
-
- dtscript.ico
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.7.2 %28x86 и x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
-
- {ce793497-2d5c-42d8-b311-e9b32af9cdfb}
- DTLib
-
-
-
-
- del /q /f dtscript.exe.config
-copy dtscript.exe ..\..\dtlauncher-server-win\bin\share\client\dtscript.exe
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dtscript/dtscript.ico b/dtscript/dtscript.ico
deleted file mode 100644
index df420bb..0000000
Binary files a/dtscript/dtscript.ico and /dev/null differ
diff --git a/dtscript/dtscript.sln b/dtscript/dtscript.sln
deleted file mode 100644
index 0f54d92..0000000
--- a/dtscript/dtscript.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30611.23
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtscript", "dtscript.csproj", "{E02EA967-FD29-47D2-B25B-BA684B784AEE}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib", "..\DTLib\DTLib.csproj", "{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- build|Any CPU = build|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E02EA967-FD29-47D2-B25B-BA684B784AEE}.build|Any CPU.ActiveCfg = build|Any CPU
- {E02EA967-FD29-47D2-B25B-BA684B784AEE}.build|Any CPU.Build.0 = build|Any CPU
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.build|Any CPU.ActiveCfg = Build|Any CPU
- {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.build|Any CPU.Build.0 = Build|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {A1D642E1-876E-4187-91D5-526827AE36A2}
- EndGlobalSection
-EndGlobal
diff --git a/dtscript/dtscript_doc.txt b/dtscript/dtscript_doc.txt
deleted file mode 100644
index 18d1f83..0000000
--- a/dtscript/dtscript_doc.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-Мне было лень изучать жабаскрып, потому всего за полгода я сделал вот этот dtscript (как выразился Абикак, "питоний джабаскрып").
-Синтаксис dtscript не завист от пробелов, табов, переносов строк. Конец одной конструкции определяется по символу ';' или '}' (если перед этим был символ '{')
-
-
-========================================[переменные]========================================
-
-объявление переменной и присвоение значения синтаксически никак не отличаются:
- тип(имя = значение);
-
-у переменных есть контекст:
- bool(h=false);
- if (...)
- {
- bool(j=true);
- Log("w", h); выведет true, так как есть доступ к переменным предыдущих уровней
- }
- Log("w", j); выдаст ошибку "KeyNotFoundException", так как вызывается с предшествующего объявлению переменной уровня
-
-┌────────┬────────────────┬───────────┬───────────────────┐
-│ тип │ аналог в c# │ операции │ пример │
-├────────┼────────────────┼───────────┼───────────────────┤
-│ bool │ System.Boolean │ <,>,==,!= │ bool(a=1<3); │
-├────────┼────────────────┼───────────┼───────────────────┤
-│ num │ System.Double │ +,-,*,/ │ num(a=9.6); │
-├────────┼────────────────┼───────────┼───────────────────┤
-│ string │ System.String │ + │ string(a="text"); │
-└────────┴────────────────┴───────────┴───────────────────┘
-
-
-==========================================[методы]==========================================
-
-Oбъявлять свои методы пока что нельзя, можно только использовать встроенные:
- метод; если нет параметров
- Метод(параметр0, параметр1...); параметрами могут быть значения и переменные, но не выражения
-
-┌────────────────────────────┬─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────┐
-│ метод │ аналог в с# │ шо делает │
-├────────────────────────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ pause │ System.Console.ReadKey() │ приостанавливает выполнение скрипта до нажатия клавиши │
-├────────────────────────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ break │ break │ прекращает выполнение уровня скрипта │
-├────────────────────────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ Log("w", "text", ...) │ DTLib.ColoredConsole.Write(params string[]) │ выводит в консоль цветной текст │
-├────────────────────────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ Run("файл.ехе","аргументы")│ System.Diagnostics.Process.Start(string) │ запускает прогу │
-├────────────────────────────┼─────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ Download("f0", "f1") │ DTLib.NetWork.FSP_Download(this Socket, string, string) │ скачивает файл по FSP протоколу │
-└────────────────────────────┴─────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────┘
-
-
-=========================================[операторы]========================================
-
-Параметром может быть переменная, но не выражение.
-
-while (bool)
-{
- ...
-}
-
-if (bool)
-{
- ...
-}
diff --git a/launcher-client-win/AssemblyInfo.cs b/launcher-client-win/AssemblyInfo.cs
new file mode 100644
index 0000000..3c50569
--- /dev/null
+++ b/launcher-client-win/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/dtlauncher-client-win/App.xaml b/launcher-client-win/GUI/App.xaml
similarity index 54%
rename from dtlauncher-client-win/App.xaml
rename to launcher-client-win/GUI/App.xaml
index 98da277..e7e28b1 100644
--- a/dtlauncher-client-win/App.xaml
+++ b/launcher-client-win/GUI/App.xaml
@@ -1,165 +1,188 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/launcher-client-win/GUI/App.xaml.cs b/launcher-client-win/GUI/App.xaml.cs
new file mode 100644
index 0000000..38fddc6
--- /dev/null
+++ b/launcher-client-win/GUI/App.xaml.cs
@@ -0,0 +1,19 @@
+namespace launcher_client_win;
+
+public partial class App : Application
+{
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ try
+ {
+ base.OnStartup(e);
+ _Main(e.Args);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"STARTUP ERROR:\n{ex}");
+ Shutdown();
+ }
+ }
+}
+
diff --git a/dtlauncher-client-win/LauncherWindow.xaml b/launcher-client-win/GUI/LauncherWindow.xaml
similarity index 95%
rename from dtlauncher-client-win/LauncherWindow.xaml
rename to launcher-client-win/GUI/LauncherWindow.xaml
index 94a2b39..e1946fd 100644
--- a/dtlauncher-client-win/LauncherWindow.xaml
+++ b/launcher-client-win/GUI/LauncherWindow.xaml
@@ -1,98 +1,98 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/launcher-client-win/GUI/LauncherWindow.xaml.cs b/launcher-client-win/GUI/LauncherWindow.xaml.cs
new file mode 100644
index 0000000..9ef1b5b
--- /dev/null
+++ b/launcher-client-win/GUI/LauncherWindow.xaml.cs
@@ -0,0 +1,9 @@
+namespace launcher_client_win.GUI;
+
+public partial class LauncherWindow : Window
+{
+ public LauncherWindow()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/launcher-client-win/Launcher.cs b/launcher-client-win/Launcher.cs
new file mode 100644
index 0000000..bf924ec
--- /dev/null
+++ b/launcher-client-win/Launcher.cs
@@ -0,0 +1,44 @@
+global using DTLib;
+global using DTLib.Dtsod;
+global using DTLib.Filesystem;
+global using DTLib.Network;
+global using DTLib.Extensions;
+global using System;
+global using System.Diagnostics;
+global using System.Net;
+global using System.Net.Sockets;
+global using System.Text;
+global using System.Collections.Generic;
+global using System.Threading;
+global using System.Linq;
+global using System.Windows;
+global using static launcher_client_win.Launcher;
+using System.Reflection;
+using launcher_client_win.GUI;
+
+namespace launcher_client_win;
+
+public static class Launcher
+{
+ public static LauncherConfig Config;
+ public static readonly LauncherLogger Logger = new();
+
+
+ public static void _Main(string[] args)
+ {
+ Logger.Enable();
+ Config = new LauncherConfig();
+ LauncherWindow launcherWindow = new();
+ MessageBox.Show("HELLO");
+ launcherWindow.Show();
+ }
+
+ public static string ReadResource(string resource_path)
+ {
+ using var resourceStreamReader = new System.IO.StreamReader(
+ Assembly.GetExecutingAssembly().GetManifestResourceStream(resource_path)
+ ?? throw new Exception($"embedded resource <{resource_path}> not found"),
+ Encoding.UTF8);
+ return resourceStreamReader.ReadToEnd();
+ }
+}
\ No newline at end of file
diff --git a/launcher-client-win/LauncherConfig.cs b/launcher-client-win/LauncherConfig.cs
new file mode 100644
index 0000000..aa0adb1
--- /dev/null
+++ b/launcher-client-win/LauncherConfig.cs
@@ -0,0 +1,74 @@
+namespace launcher_client_win;
+
+public class LauncherConfig
+{
+
+ public record struct Server(IPEndPoint EndPoint, string Domain)
+ {
+ public Server(string domain, int port) : this
+ (new IPEndPoint(Dns.GetHostAddresses(domain)[0], port), domain)
+ { }
+ public Server(IPAddress address, int port) : this
+ (new IPEndPoint(address, port), "")
+ { }
+ }
+
+ public const int Version=1;
+ public Server[] ServerAddresses;
+
+ const string configFile = "launcher.dtsod";
+ public LauncherConfig()
+ {
+ // читает дефолтный конфиг из ресурсов
+ DtsodV23 updatedDtsod = new(ReadResource("launcher_client_win.Resources.launcher.dtsod"));
+ // проверка и обновление конфига
+ if (File.Exists(configFile))
+ {
+ DtsodV23 dtsod = new(File.ReadAllText(configFile));
+ // заменяет дефолтные значения на пользовательские
+ foreach (var p in dtsod)
+ {
+ if (updatedDtsod.TryGetValue(p.Key, out dynamic def))
+ {
+ if (def.GetType() != p.Value.GetType())
+ throw new Exception(
+ "uncompatible config value type\n " +
+ $"launcher.dtsod: {p.Key}:{p.Value} is {p.Value.GetType().Name}, " +
+ $"must be {def.GetType().Name}");
+ updatedDtsod[p.Key] = p.Value;
+ }
+ }
+ // записывает обновлённый конфиг в файл
+ WriteToFile();
+ }
+
+ // парсит парсит полученный дтсод в LauncherConfig
+ List