part of client logic moved to new project
This commit is contained in:
parent
0eab3ba8f3
commit
89ddbc19d9
@ -7,31 +7,26 @@ public partial class LauncherWindow : Window
|
||||
{
|
||||
public LauncherWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.PointerPressed += (_,_)=>
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.PointerEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.PointerLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
DownloadsButton.TabGrid = DownloadsGrid;
|
||||
LogButton.TabGrid = LogGrid;
|
||||
SettingsButton.TabGrid = SettingsGrid;
|
||||
LibraryButton.Click += SelectTab;
|
||||
DownloadsButton.Click += SelectTab;
|
||||
LogButton.Click += SelectTab;
|
||||
SettingsButton.Click += SelectTab;
|
||||
ProgramGrid.IsVisible = false;
|
||||
SelectTab(LibraryButton, null);
|
||||
FillProgramsPanel();
|
||||
Logger.Log("launcher started");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("LAUNCHER WINDOW INIT",ex); }
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.PointerPressed += (_,_)=>
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.PointerEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.PointerLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
DownloadsButton.TabGrid = DownloadsGrid;
|
||||
LogButton.TabGrid = LogGrid;
|
||||
SettingsButton.TabGrid = SettingsGrid;
|
||||
LibraryButton.Click += SelectTab;
|
||||
DownloadsButton.Click += SelectTab;
|
||||
LogButton.Click += SelectTab;
|
||||
SettingsButton.Click += SelectTab;
|
||||
ProgramGrid.IsVisible = false;
|
||||
SelectTab(LibraryButton, null);
|
||||
FillProgramsPanel();
|
||||
Logger.Log("launcher started");
|
||||
}
|
||||
|
||||
void LogHandler(string m) => Dispatcher.UIThread.InvokeAsync(()=>LogBox.Text += m);
|
||||
@ -21,9 +21,16 @@
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.15" Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
|
||||
<ProjectReference Include="..\Launcher.Client\Launcher.Client.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\*" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -8,6 +8,8 @@ global using DTLib;
|
||||
global using DTLib.Dtsod;
|
||||
global using DTLib.Filesystem;
|
||||
global using DTLib.Extensions;
|
||||
global using Launcher.Client;
|
||||
global using static Launcher.Client.LauncherClient;
|
||||
global using static Launcher.Client.Avalonia.LauncherMain;
|
||||
using Launcher.Client.Avalonia.GUI;
|
||||
|
||||
@ -15,31 +17,24 @@ namespace Launcher.Client.Avalonia;
|
||||
|
||||
public static class LauncherMain
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
public static LauncherWindow CurrentLauncherWindow;
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp() =>
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace();
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Config = new LauncherConfig();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
Directory.Create("backgrounds");
|
||||
Directory.Create("installed");
|
||||
Directory.Create("settings");
|
||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||
EmbeddedResources.ReadText("Launcher.Client.Avalonia.Resources.default.descriptor.template"));
|
||||
LauncherClient.Init();
|
||||
|
||||
var traceHandler = new ConsoleTraceListener();
|
||||
Trace.AutoFlush = true;
|
||||
Trace.Listeners.Add(traceHandler);
|
||||
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
throw new Exception("aaa");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@ -21,7 +21,10 @@ public partial class App : Application
|
||||
_Main(e.Args);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("STARTUP",ex); }
|
||||
{
|
||||
LogError("STARTUP",ex);
|
||||
Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,31 +6,26 @@ public partial class LauncherWindow : Window
|
||||
{
|
||||
public LauncherWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.MouseLeftButtonDown += (_,_)=>
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.MouseEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.MouseLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
DownloadsButton.TabGrid = DownloadsGrid;
|
||||
LogButton.TabGrid = LogGrid;
|
||||
SettingsButton.TabGrid = SettingsGrid;
|
||||
LibraryButton.Click += SelectTab;
|
||||
DownloadsButton.Click += SelectTab;
|
||||
LogButton.Click += SelectTab;
|
||||
SettingsButton.Click += SelectTab;
|
||||
ProgramGrid.Visibility = Visibility.Hidden;
|
||||
SelectTab(LibraryButton, null);
|
||||
FillProgramsPanel();
|
||||
Logger.Log("launcher started");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("LAUNCHER WINDOW INIT",ex); }
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.MouseLeftButtonDown += (_,_)=>
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.MouseEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.MouseLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
DownloadsButton.TabGrid = DownloadsGrid;
|
||||
LogButton.TabGrid = LogGrid;
|
||||
SettingsButton.TabGrid = SettingsGrid;
|
||||
LibraryButton.Click += SelectTab;
|
||||
DownloadsButton.Click += SelectTab;
|
||||
LogButton.Click += SelectTab;
|
||||
SettingsButton.Click += SelectTab;
|
||||
ProgramGrid.Visibility = Visibility.Hidden;
|
||||
SelectTab(LibraryButton, null);
|
||||
FillProgramsPanel();
|
||||
Logger.Log("launcher started");
|
||||
}
|
||||
|
||||
void LogHandler(string m) => Dispatcher.Invoke(()=>LogBox.Text += m);
|
||||
@ -25,6 +25,7 @@
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
|
||||
<ProjectReference Include="..\Launcher.Client\Launcher.Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -9,27 +9,20 @@ global using System.Text;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Linq;
|
||||
global using System.Windows;
|
||||
global using static Launcher.Client.WPF.LauncherMain;
|
||||
global using Launcher.Client;
|
||||
global using static Launcher.Client.LauncherClient;
|
||||
global using static Launcher.Client.WPF.LauncherMain;
|
||||
using Launcher.Client.WPF.GUI;
|
||||
|
||||
namespace Launcher.Client.WPF;
|
||||
|
||||
public static class LauncherMain
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
public static LauncherWindow CurrentLauncherWindow;
|
||||
|
||||
public static void _Main(string[] args)
|
||||
{
|
||||
Config = new LauncherConfig();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
Directory.Create("backgrounds");
|
||||
Directory.Create("installed");
|
||||
Directory.Create("settings");
|
||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||
EmbeddedResources.ReadText("Launcher.Client.WPF.Resources.default.descriptor.template"));
|
||||
LauncherClient.Init();
|
||||
CurrentLauncherWindow = new LauncherWindow();
|
||||
CurrentLauncherWindow.Show();
|
||||
}
|
||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
24
Launcher.Client/Launcher.Client.csproj
Normal file
24
Launcher.Client/Launcher.Client.csproj
Normal file
@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<RootNamespace>Launcher.Client</RootNamespace>
|
||||
<DebugType>full</DebugType>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\default.descriptor.template" />
|
||||
<EmbeddedResource Include="Resources\launcher.dtsod" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
31
Launcher.Client/LauncherClient.cs
Normal file
31
Launcher.Client/LauncherClient.cs
Normal file
@ -0,0 +1,31 @@
|
||||
global using System;
|
||||
global using System.Diagnostics;
|
||||
global using System.Net;
|
||||
global using System.Text;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Linq;
|
||||
global using DTLib;
|
||||
global using DTLib.Dtsod;
|
||||
global using DTLib.Filesystem;
|
||||
global using DTLib.Extensions;
|
||||
|
||||
namespace Launcher.Client;
|
||||
|
||||
public static class LauncherClient
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
Logger.Log("launcher starting...");
|
||||
Config = new LauncherConfig();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
Directory.Create("backgrounds");
|
||||
Directory.Create("installed");
|
||||
Directory.Create("settings");
|
||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||
EmbeddedResources.ReadText("Launcher.Client.Resources.default.descriptor.template"));
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
namespace Launcher.Client.WPF;
|
||||
namespace Launcher.Client;
|
||||
|
||||
public class LauncherConfig
|
||||
{
|
||||
@ -21,7 +21,7 @@ public class LauncherConfig
|
||||
{
|
||||
// читает дефолтный конфиг из ресурсов
|
||||
DtsodV23 updatedConfig;
|
||||
DtsodV23 updatedDefault = new(EmbeddedResources.ReadText("Launcher.Client.WPF.Resources.launcher.dtsod"));
|
||||
DtsodV23 updatedDefault = new(EmbeddedResources.ReadText("Launcher.Client.Resources.launcher.dtsod"));
|
||||
// проверка и обновление конфига
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
@ -1,12 +1,11 @@
|
||||
using DTLib.Loggers;
|
||||
using DTLib.Logging;
|
||||
|
||||
namespace Launcher.Client.WPF;
|
||||
namespace Launcher.Client;
|
||||
|
||||
public class LauncherLogger : ConsoleLogger
|
||||
{
|
||||
public const string LogfileDir = "launcher-logs";
|
||||
public LauncherLogger() : base(LogfileDir,"launcher-client-wpf")
|
||||
{ }
|
||||
public LauncherLogger() : base(LogfileDir,"launcher-client") {}
|
||||
|
||||
private readonly StringBuilder _buffer = new();
|
||||
public string Buffer
|
||||
@ -10,6 +10,7 @@ global using System.Text;
|
||||
global using System.Threading;
|
||||
global using System.Linq;
|
||||
using System.Globalization;
|
||||
using DTLib.Logging;
|
||||
|
||||
namespace Launcher.Server;
|
||||
|
||||
@ -17,7 +18,7 @@ static class Server
|
||||
{
|
||||
static readonly Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
static DtsodV23 config;
|
||||
private static readonly DTLib.Loggers.ConsoleLogger Logger = new("logs", "launcher-server");
|
||||
private static readonly ConsoleLogger Logger = new("logs", "launcher-server");
|
||||
|
||||
static readonly object manifestLocker = new();
|
||||
|
||||
@ -29,7 +30,6 @@ static class Server
|
||||
Console.InputEncoding = Encoding.Unicode;
|
||||
Console.OutputEncoding = Encoding.Unicode;
|
||||
PublicLog.LogEvent += Logger.Log;
|
||||
PublicLog.LogNoTimeEvent += Logger.Log;
|
||||
config = new DtsodV23(File.ReadAllText("launcher-server.dtsod"));
|
||||
Logger.Log("b", "local address: <", "c", config["local_ip"], "b",
|
||||
">\npublic address: <", "c", OldNetwork.GetPublicIP(), "b",
|
||||
@ -3,9 +3,9 @@ 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}"
|
||||
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-wpf", "launcher-client-wpf\launcher-client-wpf.csproj", "{A1F770F3-F6B1-4854-9BF0-093F85064B88}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher.Client.WPF", "Launcher.Client.WPF\Launcher.Client.WPF.csproj", "{A1F770F3-F6B1-4854-9BF0-093F85064B88}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{F567AA49-E96B-43BD-95B5-A71F9FCB64E1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@ -13,7 +13,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "launcher-client-avalonia", "launcher-client-avalonia\launcher-client-avalonia.csproj", "{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher.Client.Avalonia", "Launcher.Client.Avalonia\Launcher.Client.Avalonia.csproj", "{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher.Client", "Launcher.Client\Launcher.Client.csproj", "{87427137-840D-4D09-A101-9481110682BD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{87427137-840D-4D09-A101-9481110682BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{87427137-840D-4D09-A101-9481110682BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{87427137-840D-4D09-A101-9481110682BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{87427137-840D-4D09-A101-9481110682BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
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 updatedConfig;
|
||||
DtsodV23 updatedDefault = new(EmbeddedResources.ReadText("Launcher.Client.Avalonia.Resources.launcher.dtsod"));
|
||||
// проверка и обновление конфига
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
DtsodV23 oldConfig = new(File.ReadAllText(configFile));
|
||||
updatedConfig = DtsodConverter.UpdateByDefault(oldConfig, updatedDefault);
|
||||
}
|
||||
else updatedConfig = updatedDefault;
|
||||
|
||||
// парсит парсит полученный дтсод в LauncherConfig
|
||||
List<object> serversD = updatedConfig["server"];
|
||||
ServerAddresses = new Server[serversD.Count];
|
||||
ushort i = 0;
|
||||
foreach (DtsodV23 serverD in serversD)
|
||||
{
|
||||
int port = serverD["port"];
|
||||
// server must have <domain> or <ip> property
|
||||
ServerAddresses[i++] = serverD.TryGetValue("domain", out dynamic dom)
|
||||
? new Server(dom, port)
|
||||
: new Server(IPAddress.Parse(serverD["ip"]), port);
|
||||
}
|
||||
|
||||
WriteToFile();
|
||||
}
|
||||
|
||||
// записывает обновлённый конфиг в файл
|
||||
public void WriteToFile()
|
||||
{
|
||||
StringBuilder b = new();
|
||||
b.Append("version: ").Append(Version).Append(";\n");
|
||||
foreach (var server in ServerAddresses)
|
||||
{
|
||||
b.Append("$server: {\n\t");
|
||||
if (server.Domain == "")
|
||||
b.Append("ip: \"").Append(server.EndPoint.Address);
|
||||
else b.Append("domain: \"").Append(server.Domain);
|
||||
b.Append("\";\n\tport: ")
|
||||
.Append(server.EndPoint.Port)
|
||||
.Append(";\n};\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
using DTLib.Loggers;
|
||||
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
public class LauncherLogger : ConsoleLogger
|
||||
{
|
||||
public const string LogfileDir = "launcher-logs";
|
||||
public LauncherLogger() : base(LogfileDir,"launcher-client-wpf")
|
||||
{ }
|
||||
|
||||
private readonly StringBuilder _buffer = new();
|
||||
public string Buffer
|
||||
{
|
||||
get { lock (_buffer) return _buffer.ToString(); }
|
||||
}
|
||||
|
||||
public event Action<string> MessageSent;
|
||||
|
||||
public override void Log(params string[] msg)
|
||||
{
|
||||
base.Log(msg);
|
||||
StringBuilder strb = new();
|
||||
if (msg.Length == 1) strb.Append(msg[0]);
|
||||
else for (int i = 1; i < msg.Length; i += 2)
|
||||
strb.Append(msg[i]);
|
||||
strb.Append('\n');
|
||||
string msgConnected = strb.ToString();
|
||||
MessageSent?.Invoke(msgConnected);
|
||||
lock (_buffer) _buffer.Append(msgConnected);
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
[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)
|
||||
)]
|
||||
@ -1,6 +0,0 @@
|
||||
name: ""; #label, which displays in launcher
|
||||
directory: ""; #name of program' directory on server and client
|
||||
description: ""; #desctiption, which displays in launcher
|
||||
icon: ""; #name of the icon file
|
||||
background: ""; #name of the background file
|
||||
launchcommand: ""; #command, which starts the program
|
||||
@ -1,6 +0,0 @@
|
||||
version: 1;
|
||||
|
||||
$server: {
|
||||
ip: "127.0.0.1";
|
||||
port: 25000;
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user