From 8deb7557e7475d39e83229fdffa42bb6c0b00ef4 Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Sun, 13 Mar 2022 22:56:45 +0300 Subject: [PATCH] started rewriting launcher --- .gitignore | 361 +------------- DTLib | 1 + dtlauncher-client-win/App.config | 6 - dtlauncher-client-win/App.xaml.cs | 35 -- dtlauncher-client-win/LauncherWindow.xaml.cs | 118 ----- dtlauncher-client-win/LoginWindow.xaml | 51 -- dtlauncher-client-win/LoginWindow.xaml.cs | 158 ------ dtlauncher-client-win/ProgramLabel.xaml | 33 -- dtlauncher-client-win/ProgramLabel.xaml.cs | 125 ----- .../Properties/AssemblyInfo.cs | 53 -- .../Properties/Resources.Designer.cs | 70 --- .../Properties/Resources.resx | 117 ----- .../Properties/Settings.Designer.cs | 29 -- .../Properties/Settings.settings | 7 - dtlauncher-client-win/client.dtsod | 2 - .../dtlauncher-client-win.csproj | 131 ----- dtlauncher-client-win/logo-D.ico | Bin 38078 -> 0 bytes dtlauncher-server-win/App.config | 6 - dtlauncher-server-win/DtlauncherServer.cs | 208 -------- .../Properties/AssemblyInfo.cs | 53 -- .../Properties/Resources.Designer.cs | 70 --- .../Properties/Resources.resx | 117 ----- .../Properties/Settings.Designer.cs | 29 -- .../Properties/Settings.settings | 7 - .../dtlauncher-server-win.csproj | 115 ----- dtlauncher-server-win/server.dtsod | 2 - dtlauncher.sln | 86 ++-- dtlauncher.sln.DotSettings.user | 2 + dtscript/App.config | 6 - dtscript/MainClass.cs | 33 -- dtscript/Properties/AssemblyInfo.cs | 35 -- dtscript/ScriptRunner.cs | 465 ------------------ dtscript/dtscript.csproj | 98 ---- dtscript/dtscript.ico | Bin 9662 -> 0 bytes dtscript/dtscript.sln | 26 - dtscript/dtscript_doc.txt | 63 --- launcher-client-win/AssemblyInfo.cs | 10 + .../GUI}/App.xaml | 353 ++++++------- launcher-client-win/GUI/App.xaml.cs | 19 + .../GUI}/LauncherWindow.xaml | 196 ++++---- .../GUI/LauncherWindow.xaml.cs | 9 + launcher-client-win/Launcher.cs | 44 ++ launcher-client-win/LauncherConfig.cs | 74 +++ launcher-client-win/LauncherLogger.cs | 36 ++ launcher-client-win/Resources/launcher.dtsod | 6 + .../launcher-client-win.csproj | 28 ++ launcher-server/Server.cs | 205 ++++++++ launcher-server/launcher-server.csproj | 22 + launcher-server/launcher-server.dtsod | 2 + updater/App.config | 6 - updater/Properties/AssemblyInfo.cs | 35 -- updater/Updater.cs | 98 ---- updater/logo-D.ico | Bin 38078 -> 0 bytes updater/updater.csproj | 94 ---- 54 files changed, 789 insertions(+), 3166 deletions(-) create mode 120000 DTLib delete mode 100644 dtlauncher-client-win/App.config delete mode 100644 dtlauncher-client-win/App.xaml.cs delete mode 100644 dtlauncher-client-win/LauncherWindow.xaml.cs delete mode 100644 dtlauncher-client-win/LoginWindow.xaml delete mode 100644 dtlauncher-client-win/LoginWindow.xaml.cs delete mode 100644 dtlauncher-client-win/ProgramLabel.xaml delete mode 100644 dtlauncher-client-win/ProgramLabel.xaml.cs delete mode 100644 dtlauncher-client-win/Properties/AssemblyInfo.cs delete mode 100644 dtlauncher-client-win/Properties/Resources.Designer.cs delete mode 100644 dtlauncher-client-win/Properties/Resources.resx delete mode 100644 dtlauncher-client-win/Properties/Settings.Designer.cs delete mode 100644 dtlauncher-client-win/Properties/Settings.settings delete mode 100644 dtlauncher-client-win/client.dtsod delete mode 100644 dtlauncher-client-win/dtlauncher-client-win.csproj delete mode 100644 dtlauncher-client-win/logo-D.ico delete mode 100644 dtlauncher-server-win/App.config delete mode 100644 dtlauncher-server-win/DtlauncherServer.cs delete mode 100644 dtlauncher-server-win/Properties/AssemblyInfo.cs delete mode 100644 dtlauncher-server-win/Properties/Resources.Designer.cs delete mode 100644 dtlauncher-server-win/Properties/Resources.resx delete mode 100644 dtlauncher-server-win/Properties/Settings.Designer.cs delete mode 100644 dtlauncher-server-win/Properties/Settings.settings delete mode 100644 dtlauncher-server-win/dtlauncher-server-win.csproj delete mode 100644 dtlauncher-server-win/server.dtsod create mode 100644 dtlauncher.sln.DotSettings.user delete mode 100644 dtscript/App.config delete mode 100644 dtscript/MainClass.cs delete mode 100644 dtscript/Properties/AssemblyInfo.cs delete mode 100644 dtscript/ScriptRunner.cs delete mode 100644 dtscript/dtscript.csproj delete mode 100644 dtscript/dtscript.ico delete mode 100644 dtscript/dtscript.sln delete mode 100644 dtscript/dtscript_doc.txt create mode 100644 launcher-client-win/AssemblyInfo.cs rename {dtlauncher-client-win => launcher-client-win/GUI}/App.xaml (54%) create mode 100644 launcher-client-win/GUI/App.xaml.cs rename {dtlauncher-client-win => launcher-client-win/GUI}/LauncherWindow.xaml (95%) create mode 100644 launcher-client-win/GUI/LauncherWindow.xaml.cs create mode 100644 launcher-client-win/Launcher.cs create mode 100644 launcher-client-win/LauncherConfig.cs create mode 100644 launcher-client-win/LauncherLogger.cs create mode 100644 launcher-client-win/Resources/launcher.dtsod create mode 100644 launcher-client-win/launcher-client-win.csproj create mode 100644 launcher-server/Server.cs create mode 100644 launcher-server/launcher-server.csproj create mode 100644 launcher-server/launcher-server.dtsod delete mode 100644 updater/App.config delete mode 100644 updater/Properties/AssemblyInfo.cs delete mode 100644 updater/Updater.cs delete mode 100644 updater/logo-D.ico delete mode 100644 updater/updater.csproj 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 @@ - - - - - - - - - - - - - - - - - -