Compare commits
No commits in common. "45c3f90da059700f45a7f3e97572d2ec41a5517b" and "c2e2785a32b6b952b6b47908f1f91044202e0eef" have entirely different histories.
45c3f90da0
...
c2e2785a32
13
Млаумчерб.Клиент/LauncherLogger.cs
Normal file
13
Млаумчерб.Клиент/LauncherLogger.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public class LauncherLogger : FileLogger
|
||||
{
|
||||
public static readonly IOPath LogsDirectory = "launcher_logs";
|
||||
|
||||
public LauncherLogger() : base(LogsDirectory, "млаумчерб")
|
||||
{
|
||||
#if DEBUG
|
||||
DebugLogEnabled = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,11 @@
|
||||
using System.Buffers;
|
||||
using System.Net.Http;
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
using Млаумчерб.Клиент.классы;
|
||||
using Timer = DTLib.Timer;
|
||||
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public static class Сеть
|
||||
public static class Network
|
||||
{
|
||||
private static HttpClient http = new();
|
||||
private const string ASSET_SERVER_URL = "https://resources.download.minecraft.net/";
|
||||
@ -55,7 +54,7 @@ public static class Сеть
|
||||
|
||||
public static async Task DownloadAssets(AssetIndexProperties assetIndexProperties, CancellationToken ct, bool force)
|
||||
{
|
||||
IOPath indexFilePath = Пути.GetAssetIndexFilePath(assetIndexProperties.id);
|
||||
IOPath indexFilePath = Пролетариат.GetAssetIndexFilePath(assetIndexProperties.id);
|
||||
if (File.Exists(indexFilePath) && !force)
|
||||
return;
|
||||
|
||||
@ -150,7 +149,7 @@ public static class Сеть
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Приложение.Логгер.LogWarn(nameof(Сеть), ex);
|
||||
Приложение.Логгер.LogWarn(nameof(Network), ex);
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
@ -4,6 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Млаумчерб.Клиент"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Млаумчерб.Клиент.видимое.VersionItemView">
|
||||
x:Class="Млаумчерб.Клиент.VersionItemView">
|
||||
<TextBlock Name="text" Background="Transparent"/>
|
||||
</UserControl>
|
||||
@ -2,7 +2,7 @@
|
||||
using Avalonia.Media;
|
||||
using Млаумчерб.Клиент.классы;
|
||||
|
||||
namespace Млаумчерб.Клиент.видимое;
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public partial class VersionItemView : ListBoxItem
|
||||
{
|
||||
@ -13,7 +13,6 @@ global using Directory = DTLib.Filesystem.Directory;
|
||||
global using Path = DTLib.Filesystem.Path;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
using CliWrap;
|
||||
using DTLib.Extensions;
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
using Млаумчерб.Клиент.классы;
|
||||
using static Млаумчерб.Клиент.классы.Пути;
|
||||
using static Млаумчерб.Клиент.классы.Пролетариат;
|
||||
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
@ -29,7 +28,7 @@ public class GameVersionDescriptor
|
||||
string name = GetVersionDescriptorName(f);
|
||||
propsList.Add(new GameVersionProps(name, null, f));
|
||||
}
|
||||
var remoteVersions = await Сеть.GetDownloadableVersions();
|
||||
var remoteVersions = await Network.GetDownloadableVersions();
|
||||
propsList.AddRange(remoteVersions);
|
||||
return propsList;
|
||||
}
|
||||
@ -41,7 +40,7 @@ public class GameVersionDescriptor
|
||||
if (props.RemoteDescriptorUrl is null)
|
||||
throw new NullReferenceException("can't download game version descriptor '"
|
||||
+ props.Name + "', because RemoteDescriptorUrl is null");
|
||||
await Сеть.DownloadFileHTTP(props.RemoteDescriptorUrl, props.LocalDescriptorPath);
|
||||
await Network.DownloadFileHTTP(props.RemoteDescriptorUrl, props.LocalDescriptorPath);
|
||||
}
|
||||
return new GameVersionDescriptor(props);
|
||||
}
|
||||
@ -65,10 +64,10 @@ public class GameVersionDescriptor
|
||||
{
|
||||
downloadCts = new CancellationTokenSource();
|
||||
if(Приложение.Настройки.скачать_жабу)
|
||||
await Сеть.DownloadJava(descriptor.javaVersion, Приложение.Настройки.путь_к_жабе, force);
|
||||
await Сеть.DownloadAssets(descriptor.assetIndex, downloadCts.Token, force);
|
||||
await Сеть.DownloadVersionFile(descriptor.downloads.client.url, GetVersionJarFilePath(Name), force);
|
||||
await Сеть.DownloadLibraries(descriptor.libraries, GetLibrariesDir(), force);
|
||||
await Network.DownloadJava(descriptor.javaVersion, Приложение.Настройки.путь_к_жабе, force);
|
||||
await Network.DownloadAssets(descriptor.assetIndex, downloadCts.Token, force);
|
||||
await Network.DownloadVersionFile(descriptor.downloads.client.url, GetVersionJarFilePath(Name), force);
|
||||
await Network.DownloadLibraries(descriptor.libraries, GetLibrariesDir(), force);
|
||||
// await Network.DownloadModpack(modpack, WorkingDirectory, force);
|
||||
_props.IsDownloaded = true;
|
||||
}
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public class LauncherLogger : ILogger
|
||||
{
|
||||
private CompositeLogger _compositeLogger;
|
||||
private FileLogger _fileLogger;
|
||||
public static readonly IOPath LogsDirectory = "launcher_logs";
|
||||
public IOPath LogfileName => _fileLogger.LogfileName;
|
||||
|
||||
public LauncherLogger()
|
||||
{
|
||||
_fileLogger = new FileLogger(LogsDirectory, "млаумчерб");
|
||||
ILogger[] loggers =
|
||||
[
|
||||
_fileLogger,
|
||||
#if DEBUG
|
||||
new ConsoleLogger(),
|
||||
#endif
|
||||
];
|
||||
_compositeLogger = new CompositeLogger(loggers);
|
||||
|
||||
#if DEBUG
|
||||
DebugLogEnabled = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public delegate void LogHandler(string context, LogSeverity severity, object message, ILogFormat format);
|
||||
public event LogHandler? OnLogMessage;
|
||||
|
||||
public void Log(string context, LogSeverity severity, object message, ILogFormat format)
|
||||
{
|
||||
_compositeLogger.Log(context, severity, message, format);
|
||||
bool isEnabled = severity switch
|
||||
{
|
||||
LogSeverity.Debug => DebugLogEnabled,
|
||||
LogSeverity.Info => InfoLogEnabled,
|
||||
LogSeverity.Warn => WarnLogEnabled,
|
||||
LogSeverity.Error => ErrorLogEnabled,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(severity), severity, null)
|
||||
};
|
||||
if(isEnabled)
|
||||
OnLogMessage?.Invoke(context, severity, message, format);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_compositeLogger.Dispose();
|
||||
}
|
||||
|
||||
public ILogFormat Format
|
||||
{
|
||||
get => _compositeLogger.Format;
|
||||
set => _compositeLogger.Format = value;
|
||||
}
|
||||
|
||||
public bool DebugLogEnabled
|
||||
{
|
||||
get => _compositeLogger.DebugLogEnabled;
|
||||
set => _compositeLogger.DebugLogEnabled = value;
|
||||
}
|
||||
|
||||
public bool InfoLogEnabled
|
||||
{
|
||||
get => _compositeLogger.InfoLogEnabled;
|
||||
set => _compositeLogger.InfoLogEnabled = value;
|
||||
}
|
||||
|
||||
public bool WarnLogEnabled
|
||||
{
|
||||
get => _compositeLogger.WarnLogEnabled;
|
||||
set => _compositeLogger.WarnLogEnabled = value;
|
||||
}
|
||||
|
||||
public bool ErrorLogEnabled
|
||||
{
|
||||
get => _compositeLogger.ErrorLogEnabled;
|
||||
set => _compositeLogger.ErrorLogEnabled = value;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType Condition="'$(Configuration)' == 'Debug'">Exe</OutputType>
|
||||
<OutputType Condition="'$(Configuration)' != 'Debug'">WinExe</OutputType>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -22,7 +21,7 @@
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.*" />
|
||||
<PackageReference Include="Avalonia.Labs.Gif" Version="11.2.999-cibuild-00051673"/>
|
||||
<PackageReference Include="CliWrap" Version="3.6.*" />
|
||||
<PackageReference Include="DTLib" Version="1.4.2" />
|
||||
<PackageReference Include="DTLib" Version="1.4.1" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.1.*" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.*" />
|
||||
</ItemGroup>
|
||||
@ -31,19 +30,4 @@
|
||||
<AvaloniaResource Include="капитал\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="видимое\VersionItemView.axaml.cs">
|
||||
<DependentUpon>VersionItemView.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="видимое\Окне.axaml.cs">
|
||||
<DependentUpon>Окне.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="видимое\Приложение.axaml.cs">
|
||||
<DependentUpon>Приложение.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
|
||||
namespace Млаумчерб.Клиент;
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public record Настройки
|
||||
{
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:gif="clr-namespace:Avalonia.Labs.Gif;assembly=Avalonia.Labs.Gif"
|
||||
xmlns:local="clr-namespace:Млаумчерб"
|
||||
x:Class="Млаумчерб.Клиент.видимое.Окне"
|
||||
x:Class="Млаумчерб.Клиент.Окне"
|
||||
Name="window"
|
||||
Title="млаумчерб"
|
||||
Icon="avares://млаумчерб/капитал/кубе.ico"
|
||||
FontFamily="{StaticResource MonospaceFont}" FontSize="18"
|
||||
FontFamily="{StaticResource PlexMono}" FontSize="18"
|
||||
MinWidth="800" MinHeight="500"
|
||||
Width="800" Height="500"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
@ -25,18 +25,9 @@
|
||||
<TextBlock FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
Лог
|
||||
News
|
||||
</TextBlock>
|
||||
</Border>
|
||||
<ScrollViewer Name="LogScrollViewer" Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
Background="Transparent">
|
||||
<TextBox Name="LogTextBox"
|
||||
FontSize="12"
|
||||
IsReadOnly="True" TextWrapping="Wrap"
|
||||
Background="Transparent" BorderThickness="0"/>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Column="1"
|
||||
@ -45,39 +36,40 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>* 60</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical" Margin="10" Spacing="10">
|
||||
<TextBlock>Версия:</TextBlock>
|
||||
<ComboBox Name="VersionComboBox"/>
|
||||
<TextBlock>Version:</TextBlock>
|
||||
<ComboBox Name="VersionComboBox">
|
||||
|
||||
<TextBlock>Ник:</TextBlock>
|
||||
<TextBox Background="Transparent"
|
||||
Text="{Binding #window.Username}"/>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock>Username:</TextBlock>
|
||||
<TextBox Text="{Binding #window.Username}"></TextBox>
|
||||
|
||||
<TextBlock>
|
||||
<Run>Выделенная память:</Run>
|
||||
<Run>Memory limit:</Run>
|
||||
<TextBox Background="Transparent" Padding="0"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#777777"
|
||||
Text="{Binding #window.MemoryLimit}">
|
||||
</TextBox>
|
||||
<Run>Мб</Run>
|
||||
<Run>Mb</Run>
|
||||
</TextBlock>
|
||||
<Slider Minimum="2048" Maximum="8192"
|
||||
Value="{Binding #window.MemoryLimit}">
|
||||
</Slider>
|
||||
|
||||
<CheckBox IsChecked="{Binding #window.Fullscreen}">
|
||||
Запустить полноэкранное
|
||||
Fullscreen
|
||||
</CheckBox>
|
||||
|
||||
<CheckBox IsChecked="{Binding #window.CheckGameFiles}">
|
||||
Проверить файлы игры
|
||||
<CheckBox IsChecked="{Binding #window.ForceUpdateGameFiles}">
|
||||
Force update game files
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
<Button Grid.Row="1" Margin="10" Padding="0 0 0 4"
|
||||
Classes="button_no_border"
|
||||
Background="#BBfd7300"
|
||||
Click="Запуск">
|
||||
Запуск
|
||||
Background="#BBFF5900"
|
||||
Click="LaunchButtonHandler">
|
||||
Launch
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
@ -89,25 +81,21 @@
|
||||
<TextBlock FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
Загрузки
|
||||
Downloads
|
||||
</TextBlock>
|
||||
</Border>
|
||||
<ScrollViewer Name="DownloadsScrollViewer" Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
Background="Transparent"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Grid.Row="1" Background="#954808B0">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Button Classes="menu_button button_no_border" Click="ОткрытьПапкуЛаунчера">директория лаунчера</Button>
|
||||
<Border Classes="menu_separator"/>
|
||||
<Button Classes="menu_button button_no_border" Click="ОткрытьФайлЛогов">лог-файл</Button>
|
||||
<Button Classes="menu_button button_no_border" Click="OpenLogsDirectory">logs directory</Button>
|
||||
<Border Classes="menu_separator"></Border>
|
||||
<Button Classes="menu_button button_no_border" Click="OpenLogFile">log file</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Classes="menu_button button_no_border" Click="ОткрытьРепозиторий">исходный код</Button>
|
||||
<Button Classes="menu_button button_no_border" Click="OpenSourceRepository">source code</Button>
|
||||
<gif:GifImage
|
||||
Width="30" Height="30" Stretch="Uniform"
|
||||
Source="avares://млаумчерб/капитал/лисик.gif"/>
|
||||
@ -1,14 +1,12 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
using Млаумчерб.Клиент.классы;
|
||||
|
||||
namespace Млаумчерб.Клиент.видимое;
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public partial class Окне : Window
|
||||
{
|
||||
@ -39,13 +37,13 @@ public partial class Окне : Window
|
||||
set => SetValue(FullscreenProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> CheckGameFilesProperty =
|
||||
AvaloniaProperty.Register<Окне, bool>(nameof(CheckGameFiles),
|
||||
public static readonly StyledProperty<bool> ForceUpdateGameFilesProperty =
|
||||
AvaloniaProperty.Register<Окне, bool>(nameof(ForceUpdateGameFiles),
|
||||
defaultBindingMode: BindingMode.TwoWay, defaultValue: false);
|
||||
public bool CheckGameFiles
|
||||
public bool ForceUpdateGameFiles
|
||||
{
|
||||
get => GetValue(CheckGameFilesProperty);
|
||||
set => SetValue(CheckGameFilesProperty, value);
|
||||
get => GetValue(ForceUpdateGameFilesProperty);
|
||||
set => SetValue(ForceUpdateGameFilesProperty, value);
|
||||
}
|
||||
|
||||
public Окне()
|
||||
@ -57,28 +55,12 @@ public partial class Окне : Window
|
||||
{
|
||||
try
|
||||
{
|
||||
Приложение.Логгер.OnLogMessage += (context, severity, message, format) =>
|
||||
{
|
||||
StringBuilder b = new();
|
||||
b.Append(DateTime.Now.ToString("[HH:mm:ss]["));
|
||||
b.Append(severity);
|
||||
b.Append("]: ");
|
||||
b.Append(message);
|
||||
b.Append('\n');
|
||||
double offsetFromBottom = LogScrollViewer.Extent.Height
|
||||
- LogScrollViewer.Offset.Y
|
||||
- LogScrollViewer.Viewport.Height;
|
||||
bool is_scrolled_to_end = offsetFromBottom < 20.0; // scrolled less then one line up
|
||||
LogTextBox.Text += b.ToString();
|
||||
if(is_scrolled_to_end)
|
||||
LogScrollViewer.ScrollToEnd();
|
||||
};
|
||||
|
||||
Приложение.Настройки = Настройки.ЗагрузитьИзФайла();
|
||||
Username = Приложение.Настройки.имя_пользователя;
|
||||
MemoryLimit = Приложение.Настройки.выделенная_память_мб;
|
||||
Fullscreen = Приложение.Настройки.открывать_на_весь_экран;
|
||||
|
||||
Directory.Create(Пути.GetVersionDescriptorDir());
|
||||
Directory.Create(Пролетариат.GetVersionDescriptorDir());
|
||||
VersionComboBox.SelectedIndex = 0;
|
||||
VersionComboBox.IsEnabled = false;
|
||||
var versions = await GameVersionDescriptor.GetAllVersionsAsync();
|
||||
@ -100,10 +82,11 @@ public partial class Окне : Window
|
||||
}
|
||||
}
|
||||
|
||||
private async void Запуск(object? sender, RoutedEventArgs e)
|
||||
private async void LaunchButtonHandler(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var selectedVersionView = (VersionItemView?)VersionComboBox.SelectedItem;
|
||||
var selectedVersion = selectedVersionView?.Props;
|
||||
Приложение.Настройки.последняя_запущенная_версия = selectedVersion?.Name;
|
||||
@ -115,8 +98,8 @@ public partial class Окне : Window
|
||||
return;
|
||||
|
||||
var v = await GameVersionDescriptor.CreateFromPropsAsync(selectedVersion);
|
||||
v.BeginUpdate(CheckGameFiles);
|
||||
Dispatcher.UIThread.Invoke(() => CheckGameFiles = false);
|
||||
v.BeginUpdate(ForceUpdateGameFiles);
|
||||
Dispatcher.UIThread.Invoke(() => ForceUpdateGameFiles = false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -124,11 +107,11 @@ public partial class Окне : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void ОткрытьПапкуЛаунчера(object? s, RoutedEventArgs e)
|
||||
private void OpenLogsDirectory(object? s, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Launcher.LaunchDirectoryInfoAsync(new DirectoryInfo(Directory.GetCurrent().ToString()))
|
||||
Launcher.LaunchDirectoryInfoAsync(new DirectoryInfo(LauncherLogger.LogsDirectory.ToString()))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -137,7 +120,7 @@ public partial class Окне : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void ОткрытьФайлЛогов(object? sender, RoutedEventArgs e)
|
||||
private void OpenLogFile(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -150,7 +133,7 @@ public partial class Окне : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void ОткрытьРепозиторий(object? sender, RoutedEventArgs e)
|
||||
private void OpenSourceRepository(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -4,7 +4,6 @@ using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Dto;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using MsBox.Avalonia.Models;
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="Млаумчерб.Клиент.видимое.Приложение"
|
||||
x:Class="Млаумчерб.Клиент.Приложение"
|
||||
RequestedThemeVariant="Dark">
|
||||
<Application.Styles>
|
||||
<SimpleTheme />
|
||||
@ -30,30 +30,9 @@
|
||||
<Setter Property="Width" Value="1"/>
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ScrollBar /template/ Border">
|
||||
<Setter Property="Width" Value="5"/>
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="ClipToBounds" Value="True"/>
|
||||
<Setter Property="CornerRadius" Value="0"/>
|
||||
</Style>
|
||||
<Style Selector="ScrollBar /template/ Rectangle">
|
||||
<Setter Property="Fill" Value="#d8ceb9"/>
|
||||
</Style>
|
||||
<Style Selector="ScrollBar /template/ Thumb">
|
||||
<Setter Property="Background" Value="#fd7300"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="CornerRadius" Value="0"/>
|
||||
</Style>
|
||||
<Style Selector="ScrollBar /template/ Thumb /template/ Border">
|
||||
<Setter Property="ClipToBounds" Value="True"/>
|
||||
<Setter Property="CornerRadius" Value="0"/>
|
||||
<Setter Property="Width" Value="5"/>
|
||||
</Style>
|
||||
|
||||
</Application.Styles>
|
||||
|
||||
<Application.Resources>
|
||||
<FontFamily x:Key="MonospaceFont">avares://млаумчерб/капитал/IBMPlexMono-Regular.ttf</FontFamily>
|
||||
<FontFamily x:Key="PlexMono">avares://млаумчерб/капитал/IBMPlexMono-Regular.ttf</FontFamily>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@ -2,17 +2,15 @@ using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Млаумчерб.Клиент.видимое;
|
||||
namespace Млаумчерб.Клиент;
|
||||
|
||||
public class Приложение : Application
|
||||
{
|
||||
public static LauncherLogger Логгер = new();
|
||||
public static Настройки Настройки = new();
|
||||
public static readonly LauncherLogger Логгер = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Логгер.LogInfo(nameof(Приложение), "приложение запущено");
|
||||
Настройки = Настройки.ЗагрузитьИзФайла();
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
@ -25,4 +23,6 @@ public class Приложение : Application
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
public static Настройки Настройки = new();
|
||||
}
|
||||
@ -22,11 +22,11 @@ public class GameVersionProps
|
||||
Name = name;
|
||||
LocalDescriptorPath = descriptorPath;
|
||||
RemoteDescriptorUrl = url;
|
||||
IsDownloaded = File.Exists(Пути.GetVersionJarFilePath(name));
|
||||
IsDownloaded = File.Exists(Пролетариат.GetVersionJarFilePath(name));
|
||||
}
|
||||
|
||||
public GameVersionProps(string name, string? url) :
|
||||
this(name, url, Пути.GetVersionDescriptorPath(name)) { }
|
||||
this(name, url, Пролетариат.GetVersionDescriptorPath(name)) { }
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
@ -2,5 +2,24 @@
|
||||
|
||||
public static class Пролетариат
|
||||
{
|
||||
public static IOPath GetAssetIndexFilePath(string id) =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, $"assets/indexes/{id}.json");
|
||||
|
||||
public static IOPath GetVersionDescriptorDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "version_descriptors");
|
||||
|
||||
public static string GetVersionDescriptorName(IOPath path) =>
|
||||
path.LastName().RemoveExtension().ToString();
|
||||
|
||||
public static IOPath GetVersionDescriptorPath(string name) =>
|
||||
Path.Concat(GetVersionDescriptorDir(), Path.ReplaceRestrictedChars(name) + ".json");
|
||||
|
||||
public static IOPath GetVersionDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "versions");
|
||||
|
||||
public static IOPath GetVersionJarFilePath(string name) =>
|
||||
Path.Concat(GetVersionDir(), name + ".jar");
|
||||
|
||||
public static IOPath GetLibrariesDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "libraries");
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
using Млаумчерб.Клиент.видимое;
|
||||
|
||||
namespace Млаумчерб.Клиент.классы;
|
||||
|
||||
public static class Пути
|
||||
{
|
||||
public static IOPath GetAssetIndexFilePath(string id) =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, $"assets/indexes/{id}.json");
|
||||
|
||||
public static IOPath GetVersionDescriptorDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "version_descriptors");
|
||||
|
||||
public static string GetVersionDescriptorName(IOPath path) =>
|
||||
path.LastName().RemoveExtension().ToString();
|
||||
|
||||
public static IOPath GetVersionDescriptorPath(string name) =>
|
||||
Path.Concat(GetVersionDescriptorDir(), Path.ReplaceRestrictedChars(name) + ".json");
|
||||
|
||||
public static IOPath GetVersionDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "versions");
|
||||
|
||||
public static IOPath GetVersionJarFilePath(string name) =>
|
||||
Path.Concat(GetVersionDir(), name + ".jar");
|
||||
|
||||
public static IOPath GetLibrariesDir() =>
|
||||
Path.Concat(Приложение.Настройки.путь_к_кубачу, "libraries");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user