trying to fix avalonia
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Application x:Class="launcher_client_avalonia.GUI.App"
|
||||
<Application x:Class="Launcher.Client.Avalonia.GUI.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
@@ -12,13 +12,13 @@
|
||||
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
||||
<SolidColorBrush x:Key="MySelectionColor" Color="#B7800A" />
|
||||
</Application.Resources>
|
||||
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Dark" />
|
||||
|
||||
<Style x:Name="MyTextBoxStyle" Selector="TextBox.MyTextBoxStyle"/>
|
||||
<Style x:Name="MyLabelStyle" Selector="Label.MyLabelStyle"/>
|
||||
<Style x:Name="MyButtonStyle" Selector="Button.MyButtonStyle"/>
|
||||
|
||||
|
||||
<Style Selector="TextBox.MyTextBoxStyle" />
|
||||
<Style Selector="Label.MyLabelStyle" />
|
||||
<Style Selector="Button.MyButtonStyle" />
|
||||
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
|
||||
@@ -3,8 +3,9 @@ global using Avalonia.Controls;
|
||||
global using Avalonia.Media;
|
||||
global using Avalonia.Media.Imaging;
|
||||
global using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
|
||||
namespace launcher_client_avalonia
|
||||
namespace Launcher.Client.Avalonia.GUI
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
@@ -20,5 +21,18 @@ namespace launcher_client_avalonia
|
||||
MyOrange = (SolidColorBrush)Resources["MySelectionColor"];
|
||||
MySelectionColor = (SolidColorBrush)Resources["MySelectionColor"];
|
||||
}
|
||||
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
CurrentLauncherWindow = new LauncherWindow();
|
||||
desktop.MainWindow = CurrentLauncherWindow;
|
||||
CurrentLauncherWindow.Show();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Window x:Class="launcher_client_avalonia.GUI.LauncherWindow"
|
||||
<Window x:Class="Launcher.Client.Avalonia.GUI.LauncherWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:launcher_client_avalonia.GUI"
|
||||
xmlns:local="clr-namespace:Launcher.Client.Avalonia.GUI"
|
||||
Title="Launcher"
|
||||
Width="800"
|
||||
Height="500"
|
||||
@@ -21,24 +21,24 @@
|
||||
ColumnDefinitions="*,5,*,5,*,5,*">
|
||||
<local:TabButton x:Name="LibraryButton"
|
||||
Grid.Column="0"
|
||||
Classes="MyButtonStyle"
|
||||
Content="Library"
|
||||
FontSize="18"
|
||||
Classes="MyButtonStyle" />
|
||||
FontSize="18" />
|
||||
<local:TabButton x:Name="DownloadsButton"
|
||||
Grid.Column="2"
|
||||
Classes="MyButtonStyle"
|
||||
Content="Downloads"
|
||||
FontSize="18"
|
||||
Classes="MyButtonStyle" />
|
||||
FontSize="18" />
|
||||
<local:TabButton x:Name="LogButton"
|
||||
Grid.Column="4"
|
||||
Classes="MyButtonStyle"
|
||||
Content="Log"
|
||||
FontSize="18"
|
||||
Classes="MyButtonStyle" />
|
||||
FontSize="18" />
|
||||
<local:TabButton x:Name="SettingsButton"
|
||||
Grid.Column="6"
|
||||
Classes="MyButtonStyle"
|
||||
Content="Settings"
|
||||
FontSize="18"
|
||||
Classes="MyButtonStyle" />
|
||||
FontSize="18" />
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
<ScrollViewer Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
Template="{DynamicResource myScrollViewer}">
|
||||
Template="{DynamicResource myScrollViewer}"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel x:Name="ProgramsPanel" />
|
||||
</ScrollViewer>
|
||||
<Grid x:Name="ProgramGrid"
|
||||
@@ -59,10 +59,10 @@
|
||||
RowDefinitions="35,5,35,5,70,5,*">
|
||||
<Label x:Name="NameLabel"
|
||||
Grid.Row="0"
|
||||
Classes="MyLabelStyle"
|
||||
Content="name"
|
||||
FontSize="19"
|
||||
FontWeight="Bold"
|
||||
Classes="MyLabelStyle" />
|
||||
FontWeight="Bold" />
|
||||
<StackPanel Grid.Row="2"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="True"
|
||||
@@ -71,33 +71,33 @@
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Background="{DynamicResource MyRed}"
|
||||
Content="Remove"
|
||||
Classes="MyButtonStyle" />
|
||||
Classes="MyButtonStyle"
|
||||
Content="Remove" />
|
||||
<Button x:Name="InstallButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Install"
|
||||
Classes="MyButtonStyle" />
|
||||
Classes="MyButtonStyle"
|
||||
Content="Install" />
|
||||
<Button x:Name="UpdateButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Update"
|
||||
Classes="MyButtonStyle" />
|
||||
Classes="MyButtonStyle"
|
||||
Content="Update" />
|
||||
<Button x:Name="LaunchButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Background="{DynamicResource MyGreen}"
|
||||
Content="Launch"
|
||||
Classes="MyButtonStyle" />
|
||||
Classes="MyButtonStyle"
|
||||
Content="Launch" />
|
||||
</StackPanel>
|
||||
<TextBox x:Name="DescriptionBox"
|
||||
Grid.Row="4"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
Classes="MyTextBoxStyle" />
|
||||
Classes="MyTextBoxStyle"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
<TextBox x:Name="ProgramLogBox"
|
||||
Grid.Row="6"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
Classes="MyTextBoxStyle" />
|
||||
Classes="MyTextBoxStyle"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="0"
|
||||
Grid.Column="4"
|
||||
@@ -108,36 +108,36 @@
|
||||
|
||||
<Label Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Content="version:"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="version:" />
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
Template="{DynamicResource MyComboBox}">
|
||||
<ComboBoxItem IsSelected="True">
|
||||
<Label Background="Transparent"
|
||||
Content="v1"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="v1" />
|
||||
</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Content="directory:"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="directory:" />
|
||||
<Label Name="ProgramDirectoryLabel"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Content="0"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="0" />
|
||||
<Label Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Content="size:"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="size:" />
|
||||
<Label Name="ProgramSizeLabel"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Content="0"
|
||||
Classes="MyLabelStyle" />
|
||||
Classes="MyLabelStyle"
|
||||
Content="0" />
|
||||
</Grid>
|
||||
<ScrollViewer Name="ProgramSettingsViever"
|
||||
Grid.Row="1"
|
||||
@@ -162,14 +162,14 @@
|
||||
<Label x:Name="LogfileLabel"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Classes="MyLabelStyle"
|
||||
Content="logfile"
|
||||
FontStyle="Italic"
|
||||
Classes="MyLabelStyle" />
|
||||
FontStyle="Italic" />
|
||||
<TextBox x:Name="LogBox"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
Classes="MyTextBoxStyle" />
|
||||
Classes="MyTextBoxStyle"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="SettingsGrid"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace launcher_client_avalonia.GUI;
|
||||
namespace Launcher.Client.Avalonia.GUI;
|
||||
|
||||
public partial class LauncherWindow : Window
|
||||
{
|
||||
@@ -9,12 +9,12 @@ public partial class LauncherWindow : Window
|
||||
{
|
||||
try
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.PointerPressed += (_,_)=>
|
||||
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Путь.Разд)));
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.PointerEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.PointerLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="launcher_client_avalonia.GUI.MessageBox"
|
||||
<Window x:Class="Launcher.Client.Avalonia.GUI.MessageBox"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace launcher_client_avalonia.GUI;
|
||||
namespace Launcher.Client.Avalonia.GUI;
|
||||
|
||||
public partial class MessageBox : Window
|
||||
{
|
||||
public MessageBox()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<UserControl x:Class="launcher_client_avalonia.GUI.ProgramLabel"
|
||||
<UserControl x:Class="Launcher.Client.Avalonia.GUI.ProgramLabel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:launcher_client_avalonia.GUI"
|
||||
xmlns:local="clr-namespace:Launcher.Client.Avalonia.GUI"
|
||||
Height="50"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource Self}}"
|
||||
@@ -9,7 +9,7 @@
|
||||
Foreground="{DynamicResource MyWhite}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Height, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||
<ColumnDefinition Width="{Binding $parent[local:ProgramLabel].Height}" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
FontFamily="Unispace"
|
||||
FontSize="15"
|
||||
FontWeight="Normal"
|
||||
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||
Foreground="{Binding $parent[local:ProgramLabel].Foreground}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
namespace launcher_client_avalonia.GUI;
|
||||
namespace Launcher.Client.Avalonia.GUI;
|
||||
|
||||
public partial class ProgramLabel : UserControl
|
||||
{
|
||||
public ProgramLabel() => InitializeComponent();
|
||||
|
||||
public ProgramLabel(string label, string icon)
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
InitializeComponent();
|
||||
NameLabel.Content = label;
|
||||
|
||||
IconImage.Source = new Bitmap(
|
||||
$"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}");
|
||||
}
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<UserControl x:Class="launcher_client_avalonia.GUI.ProgramSettingsPanelItem"
|
||||
<UserControl x:Class="Launcher.Client.Avalonia.GUI.ProgramSettingsPanelItem"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:launcher_client_avalonia.GUI"
|
||||
xmlns:local="clr-namespace:Launcher.Client.Avalonia.GUI"
|
||||
Background="Transparent">
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<Label Name="KeyLabel"
|
||||
Grid.Column="0"
|
||||
Classes="MyLabelStyle"
|
||||
Content="{Binding $parent[local:ProgramSettingsPanelItem].SettingKey}"
|
||||
FontFamily="default"
|
||||
FontSize="16"
|
||||
Classes="MyLabelStyle"
|
||||
ToolTip.Tip="{Binding $self.Content}">
|
||||
</Label>
|
||||
ToolTip.Tip="{Binding $self.Content}" />
|
||||
<TextBox Name="ValueBox"
|
||||
Grid.Column="1"
|
||||
Classes="MyTextBoxStyle"
|
||||
IsReadOnly="False"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||
Classes="MyTextBoxStyle"
|
||||
Text="{Binding $parent[local:ProgramSettingsPanelItem].SettingValue}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace launcher_client_avalonia.GUI;
|
||||
namespace Launcher.Client.Avalonia.GUI;
|
||||
|
||||
public partial class ProgramSettingsPanelItem : UserControl
|
||||
{
|
||||
@@ -7,32 +7,32 @@ public partial class ProgramSettingsPanelItem : UserControl
|
||||
"SettingKey");
|
||||
public string SettingKey
|
||||
{
|
||||
get => (string)GetValue(SettingKeyProp);
|
||||
set
|
||||
{
|
||||
SetValue(SettingKeyProp, value);
|
||||
/*KeyLabel.ToolTip = new ToolTip
|
||||
get => GetValue(SettingKeyProp);
|
||||
set => SetValue(SettingKeyProp, value);
|
||||
//TODO deal with textblock size
|
||||
/*KeyLabel.ToolTip = new ToolTip
|
||||
{
|
||||
Content = value,
|
||||
Foreground = App.MyWhite,
|
||||
Background = App.MySoftDark
|
||||
};*/
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> SettingValueProp =
|
||||
AvaloniaProperty.Register<ProgramSettingsPanelItem, string>("SettingValue");
|
||||
public string SettingValue
|
||||
{
|
||||
get => (string)GetValue(SettingValueProp);
|
||||
get => GetValue(SettingValueProp);
|
||||
set => SetValue(SettingValueProp, value);
|
||||
}
|
||||
|
||||
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
|
||||
|
||||
public ProgramSettingsPanelItem() => InitializeComponent();
|
||||
|
||||
public ProgramSettingsPanelItem(string key, string value)
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
InitializeComponent();
|
||||
SettingKey = key;
|
||||
SettingValue = value;
|
||||
//TODO invoke UpdatedEvent only when focus changed
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
namespace launcher_client_avalonia.GUI;
|
||||
namespace Launcher.Client.Avalonia.GUI;
|
||||
|
||||
public partial class TabButton : Button
|
||||
public class TabButton : Button
|
||||
{
|
||||
public static readonly StyledProperty<Grid> TabGridProp = AvaloniaProperty.Register<TabButton, Grid>("TabGrid");
|
||||
public Grid TabGrid
|
||||
{
|
||||
get => (Grid)GetValue(TabGridProp);
|
||||
get => GetValue(TabGridProp);
|
||||
set => SetValue(TabGridProp, value);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace launcher_client_avalonia;
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
public class LauncherConfig
|
||||
{
|
||||
@@ -21,7 +21,7 @@ public class LauncherConfig
|
||||
{
|
||||
// читает дефолтный конфиг из ресурсов
|
||||
DtsodV23 updatedConfig;
|
||||
DtsodV23 updatedDefault = new(ReadResource("launcher_client_avalonia.Resources.launcher.dtsod"));
|
||||
DtsodV23 updatedDefault = new(EmbeddedResources.ReadText("Launcher.Client.Avalonia.Resources.launcher.dtsod"));
|
||||
// проверка и обновление конфига
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
using System.Globalization;
|
||||
using DTLib.Loggers;
|
||||
using DTLib.Loggers;
|
||||
|
||||
namespace launcher_client_avalonia;
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
public class LauncherLogger : BaseLogger
|
||||
public class LauncherLogger : ConsoleLogger
|
||||
{
|
||||
public string Buffer="";
|
||||
|
||||
public LauncherLogger() : base("launcher-logs", "launcher-client-win")
|
||||
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)
|
||||
{
|
||||
lock (Logfile) if (!IsEnabled) return;
|
||||
|
||||
StringBuilder strB = new();
|
||||
strB.Append('[')
|
||||
.Append(DateTime.Now.ToString(CultureInfo.InvariantCulture))
|
||||
.Append("]: ");
|
||||
if (msg.Length == 1) strB.Append(msg[0]);
|
||||
else for (ushort i = 0; i < msg.Length; i++)
|
||||
strB.Append(msg[++i]);
|
||||
strB.Append('\n');
|
||||
string _buffer = strB.ToString();
|
||||
|
||||
lock(Buffer) Buffer += _buffer;
|
||||
|
||||
MessageSent?.Invoke(_buffer);
|
||||
|
||||
if (WriteToFile)
|
||||
lock(Logfile) File.AppendAllText(Logfile, _buffer);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,12 @@ global using DTLib;
|
||||
global using DTLib.Dtsod;
|
||||
global using DTLib.Filesystem;
|
||||
global using DTLib.Extensions;
|
||||
global using static launcher_client_avalonia.Launcher;
|
||||
using System.Reflection;
|
||||
using launcher_client_avalonia.GUI;
|
||||
global using static Launcher.Client.Avalonia.LauncherMain;
|
||||
using Launcher.Client.Avalonia.GUI;
|
||||
|
||||
namespace launcher_client_avalonia;
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
public static class Launcher
|
||||
public static class LauncherMain
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
@@ -24,15 +23,6 @@ public static class Launcher
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Enable();
|
||||
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
CurrentLauncherWindow = new LauncherWindow();
|
||||
CurrentLauncherWindow.Show();
|
||||
|
||||
Config = new LauncherConfig();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
@@ -40,8 +30,16 @@ public static class Launcher
|
||||
Directory.Create("installed");
|
||||
Directory.Create("settings");
|
||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||
ReadResource("launcher_client_avalonia.Resources.default.descriptor.template"));
|
||||
|
||||
EmbeddedResources.ReadText("Launcher.Client.Avalonia.Resources.default.descriptor.template"));
|
||||
|
||||
var traceHandler = new ConsoleTraceListener();
|
||||
Trace.AutoFlush = true;
|
||||
Trace.Listeners.Add(traceHandler);
|
||||
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -49,19 +47,10 @@ public static class Launcher
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public static void LogError(string context, Exception ex)
|
||||
{
|
||||
string errmsg = $"{ex.Message}\n{ex.StackTrace}";
|
||||
MessageBox.Show($"{context} ERROR", errmsg);
|
||||
//MessageBox.Show($"{context} ERROR", errmsg);
|
||||
Logger.Log(errmsg);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using launcher_client_avalonia.GUI;
|
||||
using Launcher.Client.Avalonia.GUI;
|
||||
|
||||
namespace launcher_client_avalonia;
|
||||
namespace Launcher.Client.Avalonia;
|
||||
|
||||
public class Program
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Launcher.Client.Avalonia</RootNamespace>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
|
||||
Reference in New Issue
Block a user