avalonia client
This commit is contained in:
parent
a5b7e0479d
commit
27746cbddd
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@
|
|||||||
[Oo]ut/
|
[Oo]ut/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
|
[Pp]ublish/
|
||||||
|
|
||||||
# IDE files
|
# IDE files
|
||||||
.vs/
|
.vs/
|
||||||
|
|||||||
@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution
|
|||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "launcher-client-avalonia", "launcher-client-avalonia\launcher-client-avalonia.csproj", "{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{A1F770F3-F6B1-4854-9BF0-093F85064B88}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
|
||||||
{A1F770F3-F6B1-4854-9BF0-093F85064B88}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A1F770F3-F6B1-4854-9BF0-093F85064B88}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BC1FC2A0-159A-4F17-B076-B39775FB6AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{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
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="launcher-client-avalonia-win64" type="DotNetFolderPublish" factoryName="Publish to folder">
|
||||||
|
<riderPublish configuration="Release" delete_existing_files="true" platform="Any CPU" produce_single_file="true" runtime="win-x64" target_folder="$PROJECT_DIR$/launcher-client-avalonia/publish/win-x64" target_framework="net6.0" uuid_high="-4890976677488079081" uuid_low="-5731196012681532756" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
18
launcher-client-avalonia/GUI/App.axaml
Normal file
18
launcher-client-avalonia/GUI/App.axaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="launcher_client_avalonia.GUI.App">
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme Mode="Dark"/>
|
||||||
|
</Application.Styles>
|
||||||
|
<Application.Resources>
|
||||||
|
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328"/>
|
||||||
|
<SolidColorBrush x:Key="MyDarkTr"
|
||||||
|
Opacity="0.8"
|
||||||
|
Color="#141419" />
|
||||||
|
<SolidColorBrush x:Key="MyGray" Color="#46464B" />
|
||||||
|
<SolidColorBrush x:Key="MyWhite" Color="#F0F0F0" />
|
||||||
|
<SolidColorBrush x:Key="MyGreen" Color="#28C311" />
|
||||||
|
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
||||||
|
<SolidColorBrush x:Key="MySelectionColor" Color="#B7800A" />
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
24
launcher-client-avalonia/GUI/App.axaml.cs
Normal file
24
launcher-client-avalonia/GUI/App.axaml.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia
|
||||||
|
{
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
{
|
||||||
|
desktop.MainWindow = new MainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
223
launcher-client-avalonia/GUI/LauncherWindow.xaml
Normal file
223
launcher-client-avalonia/GUI/LauncherWindow.xaml
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
<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"
|
||||||
|
Title="Launcher"
|
||||||
|
Width="800"
|
||||||
|
Height="500"
|
||||||
|
MinWidth="800"
|
||||||
|
MinHeight="500"
|
||||||
|
Background="{DynamicResource MyBackgroundColor}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
<RowDefinition Height="40" />
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Image x:Name="BackgroundImage"
|
||||||
|
Grid.RowSpan="5"
|
||||||
|
Grid.ColumnSpan="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Stretch="UniformToFill" />
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<local:TabButton x:Name="LibraryButton"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="Library"
|
||||||
|
FontSize="18"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<local:TabButton x:Name="DownloadsButton"
|
||||||
|
Grid.Column="2"
|
||||||
|
Content="Downloads"
|
||||||
|
FontSize="18"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<local:TabButton x:Name="LogButton"
|
||||||
|
Grid.Column="4"
|
||||||
|
Content="Log"
|
||||||
|
FontSize="18"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<local:TabButton x:Name="SettingsButton"
|
||||||
|
Grid.Column="6"
|
||||||
|
Content="Settings"
|
||||||
|
FontSize="18"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid x:Name="LibraryGrid"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Visibility="Visible">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="220" />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition Width="220" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ScrollViewer Grid.Column="0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Template="{DynamicResource myScrollViewer}"
|
||||||
|
VerticalScrollBarVisibility="Auto">
|
||||||
|
<StackPanel x:Name="ProgramsPanel" />
|
||||||
|
</ScrollViewer>
|
||||||
|
<Grid x:Name="ProgramGrid" Grid.Column="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="35" />
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
<RowDefinition Height="35" />
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
<RowDefinition Height="70" />
|
||||||
|
<RowDefinition Height="5" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label x:Name="NameLabel"
|
||||||
|
Grid.Row="0"
|
||||||
|
Content="name"
|
||||||
|
FontSize="19"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
ClipToBounds="True"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Button x:Name="RemoveButton"
|
||||||
|
Width="100"
|
||||||
|
Margin="2,0"
|
||||||
|
Background="{DynamicResource MyRed}"
|
||||||
|
Content="Remove"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<Button x:Name="InstallButton"
|
||||||
|
Width="100"
|
||||||
|
Margin="2,0"
|
||||||
|
Content="Install"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<Button x:Name="UpdateButton"
|
||||||
|
Width="100"
|
||||||
|
Margin="2,0"
|
||||||
|
Content="Update"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
<Button x:Name="LaunchButton"
|
||||||
|
Width="100"
|
||||||
|
Margin="2,0"
|
||||||
|
Background="{DynamicResource MyGreen}"
|
||||||
|
Content="Launch"
|
||||||
|
Style="{DynamicResource MyButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBox x:Name="DescriptionBox"
|
||||||
|
Grid.Row="4"
|
||||||
|
Style="{DynamicResource MyTextBoxStyle}"
|
||||||
|
VerticalScrollBarVisibility="Auto" />
|
||||||
|
<TextBox x:Name="ProgramLogBox"
|
||||||
|
Grid.Row="6"
|
||||||
|
Style="{DynamicResource MyTextBoxStyle}"
|
||||||
|
VerticalScrollBarVisibility="Auto" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="0" Grid.Column="4">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="95" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="version:"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<ComboBox Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Background="{DynamicResource MyDarkTr}"
|
||||||
|
Template="{DynamicResource MyComboBox}">
|
||||||
|
<ComboBoxItem IsSelected="True">
|
||||||
|
<Label Background="Transparent"
|
||||||
|
Content="v1"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
</ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<Label Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="directory:"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<Label Name="ProgramDirectoryLabel"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="0"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<Label Grid.Row="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="size:"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<Label Name="ProgramSizeLabel"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="0"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
</Grid>
|
||||||
|
<ScrollViewer Name="ProgramSettingsViever"
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Top"
|
||||||
|
Template="{DynamicResource myScrollViewer}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid x:Name="DownloadsGrid"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Visibility="Hidden" />
|
||||||
|
|
||||||
|
<Grid x:Name="LogGrid"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Visibility="Hidden">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label x:Name="LogfileLabel"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="logfile"
|
||||||
|
FontStyle="Italic"
|
||||||
|
Style="{DynamicResource MyLabelStyle}" />
|
||||||
|
<TextBox x:Name="LogBox"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Style="{DynamicResource MyTextBoxStyle}"
|
||||||
|
VerticalScrollBarVisibility="Auto" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid x:Name="SettingsGrid"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Visibility="Hidden" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
98
launcher-client-avalonia/GUI/LauncherWindow.xaml.cs
Normal file
98
launcher-client-avalonia/GUI/LauncherWindow.xaml.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
public partial class LauncherWindow : Window
|
||||||
|
{
|
||||||
|
public LauncherWindow()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
LogBox.Text = Logger.Buffer;
|
||||||
|
Logger.MessageSent += LogHandler;
|
||||||
|
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Путь.Разд)+1);
|
||||||
|
LogfileLabel.MouseLeftButtonDown += (s,e)=>
|
||||||
|
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Путь.Разд)));
|
||||||
|
LogfileLabel.MouseEnter += (s,e)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||||
|
LogfileLabel.MouseLeave += (s,e)=>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); }
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogHandler(string m) => Dispatcher.Invoke(()=>LogBox.Text += m);
|
||||||
|
|
||||||
|
|
||||||
|
private TabButton CurrentTab;
|
||||||
|
void SelectTab(object sender, RoutedEventArgs _)
|
||||||
|
{
|
||||||
|
if(CurrentTab!=null)
|
||||||
|
{
|
||||||
|
CurrentTab.Background = App.MyDark;
|
||||||
|
CurrentTab.TabGrid.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
var selected = (TabButton)sender;
|
||||||
|
selected.Background = App.MySelectionColor;
|
||||||
|
selected.TabGrid.Visibility = Visibility.Visible;
|
||||||
|
CurrentTab = selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Program[] Programs;
|
||||||
|
|
||||||
|
private void FillProgramsPanel()
|
||||||
|
{
|
||||||
|
Logger.Log("reading descriptors...");
|
||||||
|
string[] descriptors = Directory.GetFiles("descriptors");
|
||||||
|
Programs = new Program[descriptors.Length];
|
||||||
|
for (ushort i = 0; i < descriptors.Length; i++)
|
||||||
|
{
|
||||||
|
string descriptor = descriptors[i];
|
||||||
|
if(descriptor.EndsWith(".descriptor"))
|
||||||
|
{
|
||||||
|
Logger.Log('\t'+descriptor);
|
||||||
|
Programs[i] = new Program(descriptors[i]);
|
||||||
|
ProgramsPanel.Children.Add(Programs[i].ProgramLabel);
|
||||||
|
Programs[i].ProgramSelectedEvent += SelectProgram;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Program DisplayingProgram;
|
||||||
|
public void SelectProgram(Program selectedProg)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DisplayingProgram != null)
|
||||||
|
{
|
||||||
|
DisplayingProgram.ProgramLabel.Foreground = App.MyWhite;
|
||||||
|
DisplayingProgram.ProgramLabel.FontWeight = FontWeights.Normal;
|
||||||
|
}
|
||||||
|
else ProgramGrid.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
selectedProg.ProgramLabel.Foreground = App.MySelectionColor;
|
||||||
|
selectedProg.ProgramLabel.FontWeight = FontWeights.Bold;
|
||||||
|
|
||||||
|
NameLabel.Content = selectedProg.Name;
|
||||||
|
DescriptionBox.Text = selectedProg.Description;
|
||||||
|
BackgroundImage.Source =
|
||||||
|
new BitmapImage(new Uri(
|
||||||
|
$"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}",
|
||||||
|
UriKind.Absolute));
|
||||||
|
ProgramSettingsViever.Content = selectedProg.SettingsPanel;
|
||||||
|
DisplayingProgram = selectedProg;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{ LogError("SelectProgram()",ex); }
|
||||||
|
}
|
||||||
|
}
|
||||||
9
launcher-client-avalonia/GUI/MessageBox.axaml
Normal file
9
launcher-client-avalonia/GUI/MessageBox.axaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="launcher_client_avalonia.GUI.MessageBox"
|
||||||
|
Title="MessageBox">
|
||||||
|
|
||||||
|
</Window>
|
||||||
19
launcher-client-avalonia/GUI/MessageBox.axaml.cs
Normal file
19
launcher-client-avalonia/GUI/MessageBox.axaml.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
public partial class MessageBox : Window
|
||||||
|
{
|
||||||
|
public MessageBox()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
#if DEBUG
|
||||||
|
this.AttachDevTools();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Show(string text)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
30
launcher-client-avalonia/GUI/ProgramLabel.xaml
Normal file
30
launcher-client-avalonia/GUI/ProgramLabel.xaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<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"
|
||||||
|
Height="50"
|
||||||
|
Background="{DynamicResource MyDarkTr}"
|
||||||
|
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource Self}}"
|
||||||
|
BorderThickness="3"
|
||||||
|
Foreground="{DynamicResource MyWhite}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="{Binding Height, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Image x:Name="IconImage"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="3,3,3,3"
|
||||||
|
Stretch="Fill" />
|
||||||
|
|
||||||
|
<Label Name="NameLabel"
|
||||||
|
Grid.Column="1"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Content="label"
|
||||||
|
FontFamily="Unispace"
|
||||||
|
FontSize="15"
|
||||||
|
FontWeight="Normal"
|
||||||
|
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
13
launcher-client-avalonia/GUI/ProgramLabel.xaml.cs
Normal file
13
launcher-client-avalonia/GUI/ProgramLabel.xaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
public partial class ProgramLabel : UserControl
|
||||||
|
{
|
||||||
|
public ProgramLabel(string label, string icon)
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
NameLabel.Content = label;
|
||||||
|
IconImage.Source = new BitmapImage(new Uri(
|
||||||
|
$"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}",
|
||||||
|
UriKind.Absolute));
|
||||||
|
}
|
||||||
|
}
|
||||||
23
launcher-client-avalonia/GUI/ProgramSettingsPanelItem.xaml
Normal file
23
launcher-client-avalonia/GUI/ProgramSettingsPanelItem.xaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<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"
|
||||||
|
Background="Transparent">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Name="KeyLabel" Grid.Column="0"
|
||||||
|
Content="{Binding SettingKey, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}"
|
||||||
|
Style="{DynamicResource MyLabelStyle}"
|
||||||
|
FontFamily="default"
|
||||||
|
FontSize="16"/>
|
||||||
|
<TextBox Name="ValueBox" Grid.Column="1"
|
||||||
|
HorizontalScrollBarVisibility="Auto"
|
||||||
|
Style="{DynamicResource MyTextBoxStyle}"
|
||||||
|
VerticalScrollBarVisibility="Disabled"
|
||||||
|
IsReadOnly="False"
|
||||||
|
Text="{Binding SettingValue, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
public partial class ProgramSettingsPanelItem : UserControl
|
||||||
|
{
|
||||||
|
public static readonly StyledProperty<string> SettingKeyProp =
|
||||||
|
AvaloniaProperty.Register<ProgramSettingsPanelItem, string>(
|
||||||
|
"SettingKey");
|
||||||
|
public string SettingKey
|
||||||
|
{
|
||||||
|
get => (string)GetValue(SettingKeyProp);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(SettingKeyProp, value);
|
||||||
|
|
||||||
|
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);
|
||||||
|
set => SetValue(SettingValueProp, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
|
||||||
|
|
||||||
|
public ProgramSettingsPanelItem(string key, string value)
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
SettingKey = key;
|
||||||
|
SettingValue = value;
|
||||||
|
ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
launcher-client-avalonia/GUI/TabButton.cs
Normal file
11
launcher-client-avalonia/GUI/TabButton.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
public class TabButton : Button
|
||||||
|
{
|
||||||
|
public static readonly StyledProperty<Grid> TabGridProp = AvaloniaProperty.Register<TabButton, Grid>("TabGrid");
|
||||||
|
public Grid TabGrid
|
||||||
|
{
|
||||||
|
get => (Grid)GetValue(TabGridProp);
|
||||||
|
set => SetValue(TabGridProp, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
80
launcher-client-avalonia/Launcher.cs
Normal file
80
launcher-client-avalonia/Launcher.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
global using System;
|
||||||
|
global using System.Diagnostics;
|
||||||
|
global using System.Net;
|
||||||
|
global using System.Text;
|
||||||
|
global using System.Collections.Generic;
|
||||||
|
global using System.Threading;
|
||||||
|
global using System.Linq;
|
||||||
|
global using Avalonia;
|
||||||
|
global using Avalonia.Controls;
|
||||||
|
global using Avalonia.Media;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia;
|
||||||
|
|
||||||
|
public static class Launcher
|
||||||
|
{
|
||||||
|
public static SolidColorBrush MyDark, MySoftDark, MyWhite, MyGreen, MyOrange, MySelectionColor;
|
||||||
|
public static LauncherConfig Config;
|
||||||
|
public static readonly LauncherLogger Logger = new();
|
||||||
|
public static LauncherWindow CurrentLauncherWindow;
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resources = Application.Current.Resources;
|
||||||
|
MyDark = (SolidColorBrush)resources["MyDarkTr"];
|
||||||
|
MySoftDark = (SolidColorBrush)resources["MyGray"];
|
||||||
|
MyWhite = (SolidColorBrush)resources["MyWhite"];
|
||||||
|
MyGreen = (SolidColorBrush)resources["MyGreen"];
|
||||||
|
MyOrange = (SolidColorBrush)resources["MySelectionColor"];
|
||||||
|
MySelectionColor = (SolidColorBrush)resources["MySelectionColor"];
|
||||||
|
|
||||||
|
Logger.Enable();
|
||||||
|
|
||||||
|
AppBuilder.Configure<App>()
|
||||||
|
.UsePlatformDetect()
|
||||||
|
.LogToTrace()
|
||||||
|
.StartWithClassicDesktopLifetime(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",
|
||||||
|
ReadResource("launcher_client_avalonia.Resources.default.descriptor.template"));
|
||||||
|
CurrentLauncherWindow = new LauncherWindow();
|
||||||
|
CurrentLauncherWindow.Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogError("STARTUP", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = $"{context} ERROR:\n{ex}";
|
||||||
|
MessageBox.Show(errmsg);
|
||||||
|
Logger.Log(errmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
65
launcher-client-avalonia/LauncherConfig.cs
Normal file
65
launcher-client-avalonia/LauncherConfig.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
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(ReadResource("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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
launcher-client-avalonia/LauncherLogger.cs
Normal file
36
launcher-client-avalonia/LauncherLogger.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using DTLib.Loggers;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia;
|
||||||
|
|
||||||
|
public class LauncherLogger : BaseLogger
|
||||||
|
{
|
||||||
|
public string Buffer="";
|
||||||
|
|
||||||
|
public LauncherLogger() : base("launcher-logs", "launcher-client-win")
|
||||||
|
{ }
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
launcher-client-avalonia/MainWindow.axaml
Normal file
9
launcher-client-avalonia/MainWindow.axaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="launcher_client_avalonia.MainWindow"
|
||||||
|
Title="launcher_client_avalonia">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
||||||
12
launcher-client-avalonia/MainWindow.axaml.cs
Normal file
12
launcher-client-avalonia/MainWindow.axaml.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia
|
||||||
|
{
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
86
launcher-client-avalonia/Program.cs
Normal file
86
launcher-client-avalonia/Program.cs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
using launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public readonly string Name;
|
||||||
|
public readonly string Directory;
|
||||||
|
public readonly string Description;
|
||||||
|
public readonly string IconFile;
|
||||||
|
public readonly string BackgroundFile;
|
||||||
|
public readonly string LaunchFile;
|
||||||
|
public readonly string LaunchArgs;
|
||||||
|
|
||||||
|
public readonly ProgramLabel ProgramLabel;
|
||||||
|
|
||||||
|
public readonly string SettingsFile;
|
||||||
|
public readonly DtsodV23 Settings;
|
||||||
|
|
||||||
|
public readonly StackPanel SettingsPanel;
|
||||||
|
|
||||||
|
private Process ProgramProcess;
|
||||||
|
|
||||||
|
public event Action<Program> ProgramSelectedEvent;
|
||||||
|
|
||||||
|
public Program(string descriptorFile)
|
||||||
|
{
|
||||||
|
DtsodV23 descriptor= new(File.ReadAllText(descriptorFile));
|
||||||
|
Name = descriptor["name"];
|
||||||
|
Directory = descriptor["directory"];
|
||||||
|
Description = descriptor["description"];
|
||||||
|
IconFile = descriptor["icon"];
|
||||||
|
BackgroundFile = descriptor["background"];
|
||||||
|
string startcommand = descriptor["launchcommand"];
|
||||||
|
LaunchFile = startcommand.Remove(startcommand.IndexOf(' '));
|
||||||
|
LaunchArgs = startcommand.Remove(0,startcommand.IndexOf(' '));
|
||||||
|
|
||||||
|
ProgramLabel = new ProgramLabel(Name, IconFile);
|
||||||
|
ProgramLabel.MouseLeftButtonDown += (_, _) => ProgramSelectedEvent?.Invoke(this);
|
||||||
|
|
||||||
|
SettingsFile = $"settings{Путь.Разд}{Directory}.settings";
|
||||||
|
Settings = File.Exists(SettingsFile)
|
||||||
|
? DtsodConverter.UpdateByDefault(
|
||||||
|
new DtsodV23(File.ReadAllText(SettingsFile)),
|
||||||
|
descriptor["default_settings"])
|
||||||
|
: descriptor["default_settings"];
|
||||||
|
File.WriteAllText(SettingsFile, Settings.ToString());
|
||||||
|
SettingsPanel = new StackPanel();
|
||||||
|
foreach (var setting in Settings)
|
||||||
|
{
|
||||||
|
ProgramSettingsPanelItem settingUi = new(setting.Key, setting.Value);
|
||||||
|
settingUi.UpdatedEvent += UpdateSetting;
|
||||||
|
SettingsPanel.Children.Add(settingUi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateSetting(ProgramSettingsPanelItem uiElem)
|
||||||
|
{
|
||||||
|
Settings[uiElem.SettingKey] = uiElem.SettingValue;
|
||||||
|
File.WriteAllText(SettingsFile, Settings.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Launch()
|
||||||
|
{
|
||||||
|
if(ProgramProcess.HasExited)
|
||||||
|
throw new Exception($"can't start program <{Name}>, because it hadn't stopped yet");
|
||||||
|
ProgramProcess = Process.Start(LaunchFile, LaunchArgs);
|
||||||
|
if (ProgramProcess is null)
|
||||||
|
throw new Exception($"program <{Name}> started, but ProgramProcess is null");
|
||||||
|
CurrentLauncherWindow.LaunchButton.Content = "Stop";
|
||||||
|
ProgramProcess.Exited += ProgramExitedHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (!ProgramProcess.HasExited)
|
||||||
|
throw new Exception($"can't stop program <{Name}>, because it had stopped already");
|
||||||
|
ProgramProcess.Kill(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgramExitedHandler(object sender, EventArgs eargs)
|
||||||
|
{
|
||||||
|
CurrentLauncherWindow.LaunchButton.Content = "Start";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
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
|
||||||
6
launcher-client-avalonia/Resources/launcher.dtsod
Normal file
6
launcher-client-avalonia/Resources/launcher.dtsod
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: 1;
|
||||||
|
|
||||||
|
$server: {
|
||||||
|
ip: "127.0.0.1";
|
||||||
|
port: 25000;
|
||||||
|
};
|
||||||
BIN
launcher-client-avalonia/Resources/logo-D.ico
Normal file
BIN
launcher-client-avalonia/Resources/logo-D.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
66
launcher-client-avalonia/launcher-client-avalonia.csproj
Normal file
66
launcher-client-avalonia/launcher-client-avalonia.csproj
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Configurations>Debug;Release</Configurations>
|
||||||
|
<Platforms>AnyCPU</Platforms>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<ApplicationIcon>Resources/logo-D.ico</ApplicationIcon>
|
||||||
|
<TrimMode>copyused</TrimMode>
|
||||||
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
|
<TargetCulture Label="Invariant" />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Avalonia" Version="0.10.15" />
|
||||||
|
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
|
||||||
|
<!--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" />
|
||||||
|
<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" />
|
||||||
|
<EmbeddedResource Include="Resources\*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AvaloniaXaml Remove="publish\**" />
|
||||||
|
<EmbeddedResource Remove="publish\**" />
|
||||||
|
<Compile Remove="publish\**" />
|
||||||
|
<None Remove="publish\**" />
|
||||||
|
<Compile Update="GUI\App.axaml.cs">
|
||||||
|
<DependentUpon>App.axaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="GUI\LauncherWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<XamlRuntime>Wpf</XamlRuntime>
|
||||||
|
</Page>
|
||||||
|
<Page Include="GUI\ProgramLabel.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<XamlRuntime>Wpf</XamlRuntime>
|
||||||
|
</Page>
|
||||||
|
<Page Include="GUI\ProgramSettingsPanelItem.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<XamlRuntime>Wpf</XamlRuntime>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild-Release" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||||
|
<Exec Command="cp -f bin/Release/runtimes/linux-x64/native/* bin/Release/" />
|
||||||
|
<Exec Command="cp -f bin/Release/runtimes/win-x64/native/* bin/Release/" />
|
||||||
|
<Exec Command="rm -rf bin/Release/runtimes" />
|
||||||
|
</Target>
|
||||||
|
<Target Name="PostBuild-Debug" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Debug'">
|
||||||
|
<Exec Command="cp -f bin/Debug/runtimes/linux-x64/native/* bin/Debug/" />
|
||||||
|
<Exec Command="cp -f bin/Debug/runtimes/win-x64/native/* bin/Debug/" />
|
||||||
|
<Exec Command="rm -rf bin/Debug/runtimes" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue
Block a user