19 Commits

Author SHA1 Message Date
147915f684 - add: add more translate 2025-06-23 19:48:11 +03:00
0a2fe55c7f - add: language 2025-06-23 16:39:30 +03:00
02e1a14571 - add: Custom names of servers 2025-06-22 22:11:27 +03:00
37ca8fecf3 - tweak: Rework loading status 2025-06-22 10:40:42 +03:00
875dacaa18 - tweak: Improve auth page 2025-06-20 16:27:42 +03:00
10d317c867 - add: config invoke 2025-06-19 21:12:42 +03:00
73682acbab - add: Config page fully 2025-06-18 21:36:50 +03:00
a7943adb76 - tweak: Change content running logic 2025-06-17 21:07:32 +03:00
eb188321af - add: VC check 2025-06-15 19:14:58 +03:00
030f680b96 - fix: natives 2025-06-15 17:25:09 +03:00
ba8153e6b4 - fix: return addfavorite button 2025-06-15 17:13:31 +03:00
c4ff903c57 - tweak: use proxy 2025-06-15 16:29:15 +03:00
2d8c1b4d96 - fix: search text on server list 2025-06-15 14:04:29 +03:00
22a6b3157d - add: DotNet runtime download 2025-06-15 13:48:56 +03:00
30a526a746 - remove: Length of penis 2025-06-15 12:26:29 +03:00
df050b9417 - tweak: Big refactoring of hub and file content overview 2025-06-14 22:33:03 +03:00
67380670d7 - fix: item path in unpack 2025-05-11 22:41:15 +03:00
39308fc316 - add: Settings, start 2025-05-10 19:19:30 +03:00
17cc6f0928 - add: icons 2025-05-07 18:43:26 +03:00
86 changed files with 3362 additions and 1281 deletions

View File

@@ -8,21 +8,28 @@
<entry key="Nebula.Launcher/Assets/Icons.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Assets/Resources.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Assets/Style.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Controls/ServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/MessageBox/MessageView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/MessageBox/MessageWindow.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/ViewModels/Styles1.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Config/StringConfigurationView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Controls/PlayerContainerControl.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Controls/ServerContainerControl.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ExceptionView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/FileContentEntryView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/MainView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/MainWindow.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/AccountInfoPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/AccountInfoView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/AddFavoriteView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ConfigurationView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ContentBrowserView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/FavoriteServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ServerListPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ServerOverviewView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/AddFavoriteView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/EditServerNameView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/ExceptionListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/ExceptionView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/InfoPopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
@@ -30,9 +37,11 @@
<entry key="Nebula.Launcher/Views/Popup/LogPopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/MessagePopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/TfaView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ServerCompoundEntryView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ServerContainer.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ServerEntryView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ServerList.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/ServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Tabs/AccountInfoTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Tabs/ServerListTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.UpdateResolver/App.axaml" value="Nebula.UpdateResolver/Nebula.UpdateResolver.csproj" />

2
.vscode/launch.json vendored
View File

@@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Nebula.Launcher/bin/Debug/net9.0/Nebula.Launcher.dll",
"program": "${workspaceFolder}/Nebula.Launcher/bin/Debug/Nebula.Launcher.dll",
"args": [],
"cwd": "${workspaceFolder}/Nebula.Launcher",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

View File

@@ -1,5 +1,3 @@
using System;
using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
@@ -8,7 +6,6 @@ using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.MessageBox;
using Nebula.Launcher.ViewModels.ContentView;
using Nebula.Launcher.Views;
using Nebula.Shared;
using Nebula.Shared.Services;
@@ -63,7 +60,6 @@ public class App : Application
services.AddAvaloniaServices();
services.AddServices();
services.AddViews();
services.AddTransient<DecompilerContentView>();
var serviceProvider = services.BuildServiceProvider();

View File

@@ -1,16 +1,28 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages">
<!-- Base Window Style -->
<Style Selector="Window">
<Setter Property="Background" Value="{StaticResource DefaultBackground}" />
</Style>
<!-- Common Border Style -->
<Style Selector="Border">
<Setter Property="CornerRadius" Value="10" />
</Style>
<!-- Common Label Style -->
<Style Selector="Label">
<Setter Property="Foreground" Value="#f7f7ff" />
</Style>
<!-- Common ItemsControl Style -->
<Style Selector="ItemsControl">
<Setter Property="Background" Value="Transparent" />
</Style>
<!-- General Button Style -->
<Style Selector="Button">
<Setter Property="BorderBrush" Value="#343334" />
<Setter Property="BorderThickness" Value="0" />
@@ -19,6 +31,7 @@
<Setter Property="Background" Value="Transparent" />
</Style>
<!-- Button State Overrides -->
<Style Selector="Button:pressed">
<Setter Property="RenderTransform" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0,0,0,2" />
@@ -30,26 +43,33 @@
<Setter Property="BorderThickness" Value="0,0,0,0" />
</Style>
<!-- ViewSelectButton Specialization -->
<Style Selector="Button.ViewSelectButton">
<Setter Property="CornerRadius" Value="0,8,8,0" />
<Setter Property="Margin" Value="0,0,0,5" />
<Setter Property="Padding" Value="8" />
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="Button.ViewSelectButton:pressed">
<Setter Property="BorderThickness" Value="0,0,0,0" />
</Style>
<!-- TextBox Styles -->
<Style Selector="TextBox">
<Setter Property="Foreground" Value="#f7f7ff" />
<Setter Property="SelectionForegroundBrush" Value="#f7f7ff" />
<Setter Property="BorderThickness" Value="0,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="#f7f7ff" />
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="TextBox" />
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="White" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
</Style>
<!-- ListBoxItem Styles -->
<Style Selector="ListBoxItem /template/ ContentPresenter">
<Setter Property="CornerRadius" Value="0,8,8,0" />
<Setter Property="Margin" Value="0,0,0,5" />
@@ -60,29 +80,37 @@
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="CornerRadius" Value="0,8,8,0" />
<Setter Property="Background">
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
<GradientStop Color="#ae4c47" Offset="0.0" />
<GradientStop Color="#D95F59" Offset="0.2" />
<GradientStop Color="#D95F59" Offset="1.0" />
</LinearGradientBrush>
<Setter.Value>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
<GradientStop Color="#ae4c47" Offset="0.0" />
<GradientStop Color="#D95F59" Offset="0.2" />
<GradientStop Color="#D95F59" Offset="1.0" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BoxShadow" Value="0 0 15 1 #1212" />
</Style>
<Style Selector="ListBoxItem:pointerover">
<Setter Property="CornerRadius" Value="0,8,8,0" />
<Setter Property="Margin" Value="0,0,5,0" />
</Style>
<Style Selector="ListBoxItem:pressed /template/ ContentPresenter">
<Setter Property="CornerRadius" Value="0,8,8,0" />
<Setter Property="Background" Value="{StaticResource DefaultSelected}" />
</Style>
<Style Selector="TextBox">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
<Setter Property="BorderBrush" Value="White" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
</Style>
<!-- Combined ConfigBorder Styles -->
<Style Selector="pages|ComplexUnitConfigControl.ConfigBorder,
pages|ArrayUnitConfigControl.ConfigBorder,
pages|StringUnitConfigControl.ConfigBorder,
pages|IntUnitConfigControl.ConfigBorder,
pages|FloatUnitConfigControl.ConfigBorder">
<Setter Property="Background" Value="#333333" />
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="BorderThickness" Value="1,0,1,2" />
<Setter Property="BorderBrush" Value="Azure" />
</Style>
</Styles>

View File

@@ -0,0 +1,57 @@
tab-account = Account
tab-servers = Servers
tab-content = Content
tab-settings = Settings
vcruntime-check-error = VC runtime dlls are not present on this computer. Install VC runtime dlls.
migration-label-task = Migration task, please wait...
task-cancel = Cancel
popup-edit-name = Edit server name
popup-add-favorite = Add favorite
popup-exception = Exception was thrown
popup-information = Information
popup-loading = Loading...
popup-twofa = 2fa
account-profiles = Profiles
account-profile-select = Select
account-profile-delete = Delete
account-auth-retry = Retry Authentication
account-auth-try-another = Or try another account
account-auth-login = Enter your login
account-auth-password = Enter your password
account-auth-server = Authentication Server
account-auth-button = Authenticate
account-auth-save = Save Profile
account-auth-hello = Hello,
account-auth-logout = Log out
auth-processing = Processing authentication request...
auth-error = An authentication error has occurred.
auth-error-occured = An error occurred during the authentication process.
auth-invalid-credentials = Invalid username or password. Please try again.
auth-connection-error = Unable to connect to the authentication server.
auth-name-resolution-error = Failed to resolve server address. Check your network or server configuration.
auth-secure-error = Failed to cinnect to the server using SSL
auth-config-read = Reading authentication configuration...
auth-try-auth-config = Attempting to authenticate using saved configuration.
config-export-logs = Export logs
config-open-data = Open data path
config-reset = Reset to default
config-save = Save changes
filter-roleplay = Roleplay
filter-language = Language
favorite-add = Add to favorites
servername-set = Set server name
twofa-enabled = You have two-factor authentication enabled. Please enter the code.
twofa-set = Proceed
server-search = Server search
serverentry-tag = Tag
serverentry-map = Map
serverentry-preset = Preset
content-view-server = Server url
content-view-path = Path

View File

@@ -0,0 +1,57 @@
tab-account = Аккаунт
tab-servers = Серверы
tab-content = Контент
tab-settings = Настройки
vcruntime-check-error = VC runtime dll-библиотеки отсутствуют на этом компьютере. Установите VC runtime dll.
migration-label-task = Задача миграции, подождите...
task-cancel = Отмена
popup-edit-name = Изменить имя сервера
popup-add-favorite = Добавить в избранное
popup-exception = Произошло исключение
popup-information = Информация
popup-loading = Загрузка...
popup-twofa = 2FA
account-profiles = Профили
account-profile-select = Выбрать
account-profile-delete = Удалить
account-auth-retry = Повторить аутентификацию
account-auth-try-another = Или попробуйте другой аккаунт
account-auth-login = Введите логин
account-auth-password = Введите пароль
account-auth-server = Сервер аутентификации
account-auth-button = Аутентифицировать
account-auth-save = Сохранить профиль
account-auth-hello = Привет,
account-auth-logout = Выйти
auth-processing = Обработка запроса аутентификации...
auth-error = Произошла ошибка аутентификации.
auth-error-occured = Во время аутентификации произошла ошибка.
auth-invalid-credentials = Неверное имя пользователя или пароль. Попробуйте еще раз.
auth-connection-error = Не удается подключиться к серверу аутентификации.
auth-name-resolution-error = Не удалось разрешить адрес сервера. Проверьте сетевые настройки или конфигурацию сервера.
auth-secure-error = Не удалось подключиться к серверу по SSL. Проверьте сетевые настройки.
auth-config-read = Чтение конфигурации аутентификации...
auth-try-auth-config = Попытка аутентификации с использованием сохраненной конфигурации.
config-export-logs = Экспортировать логи
config-open-data = Открыть путь данных
config-reset = Сбросить к значениям по умолчанию
config-save = Сохранить изменения
filter-roleplay = Ролевая игра
filter-language = Язык
favorite-add = Добавить в избранное
servername-set = Установить имя сервера
twofa-enabled = У вас включена двухфакторная аутентификация. Введите код.
twofa-set = Продолжить
server-search = Поиск сервера
serverentry-tag = Тэги
serverentry-map = Карта
serverentry-preset = Режим
content-view-server = Сервер
content-view-path = Путь

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,7 @@
<!-- License: Apache. Made by Remix Design: https://github.com/Remix-Design/remixicon -->
<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path fill="white" d="M15.728 9.686l-1.414-1.414L5 17.586V19h1.414l9.314-9.314zm1.414-1.414l1.414-1.414-1.414-1.414-1.414 1.414 1.414 1.414zM7.242 21H3v-4.243L16.435 3.322a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414L7.243 21z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 489 B

View File

@@ -19,13 +19,16 @@ public class FilterBox : UserControl
public Action<FilterBoxChangedEventArgs>? OnFilterChanged {get; set;}
public string? FilterBoxName {
set => filterName.Text = value;
get => filterName.Text;
public string FilterBoxName {
set => filterName.LocalId = value;
get => filterName.LocalId;
}
private StackPanel filterPanel;
private TextBox filterName = new TextBox();
private LocalizedLabel filterName = new LocalizedLabel()
{
VerticalAlignment = VerticalAlignment.Center
};
public FilterBox()
{
@@ -34,6 +37,8 @@ public class FilterBox : UserControl
Orientation = Orientation.Horizontal,
Spacing = 5,
};
filterPanel.Children.Add(filterName);
Content = filterPanel;
}

View File

@@ -0,0 +1,20 @@
using Avalonia;
using Avalonia.Controls;
using Nebula.Launcher.Services;
namespace Nebula.Launcher.Controls;
public class LocalizedLabel : Label
{
public static readonly StyledProperty<string> LocalIdProperty = AvaloniaProperty.Register<LocalizedLabel, string>(nameof(LocalId));
public string LocalId
{
get => GetValue(LocalIdProperty);
set
{
SetValue(LocalIdProperty, value);
Content = LocalisationService.GetString(value);
}
}
}

View File

@@ -0,0 +1,20 @@
<UserControl 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="Nebula.Launcher.Controls.ServerListView">
<ScrollViewer
Margin="5,0,0,10"
Padding="0,0,10,0">
<StackPanel Margin="0,0,0,30">
<Label x:Name="LoadingLabel" Margin="10" HorizontalAlignment="Center">Loading... Please wait</Label>
<ItemsControl
x:Name="ErrorList"
Margin="10,0,10,0" />
<ItemsControl
x:Name="ServerList"
Padding="0" />
</StackPanel>
</ScrollViewer>
</UserControl>

View File

@@ -0,0 +1,117 @@
using Avalonia.Controls;
using Nebula.Launcher.ServerListProviders;
using Nebula.Launcher.ViewModels;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.Controls;
public partial class ServerListView : UserControl
{
private IServerListProvider _provider = default!;
private ServerFilter? _currentFilter;
public bool IsLoading { get; private set; }
public ServerListView()
{
InitializeComponent();
}
public static ServerListView TakeFrom(IServerListProvider provider)
{
var serverListView = new ServerListView();
if (provider is IServerListDirtyInvoker invoker)
{
invoker.Dirty += serverListView.OnDirty;
}
serverListView._provider = provider;
serverListView.RefreshFromProvider();
return serverListView;
}
public void RefreshFromProvider()
{
if (IsLoading)
return;
Clear();
StartLoading();
_provider.LoadServerList();
if (_provider.IsLoaded) PasteServersFromList();
else _provider.OnLoaded += RefreshRequired;
}
public void RequireStatusUpdate()
{
foreach (var rawView in ServerList.Items)
{
if (rawView is ServerEntryModelView serverEntryModelView)
{
//serverEntryModelView.UpdateStatusIfNecessary();
}
}
}
public void ApplyFilter(ServerFilter? filter)
{
_currentFilter = filter;
if(IsLoading)
return;
foreach (var serverView in ServerList.Items)
{
if(serverView is IFilterConsumer filterConsumer)
filterConsumer.ProcessFilter(filter);
}
}
private void OnDirty()
{
RefreshFromProvider();
}
private void Clear()
{
ErrorList.Items.Clear();
ServerList.Items.Clear();
}
private void PasteServersFromList()
{
foreach (var serverEntry in _provider.GetServers())
{
ServerList.Items.Add(serverEntry);
if(serverEntry is IFilterConsumer serverFilter)
serverFilter.ProcessFilter(_currentFilter);
}
foreach (var error in _provider.GetErrors())
{
ErrorList.Items.Add(error);
}
EndLoading();
}
private void RefreshRequired()
{
PasteServersFromList();
_provider.OnLoaded -= RefreshRequired;
}
private void StartLoading()
{
Clear();
IsLoading = true;
LoadingLabel.IsVisible = true;
}
private void EndLoading()
{
IsLoading = false;
LoadingLabel.IsVisible = false;
}
}

View File

@@ -1,3 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using Nebula.Launcher.Models;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Shared.Services;
@@ -5,6 +8,8 @@ namespace Nebula.Launcher;
public static class LauncherConVar
{
public static readonly ConVar<bool> DoMigration =
ConVarBuilder.Build("migration.doMigrate", true);
public static readonly ConVar<ProfileAuthCredentials[]> AuthProfiles =
ConVarBuilder.Build<ProfileAuthCredentials[]>("auth.profiles.v2", []);
@@ -14,16 +19,27 @@ public static class LauncherConVar
public static readonly ConVar<string[]> Favorites =
ConVarBuilder.Build<string[]>("server.favorites", []);
public static readonly ConVar<AuthServerCredentials[]> AuthServers = ConVarBuilder.Build<AuthServerCredentials[]>("launcher.authServers", [
public static readonly ConVar<Dictionary<string,string>> ServerCustomNames =
ConVarBuilder.Build<Dictionary<string,string>>("server.names", []);
public static readonly ConVar<AuthServerCredentials[]> AuthServers =
ConVarBuilder.Build<AuthServerCredentials[]>("launcher.authServers", [
new AuthServerCredentials(
"WizDen",
[
"https://auth.spacestation14.com/",
"https://auth.fallback.spacestation14.com/"
"https://harpy.durenko.tatar/auth-api/",
"https://auth.fallback.spacestation14.com/",
])
]);
public static readonly ConVar<ServerHubRecord[]> Hub = ConVarBuilder.Build<ServerHubRecord[]>("launcher.hub.v2", [
new ServerHubRecord("WizDen", "https://harpy.durenko.tatar/hub-api/api/servers"),
new ServerHubRecord("AltHub","https://web.networkgamez.com/api/servers")
]);
public static readonly ConVar<string> CurrentLang = ConVarBuilder.Build<string>("launcher.language", "en-US");
public static readonly ConVar<string> CurrentLang = ConVarBuilder.Build<string>("launcher.language", CultureInfo.CurrentCulture.Name);
public static readonly ConVar<string> ILSpyUrl = ConVarBuilder.Build<string>("decompiler.url",
"https://github.com/icsharpcode/ILSpy/releases/download/v9.0/ILSpy_binaries_9.0.0.7889-x64.zip");
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Text.Json.Serialization;
using Nebula.Launcher.ServerListProviders;
namespace Nebula.Launcher.Models;
public record ListItemTemplate(Type ModelType, string IconKey, string Label);
public record ServerListTabTemplate(IServerListProvider ServerListProvider, string TabName);
public record ServerHubRecord(
[property:JsonPropertyName("name")] string Name,
[property:JsonPropertyName("url")] string MainUrl);

View File

@@ -31,6 +31,7 @@
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
<PackageReference Include="libsodium" Version="1.0.20"/>
<PackageReference Include="Robust.Natives" Version="0.1.1" />
</ItemGroup>
<ItemGroup>
@@ -42,6 +43,10 @@
<DependentUpon>AddFavoriteView.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Controls\ServerListView.axaml.cs">
<DependentUpon>ServerListView.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Target Name="BuildCheck" AfterTargets="AfterBuild">
@@ -69,4 +74,8 @@
<ProjectReference Include="..\Nebula.Shared\Nebula.Shared.csproj"/>
<ProjectReference Include="..\Nebula.SourceGenerators\Nebula.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="Controls\ServerListView.axaml" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,25 @@
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ProcessHelper;
public abstract class DotnetProcessStartInfoProviderBase(DotnetResolverService resolverService) : IProcessStartInfoProvider
{
protected abstract string GetDllPath();
public virtual async Task<ProcessStartInfo> GetProcessStartInfo()
{
return new ProcessStartInfo
{
FileName = await resolverService.EnsureDotnet(),
Arguments = GetDllPath(),
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8
};
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ProcessHelper;
[ServiceRegister(isSingleton:false)]
public sealed class GameProcessStartInfoProvider(DotnetResolverService resolverService, AuthService authService) :
DotnetProcessStartInfoProviderBase(resolverService)
{
private string? _publicKey;
private RobustUrl _address = default!;
protected override string GetDllPath()
{
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
return Path.Join(path, "Nebula.Runner.dll");
}
public GameProcessStartInfoProvider WithBuildInfo(string publicKey, RobustUrl address)
{
_publicKey = publicKey;
_address = address;
return this;
}
public override async Task<ProcessStartInfo> GetProcessStartInfo()
{
var baseStart = await base.GetProcessStartInfo();
var authProv = authService.SelectedAuth;
if(authProv is null)
throw new Exception("Client is without selected auth");
baseStart.EnvironmentVariables["ROBUST_AUTH_USERID"] = authProv.UserId.ToString();
baseStart.EnvironmentVariables["ROBUST_AUTH_TOKEN"] = authProv.Token.Token;
baseStart.EnvironmentVariables["ROBUST_AUTH_SERVER"] = authProv.AuthServer;
baseStart.EnvironmentVariables["AUTH_LOGIN"] = authProv.Login;
baseStart.EnvironmentVariables["ROBUST_AUTH_PUBKEY"] = _publicKey;
baseStart.EnvironmentVariables["GAME_URL"] = _address.ToString();
return baseStart;
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ProcessHelper;
[ServiceRegister]
public sealed class GameRunnerPreparer(IServiceProvider provider, ContentService contentService, EngineService engineService, DebugService debugService)
{
public async Task<ProcessRunHandler<GameProcessStartInfoProvider>> GetGameProcessStartInfoProvider(RobustUrl address, ILoadingHandler loadingHandler, CancellationToken cancellationToken = default)
{
var buildInfo = await contentService.GetBuildInfo(address, cancellationToken);
var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion);
if (engine is null)
throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion);
await contentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandler, cancellationToken);
await engineService.EnsureEngineModules("Robust.Client.WebView", buildInfo.BuildInfo.Build.EngineVersion);
var gameInfo =
provider.GetService<GameProcessStartInfoProvider>()!.WithBuildInfo(buildInfo.BuildInfo.Auth.PublicKey,
address);
var gameProcessRunHandler = new ProcessRunHandler<GameProcessStartInfoProvider>(gameInfo);
return gameProcessRunHandler;
}
}

View File

@@ -0,0 +1,6 @@
namespace Nebula.Launcher.ProcessHelper;
public interface IProcessConsumerCollection
{
public void RegisterLogger(IProcessLogConsumer consumer);
}

View File

@@ -0,0 +1,8 @@
namespace Nebula.Launcher.ProcessHelper;
public interface IProcessLogConsumer
{
public void Out(string text);
public void Error(string text);
public void Fatal(string text);
}

View File

@@ -0,0 +1,9 @@
using System.Diagnostics;
using System.Threading.Tasks;
namespace Nebula.Launcher.ProcessHelper;
public interface IProcessStartInfoProvider
{
public Task<ProcessStartInfo> GetProcessStartInfo();
}

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
namespace Nebula.Launcher.ProcessHelper;
public sealed class ProcessLogConsumerCollection: IProcessLogConsumer, IProcessConsumerCollection
{
private readonly List<IProcessLogConsumer> _consumers = [];
public void RegisterLogger(IProcessLogConsumer consumer)
{
_consumers.Add(consumer);
}
public void Out(string text)
{
foreach (var consumer in _consumers)
{
consumer.Out(text);
}
}
public void Error(string text)
{
foreach (var consumer in _consumers)
{
consumer.Error(text);
}
}
public void Fatal(string text)
{
foreach (var consumer in _consumers)
{
consumer.Fatal(text);
}
}
}

View File

@@ -0,0 +1,137 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging;
namespace Nebula.Launcher.ProcessHelper;
public class ProcessRunHandler<T> : IProcessConsumerCollection, IDisposable where T: IProcessStartInfoProvider
{
private ProcessStartInfo? _processInfo;
private Task<ProcessStartInfo>? _processInfoTask;
private Process? _process;
private ProcessLogConsumerCollection _consumerCollection = new();
private string _lastError = string.Empty;
private readonly T _currentProcessStartInfoProvider;
public T GetCurrentProcessStartInfo() => _currentProcessStartInfoProvider;
public bool IsRunning => _processInfo is not null;
public Action<ProcessRunHandler<T>>? OnProcessExited;
public void RegisterLogger(IProcessLogConsumer consumer)
{
_consumerCollection.RegisterLogger(consumer);
}
public ProcessRunHandler(T processStartInfoProvider)
{
_currentProcessStartInfoProvider = processStartInfoProvider;
_processInfoTask = _currentProcessStartInfoProvider.GetProcessStartInfo();
_processInfoTask.GetAwaiter().OnCompleted(OnInfoProvided);
}
private void OnInfoProvided()
{
if (_processInfoTask == null)
return;
_processInfo = _processInfoTask.GetAwaiter().GetResult();
_processInfoTask = null;
}
public void Start()
{
if (_processInfoTask != null)
{
_processInfoTask.Wait();
}
_process = Process.Start(_processInfo!);
if (_process is null) return;
_process.EnableRaisingEvents = true;
_process.BeginOutputReadLine();
_process.BeginErrorReadLine();
_process.OutputDataReceived += OnOutputDataReceived;
_process.ErrorDataReceived += OnErrorDataReceived;
_process.Exited += OnExited;
}
public void Stop()
{
_process?.CloseMainWindow();
}
private void OnExited(object? sender, EventArgs e)
{
if (_process is null) return;
_process.OutputDataReceived -= OnOutputDataReceived;
_process.ErrorDataReceived -= OnErrorDataReceived;
_process.Exited -= OnExited;
if (_process.ExitCode != 0)
_consumerCollection.Fatal(_lastError);
_process.Dispose();
_process = null;
OnProcessExited?.Invoke(this);
}
private void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
_lastError = e.Data;
_consumerCollection.Error(e.Data);
}
}
private void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
_consumerCollection.Out(e.Data);
}
}
public void Dispose()
{
_processInfoTask?.Dispose();
_process?.Dispose();
}
}
public sealed class DebugLoggerBridge : IProcessLogConsumer
{
private ILogger _logger;
public DebugLoggerBridge(ILogger logger)
{
_logger = logger;
}
public void Out(string text)
{
_logger.Log(LoggerCategory.Log, text);
}
public void Error(string text)
{
_logger.Log(LoggerCategory.Error, text);
}
public void Fatal(string text)
{
_logger.Log(LoggerCategory.Error, text);
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.ViewModels;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.ViewModels.Popup;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ServerListProviders;
[ServiceRegister, ConstructGenerator]
public sealed partial class FavoriteServerListProvider : IServerListProvider, IServerListDirtyInvoker
{
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private IServiceProvider ServiceProvider { get; }
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
private List<IListEntryModelView> _serverLists = [];
private string[] rawServerLists = [];
public bool IsLoaded { get; private set; }
public Action? OnLoaded { get; set; }
public Action? Dirty { get; set; }
public IEnumerable<IListEntryModelView> GetServers()
{
return _serverLists;
}
public IEnumerable<Exception> GetErrors()
{
return [];
}
public void LoadServerList()
{
IsLoaded = false;
_serverLists.Clear();
var servers = GetFavoriteEntries();
var serverEntries = servers.Select(s =>
ServerViewContainer.Get(s.ToRobustUrl())
);
_serverLists.AddRange(serverEntries);
_serverLists.Add(new AddFavoriteButton(ServiceProvider));
IsLoaded = true;
OnLoaded?.Invoke();
}
public void AddFavorite(ServerEntryModelView entryModelView)
{
AddFavorite(entryModelView.Address);
}
public void AddFavorite(RobustUrl robustUrl)
{
var servers = GetFavoriteEntries();
servers.Add(robustUrl.ToString());
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
if(ServerViewContainer.Get(robustUrl) is IFavoriteEntryModelView favoriteView) favoriteView.IsFavorite = true;
}
public void RemoveFavorite(ServerEntryModelView entryModelView)
{
var servers = GetFavoriteEntries();
servers.Remove(entryModelView.Address.ToString());
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
}
public void RemoveFavorite(RobustUrl url)
{
var servers = GetFavoriteEntries();
servers.Remove(url.ToString());
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
}
private List<string> GetFavoriteEntries()
{
return rawServerLists.ToList();
}
private void Initialise()
{
ConfigurationService.SubscribeVarChanged(LauncherConVar.Favorites, OnVarChanged, true);
}
private void OnVarChanged(string[]? value)
{
if (value == null)
{
rawServerLists = [];
Dirty?.Invoke();
return;
}
rawServerLists = value;
Dirty?.Invoke();
}
private void InitialiseInDesignMode(){}
}
public class AddFavoriteButton: Border, IListEntryModelView{
private Button _addFavoriteButton = new Button();
public AddFavoriteButton(IServiceProvider serviceProvider)
{
Margin = new Thickness(5, 5, 5, 20);
Background = new SolidColorBrush(Color.Parse("#222222"));
CornerRadius = new CornerRadius(20f);
_addFavoriteButton.HorizontalAlignment = HorizontalAlignment.Center;
_addFavoriteButton.Click += (sender, args) =>
{
serviceProvider.GetService<PopupMessageService>()!.Popup(
serviceProvider.GetService<AddFavoriteViewModel>()!);
};
_addFavoriteButton.Content = "Add Favorite";
Child = _addFavoriteButton;
}
public bool IsFavorite { get; set; }
}

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.ViewModels;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ServerListProviders;
[ServiceRegister(null, false), ConstructGenerator]
public sealed partial class HubServerListProvider : IServerListProvider
{
[GenerateProperty] private RestService RestService { get; }
[GenerateProperty] private ServerViewContainer ServerViewContainer { get; }
public string HubUrl { get; set; }
public bool IsLoaded { get; private set; }
public Action? OnLoaded { get; set; }
private CancellationTokenSource? _cts;
private readonly List<IListEntryModelView> _servers = [];
private readonly List<Exception> _errors = [];
public HubServerListProvider With(string hubUrl)
{
HubUrl = hubUrl;
return this;
}
public IEnumerable<IListEntryModelView> GetServers()
{
return _servers;
}
public IEnumerable<Exception> GetErrors()
{
return _errors;
}
public async void LoadServerList()
{
if (_cts != null)
{
await _cts.CancelAsync();
_cts = null;
}
_servers.Clear();
_errors.Clear();
IsLoaded = false;
_cts = new CancellationTokenSource();
try
{
var servers =
await RestService.GetAsync<List<ServerHubInfo>>(new Uri(HubUrl), _cts.Token);
servers.Sort(new ServerComparer());
if(_cts.Token.IsCancellationRequested) return;
_servers.AddRange(
servers.Select(h=>
ServerViewContainer.Get(h.Address.ToRobustUrl(), h.StatusData)
)
);
}
catch (Exception e)
{
_errors.Add(new Exception($"Some error while loading server list from {HubUrl}. See inner exception", e));
}
IsLoaded = true;
OnLoaded?.Invoke();
}
private void Initialise(){}
private void InitialiseInDesignMode(){}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using Nebula.Launcher.ViewModels;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.ServerListProviders;
public interface IServerListProvider
{
public bool IsLoaded { get; }
public Action? OnLoaded { get; set; }
public IEnumerable<IListEntryModelView> GetServers();
public IEnumerable<Exception> GetErrors();
public void LoadServerList();
}
public interface IServerListDirtyInvoker
{
public Action? Dirty { get; set; }
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using Nebula.Launcher.Controls;
using Nebula.Launcher.ViewModels;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.ServerListProviders;
public sealed class TestServerList : IServerListProvider
{
public bool IsLoaded => true;
public Action? OnLoaded { get; set; }
public IEnumerable<IListEntryModelView> GetServers()
{
return [new ServerEntryModelView(),new ServerEntryModelView()];
}
public IEnumerable<Exception> GetErrors()
{
return [new Exception("On no!")];
}
public void LoadServerList()
{
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Nebula.Shared;
namespace Nebula.Launcher.Services;
public static class ExplorerHelper
{
public static void OpenFolder(string path)
{
string command;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
command = "explorer.exe";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
command = "xdg-open";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
command = "open";
else
throw new PlatformNotSupportedException("Unsupported OS platform");
var startInfo = new ProcessStartInfo
{
FileName = command,
Arguments = path,
UseShellExecute = false
};
Process.Start(startInfo);
}
}

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Avalonia.Markup.Xaml;
using Avalonia.Platform;
using Fluent.Net;
using Nebula.Shared;
@@ -14,33 +16,63 @@ public partial class LocalisationService
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
private CultureInfo _currentCultureInfo = CultureInfo.CurrentCulture;
private MessageContext _currentMessageContext;
private static MessageContext? _currentMessageContext;
private void Initialise()
{
// LoadLanguage(CultureInfo.GetCultureInfo(ConfigurationService.GetConfigValue(LauncherConVar.CurrentLang)!));
LoadLanguage(CultureInfo.GetCultureInfo(ConfigurationService.GetConfigValue(LauncherConVar.CurrentLang)!));
}
public void LoadLanguage(CultureInfo cultureInfo)
{
_currentCultureInfo = cultureInfo;
using var fs = AssetLoader.Open(new Uri($@"Assets/lang/{_currentCultureInfo.EnglishName}.ftl"));
using var sr = new StreamReader(fs);
var options = new MessageContextOptions { UseIsolating = false };
var mc = new MessageContext(cultureInfo.EnglishName, options);
var errors = mc.AddMessages(sr);
foreach (var error in errors)
try
{
Console.WriteLine(error);
}
_currentCultureInfo = cultureInfo;
using var fs = AssetLoader.Open(new Uri($@"avares://Nebula.Launcher/Assets/lang/{_currentCultureInfo.Name}.ftl"));
using var sr = new StreamReader(fs);
_currentMessageContext = mc;
var options = new MessageContextOptions { UseIsolating = false };
var mc = new MessageContext(cultureInfo.Name, options);
var errors = mc.AddMessages(sr);
foreach (var error in errors)
{
Console.WriteLine(error);
}
_currentMessageContext = mc;
} catch (Exception e) {
LoadLanguage(CultureInfo.GetCultureInfo("en-US"));
}
}
private void InitialiseInDesignMode()
{
Initialise();
}
public static string GetString(string locale)
{
if (_currentMessageContext is null)
{
Console.WriteLine("ERROR SHIT BITHC!");
return locale;
}
var message = _currentMessageContext.GetMessage(locale);
if (message == null) return locale;
return _currentMessageContext.Format(message, new Dictionary<string, object>());
}
}
public class LocaledText : MarkupExtension
{
public string Key { get; set; }
public LocaledText(string key) => Key = key;
public override object ProvideValue(IServiceProvider serviceProvider)
{
// Fetch the localized string using the key
return LocalisationService.GetString(Key);
}
}

View File

@@ -1,14 +0,0 @@
using System;
using System.IO;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.ViewModels.ContentView;
public abstract class ContentViewBase : ViewModelBase, IDisposable
{
public virtual void InitialiseWithData(ContentPath path, Stream stream, ContentEntry contentEntry)
{
}
public virtual void Dispose()
{
}
}

View File

@@ -1,26 +0,0 @@
using System.IO;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.ContentView;
[ConstructGenerator]
public sealed partial class DecompilerContentView: ContentViewBase
{
[GenerateProperty] private DecompilerService decompilerService {get;}
public override void InitialiseWithData(ContentPath path, Stream stream, ContentEntry contentEntry)
{
base.InitialiseWithData(path, stream, contentEntry);
decompilerService.OpenServerDecompiler(contentEntry.ServerName.ToRobustUrl());
}
protected override void Initialise()
{
}
protected override void InitialiseInDesignMode()
{
}
}

View File

@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nebula.Launcher.Models;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.ViewModels.Popup;
@@ -22,10 +23,10 @@ public partial class MainViewModel : ViewModelBase
{
private readonly List<ListItemTemplate> _templates =
[
new ListItemTemplate(typeof(AccountInfoViewModel), "user", "Account", null),
new ListItemTemplate(typeof(ServerListViewModel), "file", "Servers", false),
new ListItemTemplate(typeof(ServerListViewModel), "star", "Favorites", true),
new ListItemTemplate(typeof(ContentBrowserViewModel), "folder", "Content", null)
new ListItemTemplate(typeof(AccountInfoViewModel), "user", "tab-account"),
new ListItemTemplate(typeof(ServerOverviewModel), "file", "tab-servers"),
new ListItemTemplate(typeof(ContentBrowserViewModel), "folder", "tab-content"),
new ListItemTemplate(typeof(ConfigurationViewModel), "settings", "tab-settings")
];
private readonly List<PopupViewModelBase> _viewQueue = new();
@@ -40,11 +41,12 @@ public partial class MainViewModel : ViewModelBase
[ObservableProperty] private bool _popup;
[ObservableProperty] private ListItemTemplate? _selectedListItem;
[GenerateProperty] private LocalisationService LocalisationService { get; }
[GenerateProperty] private DebugService DebugService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
[GenerateProperty] private ContentService ContentService { get; } = default!;
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
[GenerateProperty] private FileService FileService { get; } = default!;
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
private ILogger _logger;
@@ -52,7 +54,11 @@ public partial class MainViewModel : ViewModelBase
protected override void InitialiseInDesignMode()
{
Items = new ObservableCollection<ListItemTemplate>(_templates);
Items = new ObservableCollection<ListItemTemplate>(_templates.Select(a=>
{
return new ListItemTemplate(a.ModelType, a.IconKey, LocalisationService.GetString(a.Label));
}
));
RequirePage<AccountInfoViewModel>();
}
@@ -72,18 +78,28 @@ public partial class MainViewModel : ViewModelBase
PopupMessageService.OnCloseRequired += OnPopupCloseRequired;
CheckMigration();
if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent())
{
OnPopupRequired(LocalisationService.GetString("vcruntime-check-error"));
Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170");
}
}
private void CheckMigration()
{
if (!ConfigurationService.GetConfigValue(LauncherConVar.DoMigration))
return;
var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loadingHandler.LoadingName = "Migration task, please wait...";
loadingHandler.LoadingName = LocalisationService.GetString("migration-label-task");
loadingHandler.IsCancellable = false;
if (!ContentService.CheckMigration(loadingHandler))
return;
OnPopupRequired(loadingHandler);
ConfigurationService.SetConfigValue(LauncherConVar.DoMigration, false);
}
partial void OnSelectedListItemChanged(ListItemTemplate? value)
@@ -92,19 +108,19 @@ public partial class MainViewModel : ViewModelBase
if (!ViewHelperService.TryGetViewModel(value.ModelType, out var vmb)) return;
OpenPage(vmb, value.args, false);
OpenPage(vmb, false);
}
public T RequirePage<T>() where T : ViewModelBase, IViewModelPage
public T RequirePage<T>() where T : ViewModelBase
{
if (CurrentPage is T vam) return vam;
var page = ViewHelperService.GetViewModel<T>();
OpenPage(page, null);
OpenPage(page);
return page;
}
private void OpenPage(ViewModelBase obj, object? args, bool selectListView = true)
private void OpenPage(ViewModelBase obj, bool selectListView = true)
{
var tabItems = Items.Where(vm => vm.ModelType == obj.GetType());
@@ -117,11 +133,6 @@ public partial class MainViewModel : ViewModelBase
}
}
if (obj is IViewModelPage page)
{
page.OnPageOpen(args);
}
CurrentPage = obj;
}
@@ -213,4 +224,29 @@ public partial class MainViewModel : ViewModelBase
CurrentPopup = viewModelBase;
}
}
public static class VCRuntimeDllChecker
{
public static bool AreVCRuntimeDllsPresent()
{
if (!OperatingSystem.IsWindows()) return true;
string systemDir = Environment.SystemDirectory;
string[] requiredDlls = {
"msvcp140.dll",
"vcruntime140.dll"
};
foreach (var dll in requiredDlls)
{
var path = Path.Combine(systemDir, dll);
if (!File.Exists(path))
{
return false;
}
}
return true;
}
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Windows.Input;
@@ -10,7 +11,6 @@ using CommunityToolkit.Mvvm.Input;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared;
using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils;
@@ -19,7 +19,7 @@ namespace Nebula.Launcher.ViewModels.Pages;
[ViewModelRegister(typeof(AccountInfoView))]
[ConstructGenerator]
public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
public partial class AccountInfoViewModel : ViewModelBase
{
[ObservableProperty] private bool _authMenuExpand;
@@ -34,8 +34,10 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
[ObservableProperty] private string _currentPassword = string.Empty;
[ObservableProperty] private bool _isLogged;
[ObservableProperty] private bool _doRetryAuth;
private bool _isProfilesEmpty;
[GenerateProperty] private LocalisationService LocalisationService { get; }
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
[GenerateProperty] private DebugService DebugService { get; }
@@ -62,7 +64,7 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
protected override void Initialise()
{
_logger = DebugService.GetLogger(this);
ReadAuthConfig();
Task.Run(ReadAuthConfig);
}
public void AuthByProfile(ProfileAuthCredentials credentials)
@@ -77,7 +79,7 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
public void DoAuth(string? code = null)
{
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = "Auth think, please wait...";
message.InfoText = LocalisationService.GetString("auth-processing");
message.IsInfoClosable = false;
PopupMessageService.Popup(message);
@@ -95,12 +97,14 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
{
try
{
await TryAuth(CurrentLogin, CurrentPassword, server,code);
await CatchAuthError(async () => await TryAuth(CurrentLogin, CurrentPassword, server, code), ()=> message.Dispose());
break;
}
catch (Exception e)
catch (Exception ex)
{
exception = e;
var unexpectedError = new Exception(LocalisationService.GetString("auth-error"), ex);
_logger.Error(unexpectedError);
PopupMessageService.Popup(unexpectedError);
}
}
@@ -108,24 +112,40 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
if (!IsLogged)
{
PopupMessageService.Popup(new Exception("No one of auth server is available.", exception));
PopupMessageService.Popup(exception ?? new Exception(LocalisationService.GetString("auth-error")));
}
});
}
private async Task TryAuth(string login, string password, string authServer,string? code)
private async Task TryAuth(CurrentAuthInfo currentAuthInfo)
{
CurrentLogin = currentAuthInfo.Login;
CurrentAuthServer = currentAuthInfo.AuthServer;
await AuthService.SetAuth(currentAuthInfo);
IsLogged = true;
}
private async Task TryAuth(string login, string password, string authServer, string? code)
{
await AuthService.Auth(new AuthLoginPassword(login, password, authServer), code);
CurrentLogin = login;
CurrentPassword = password;
CurrentAuthServer = authServer;
IsLogged = true;
ConfigurationService.SetConfigValue(LauncherConVar.AuthCurrent, AuthService.SelectedAuth);
}
private async Task CatchAuthError(Func<Task> a, Action? onError)
{
DoRetryAuth = false;
try
{
await AuthService.Auth(new AuthLoginPassword(login, password, authServer), code);
CurrentLogin = login;
CurrentPassword = password;
CurrentAuthServer = authServer;
IsLogged = true;
ConfigurationService.SetConfigValue(LauncherConVar.AuthCurrent, AuthService.SelectedAuth);
await a();
}
catch (AuthException e)
{
onError?.Invoke();
switch (e.Error.Code)
{
case AuthenticateDenyCode.TfaRequired:
@@ -136,13 +156,39 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
_logger.Log("TFA required");
break;
case AuthenticateDenyCode.InvalidCredentials:
PopupMessageService.Popup("Invalid Credentials!");
_logger.Error($"Invalid credentials");
PopupError(LocalisationService.GetString("auth-invalid-credentials"), e);
break;
default:
throw;
}
}
catch (HttpRequestException e)
{
onError?.Invoke();
switch (e.HttpRequestError)
{
case HttpRequestError.ConnectionError:
PopupError(LocalisationService.GetString("auth-connection-error"), e);
DoRetryAuth = true;
break;
case HttpRequestError.NameResolutionError:
PopupError(LocalisationService.GetString("auth-name-resolution-error"), e);
DoRetryAuth = true;
break;
case HttpRequestError.SecureConnectionError:
PopupError(LocalisationService.GetString("auth-secure-error"), e);
DoRetryAuth = true;
break;
default:
var authError = new Exception(LocalisationService.GetString("auth-error"), e);
_logger.Error(authError);
PopupMessageService.Popup(authError);
break;
}
}
}
private void OnTfaEntered(string code)
@@ -182,10 +228,10 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
Accounts.Add(alpm);
}
private async void ReadAuthConfig()
private void ReadAuthConfig()
{
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = "Read configuration file, please wait...";
message.InfoText = LocalisationService.GetString("auth-config-read");
message.IsInfoClosable = false;
PopupMessageService.Popup(message);
foreach (var profile in
@@ -198,25 +244,35 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
var authUrls = ConfigurationService.GetConfigValue(LauncherConVar.AuthServers)!;
foreach (var url in authUrls) AuthUrls.Add(url);
if(authUrls.Length > 0) AuthItemSelect = authUrls[0];
message.Dispose();
DoCurrentAuth();
}
public async void DoCurrentAuth()
{
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = LocalisationService.GetString("auth-try-auth-config");
message.IsInfoClosable = false;
PopupMessageService.Popup(message);
var currProfile = ConfigurationService.GetConfigValue(LauncherConVar.AuthCurrent);
if (currProfile != null)
{
try
{
CurrentLogin = currProfile.Login;
CurrentAuthServer = currProfile.AuthServer;
IsLogged = await AuthService.SetAuth(currProfile);
await CatchAuthError(async () => await TryAuth(currProfile), () => message.Dispose());
}
catch (Exception e)
catch (Exception ex)
{
message.Dispose();
PopupMessageService.Popup(e);
var unexpectedError = new Exception(LocalisationService.GetString("auth-error"), ex);
_logger.Error(unexpectedError);
PopupMessageService.Popup(unexpectedError);
return;
}
}
message.Dispose();
}
@@ -237,6 +293,17 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
DirtyProfile();
}
private void PopupError(string message, Exception e)
{
message = LocalisationService.GetString("auth-error-occured") + message;
_logger.Error(new Exception(message, e));
var messageView = ViewHelperService.GetViewModel<InfoPopupViewModel>();
messageView.InfoText = message;
messageView.IsInfoClosable = true;
PopupMessageService.Popup(messageView);
}
[RelayCommand]
private void OnExpandAuthUrl()
{
@@ -255,18 +322,14 @@ public partial class AccountInfoViewModel : ViewModelBase, IViewModelPage
ConfigurationService.SetConfigValue(LauncherConVar.AuthProfiles,
Accounts.ToArray());
}
public void OnPageOpen(object? args)
{
}
}
public sealed record ProfileAuthCredentials(
string Login,
string Password,
string AuthServer,
[property: JsonIgnore] ICommand OnSelect = default!,
[property: JsonIgnore] ICommand OnDelete = default!
);
[property: JsonIgnore] ICommand OnDelete = default!);
public sealed record AuthServerCredentials(
string Name,

View File

@@ -0,0 +1,387 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ViewModels.Pages;
[ViewModelRegister(typeof(ConfigurationView))]
[ConstructGenerator]
public partial class ConfigurationViewModel : ViewModelBase
{
public ObservableCollection<IConfigControl> ConfigurationVerbose { get; } = new();
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupService { get; } = default!;
[GenerateProperty] private FileService FileService { get; set; } = default!;
public List<(object, Type)> ConVarList = new();
public void AddCvarConf<T>(ConVar<T> cvar)
{
ConfigurationVerbose.Add(
ConfigControlHelper.GetConfigControl(cvar.Name, ConfigurationService.GetConfigValue(cvar)));
ConVarList.Add((cvar, cvar.Type));
}
public void InvokeUpdateConfiguration()
{
for (int i = 0; i < ConfigurationVerbose.Count; i++)
{
var conVarControl = ConfigurationVerbose[i];
if(!conVarControl.Dirty)
continue;
var conVar = ConVarList[i];
var methodInfo = ConfigurationService.GetType().GetMethod("SetConfigValue")!.MakeGenericMethod(conVar.Item2);
methodInfo.Invoke(ConfigurationService, [conVar.Item1, conVarControl.GetValue()]);
}
}
public void ResetConfig()
{
foreach (var conVar in ConVarList)
{
var methodInfo = ConfigurationService.GetType().GetMethod("SetConfigValue")!.MakeGenericMethod(conVar.Item2);
methodInfo.Invoke(ConfigurationService, [conVar.Item1, null]);
}
ConVarList.Clear();
ConfigurationVerbose.Clear();
InitConfiguration();
PopupService.Popup("Configuration has been reset.");
}
public void OpenDataFolder()
{
ExplorerHelper.OpenFolder(FileService.RootPath);
}
public void ExportLogs()
{
var logPath = Path.Join(FileService.RootPath, "log");
var path = Path.Combine(Path.GetTempPath(), "tempThink"+Path.GetRandomFileName());
Directory.CreateDirectory(path);
ZipFile.CreateFromDirectory(logPath, Path.Join(path, DateTime.Now.ToString("yyyy-MM-dd") + ".zip"));
ExplorerHelper.OpenFolder(path);
}
private void InitConfiguration()
{
AddCvarConf(LauncherConVar.ILSpyUrl);
AddCvarConf(LauncherConVar.Hub);
AddCvarConf(LauncherConVar.AuthServers);
AddCvarConf(CurrentConVar.EngineManifestUrl);
AddCvarConf(CurrentConVar.RobustAssemblyName);
AddCvarConf(CurrentConVar.ManifestDownloadProtocolVersion);
}
protected override void InitialiseInDesignMode()
{
InitConfiguration();
}
protected override void Initialise()
{
InitConfiguration();
}
}
public static class ConfigControlHelper{
public static IConfigControl GetConfigControl(string name,object value)
{
switch (value)
{
case string stringValue:
return new StringUnitConfigControl(name, stringValue);
case int intValue:
return new IntUnitConfigControl(name, intValue);
case float floatValue:
return new FloatUnitConfigControl(name, floatValue);
}
var valueType = value.GetType();
if (valueType.IsArray)
return new ArrayUnitConfigControl(name, value);
return new ComplexUnitConfigControl(name, value);
}
public static object? CreateDefaultValue(Type type)
{
if(type.IsValueType)
return Activator.CreateInstance(type);
var ctor = type.GetConstructors().First();
var parameters = ctor.GetParameters()
.Select(p => CreateDefaultValue(p.ParameterType))
.ToArray();
return ctor.Invoke(parameters);
}
}
public sealed class ComplexUnitConfigControl : Border, IConfigControl
{
private readonly List<(PropertyInfo, IConfigControl)> _units = [];
private Type _objectType = typeof(object);
private readonly StackPanel _panel = new();
public string ConfigName { get; }
public bool Dirty => _units.Any(dirty => dirty.Item2.Dirty);
public ComplexUnitConfigControl(string name, object obj)
{
Classes.Add("ConfigBorder");
_panel.Orientation = Orientation.Vertical;
_panel.Spacing = 4f;
ConfigName = name;
Child = _panel;
SetValue(obj);
}
public void SetValue(object value)
{
_units.Clear();
_panel.Children.Clear();
_objectType = value.GetType();
_panel.Children.Add(new Label()
{
Content = ConfigName
});
foreach (var propInfo in _objectType.GetProperties())
{
if(propInfo.PropertyType.IsInterface)
continue;
var propValue = propInfo.GetValue(value);
var control = ConfigControlHelper.GetConfigControl(propInfo.Name, propValue);
((Control)control).Margin = new Thickness(5);
_panel.Children.Add((Control)control);
_units.Add((propInfo,control));
}
}
public object GetValue()
{
var obj = ConfigControlHelper.CreateDefaultValue(_objectType);
foreach (var (fieldInfo, configControl) in _units)
{
fieldInfo.SetValue(obj, configControl.GetValue());
}
return obj;
}
}
public sealed class ArrayUnitConfigControl : Border, IConfigControl
{
private readonly List<IConfigControl> _itemControls = [];
private readonly StackPanel _itemsPanel = new StackPanel() { Orientation = Orientation.Vertical };
private readonly Button _addButton = new Button() { Content = new Label()
{
Content = "Add Item"
}, Classes = { "ConfigBorder" }};
private readonly int _oldCount;
private readonly Type _elementType;
private readonly StackPanel _panel = new();
public string ConfigName { get; }
public bool Dirty => _itemControls.Any(dirty => dirty.Dirty) || _itemControls.Count != _oldCount;
public ArrayUnitConfigControl(string name, object value)
{
Classes.Add("ConfigBorder");
_elementType = value.GetType().GetElementType()!;
ConfigName = name;
_panel.Orientation = Orientation.Vertical;
_panel.Spacing = 4f;
_itemsPanel.Spacing = 4f;
_panel.Children.Add(new Label { Content = name });
_panel.Children.Add(_itemsPanel);
_panel.Children.Add(_addButton);
_addButton.Click += (_, _) => AddItem(ConfigControlHelper.CreateDefaultValue(_elementType)!);
Child = _panel;
SetValue(value);
_oldCount = _itemControls.Count;
}
private void AddItem(object value)
{
var itemPanel = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2 };
var control = ConfigControlHelper.GetConfigControl(_itemControls.Count.ToString(), value);
var removeButton = new Button { Content = new Label(){ Content = "Remove" }, Classes = { "ConfigBorder" }};
removeButton.Click += (_, _) =>
{
_itemControls.Remove(control);
_itemsPanel.Children.Remove(itemPanel);
};
((Control)control).Margin = new Thickness(5);
itemPanel.Children.Add((Control)control);
itemPanel.Children.Add(removeButton);
_itemsPanel.Children.Add(itemPanel);
_itemControls.Add(control);
}
public void SetValue(object value)
{
_itemControls.Clear();
_itemsPanel.Children.Clear();
if (value is IEnumerable list)
{
foreach (var item in list)
{
AddItem(item);
}
}
}
public object GetValue()
{
return ConvertArray(_itemControls.Select(c => c.GetValue()).ToArray(), _elementType);
}
public static Array ConvertArray(Array sourceArray, Type targetType)
{
int length = sourceArray.Length;
var newArray = Array.CreateInstance(targetType, length);
for (int i = 0; i < length; i++)
{
var value = sourceArray.GetValue(i);
var converted = Convert.ChangeType(value, targetType);
newArray.SetValue(converted, i);
}
return newArray;
}
}
public abstract class UnitConfigControl<T> : Border, IConfigControl where T : notnull
{
private readonly Label _nameLabel = new();
private readonly TextBox _valueLabel = new();
private string _originalValue;
private StackPanel _panel = new();
public string ConfigName { get; }
public bool Dirty => _originalValue != ConfigValue;
protected string ConfigValue
{
get => _valueLabel.Text ?? string.Empty;
set => _valueLabel.Text = value;
}
public UnitConfigControl(string name, T value)
{
Classes.Add("ConfigBorder");
ConfigName = name;
_panel.Orientation = Orientation.Horizontal;
_panel.Children.Add(_nameLabel);
_panel.Children.Add(_valueLabel);
_nameLabel.Content = name;
_nameLabel.VerticalAlignment = VerticalAlignment.Center;
Child = _panel;
SetConfValue(value);
_originalValue = ConfigValue;
}
public abstract void SetConfValue(T value);
public abstract T GetConfValue();
public void SetValue(object value)
{
SetConfValue((T)value);
}
public object GetValue()
{
return GetConfValue()!;
}
}
public sealed class StringUnitConfigControl(string name, string value) : UnitConfigControl<string>(name, value)
{
public override void SetConfValue(string value)
{
ConfigValue = value;
}
public override string GetConfValue()
{
return ConfigValue;
}
}
public sealed class IntUnitConfigControl(string name, int value) : UnitConfigControl<int>(name, value)
{
public override void SetConfValue(int value)
{
ConfigValue = value.ToString();
}
public override int GetConfValue()
{
return int.Parse(ConfigValue);
}
}
public sealed class FloatUnitConfigControl(string name, float value) : UnitConfigControl<float>(name, value)
{
public CultureInfo CultureInfo = CultureInfo.InvariantCulture;
public override void SetConfValue(float value)
{
ConfigValue = value.ToString(CultureInfo);
}
public override float GetConfValue()
{
return float.Parse(ConfigValue, CultureInfo);
}
}
public interface IConfigControl
{
public string ConfigName { get; }
public bool Dirty {get;}
public abstract void SetValue(object value);
public abstract object GetValue();
}

View File

@@ -1,397 +1,462 @@
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.Models;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.ContentView;
using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared.FileApis;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.Pages;
[ViewModelRegister(typeof(ContentBrowserView))]
[ConstructGenerator]
public sealed partial class ContentBrowserViewModel : ViewModelBase , IViewModelPage
public sealed partial class ContentBrowserViewModel : ViewModelBase, IContentHolder
{
private readonly List<ContentEntry> _root = new();
private readonly List<string> _history = new();
[ObservableProperty] private string _message = "";
[ObservableProperty] private string _searchText = "";
private ContentEntry? _selectedEntry;
private ILogger _logger;
[ObservableProperty] private IContentEntry _currentEntry;
[ObservableProperty] private string _serverText = "";
[ObservableProperty] private ContentViewBase? _contentView;
public bool IsCustomContenView => ContentView != null;
[ObservableProperty] private string _searchText = "";
[GenerateProperty] private ContentService ContentService { get; } = default!;
[GenerateProperty] private CancellationService CancellationService { get; } = default!;
[GenerateProperty] private FileService FileService { get; } = default!;
[GenerateProperty] private DebugService DebugService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupService { get; } = default!;
[GenerateProperty] private HubService HubService { get; } = default!;
[GenerateProperty] private IServiceProvider ServiceProvider {get;}
[GenerateProperty] private IServiceProvider ServiceProvider { get; }
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
public ObservableCollection<ContentEntry> Entries { get; } = new();
private Dictionary<string, Type> _contentContainers = new();
public ContentEntry? SelectedEntry
{
get => _selectedEntry;
set
{
var oldSearchText = SearchText;
SearchText = value?.GetPath().ToString() ?? "";
ContentView = null;
Entries.Clear();
_selectedEntry = value;
if (value == null) return;
if(value.TryOpen(out var stream, out var item)){
var ext = Path.GetExtension(item.Value.Path);
var myTempFile = Path.Combine(Path.GetTempPath(), "tempie" + ext);
if(TryGetContentViewer(ext, out var contentViewBase)){
_logger.Debug($"Opening custom context:{item.Value.Path}");
contentViewBase.InitialiseWithData(value.GetPath(), stream, value);
stream.Dispose();
ContentView = contentViewBase;
return;
}
var sw = new FileStream(myTempFile, FileMode.Create, FileAccess.Write, FileShare.None);
stream.CopyTo(sw);
sw.Dispose();
stream.Dispose();
var startInfo = new ProcessStartInfo(myTempFile)
{
UseShellExecute = true
};
_logger.Log("Opening " + myTempFile);
Process.Start(startInfo);
return;
}
if(SearchText.Length > oldSearchText.Length)
AppendHistory(oldSearchText);
foreach (var entryCh in value.Childs) Entries.Add(entryCh);
}
}
private bool TryGetContentViewer(string type,[NotNullWhen(true)] out ContentViewBase? contentViewBase){
contentViewBase = null;
if(!_contentContainers.TryGetValue(type, out var contentViewType) ||
!contentViewType.IsAssignableTo(typeof(ContentViewBase)))
return false;
contentViewBase = (ContentViewBase)ServiceProvider.GetService(contentViewType)!;
return true;
}
protected override void InitialiseInDesignMode()
{
var a = new ContentEntry(this, "A:", "A", "", default!);
var b = new ContentEntry(this, "B", "B", "", default!);
a.TryAddChild(b);
Entries.Add(a);
}
protected override void Initialise()
{
_logger = DebugService.GetLogger(this);
FillRoot(HubService.ServerList);
HubService.HubServerChangedEventArgs += HubServerChangedEventArgs;
HubService.HubServerLoaded += GoHome;
if (!HubService.IsUpdating) GoHome();
_contentContainers.Add(".dll",typeof(DecompilerContentView));
}
private void GoHome()
{
SelectedEntry = null;
foreach (var entry in _root) Entries.Add(entry);
}
private void HubServerChangedEventArgs(HubServerChangedEventArgs obj)
{
if (obj.Action == HubServerChangeAction.Clear) _root.Clear();
if (obj.Action == HubServerChangeAction.Add) FillRoot(obj.Items);
}
private void FillRoot(IEnumerable<ServerHubInfo> infos)
{
foreach (var info in infos)
_root.Add(new ContentEntry(this, info.StatusData.Name, info.Address, info.Address, default!));
}
public void Go(string server, ContentPath path)
{
ServerText = server;
Go(path);
}
public async void Go(ContentPath path)
{
if (path.Pathes.Count > 0 && (path.Pathes[0].StartsWith("ss14://") || path.Pathes[0].StartsWith("ss14s://")))
{
ServerText = path.Pathes[0];
path = new ContentPath("");
}
if (string.IsNullOrEmpty(ServerText))
{
SearchText = "";
GoHome();
return;
}
if (ServerText != SelectedEntry?.ServerName) SelectedEntry = await CreateEntry(ServerText);
_logger.Debug("Going to:" + path.Path);
var oriPath = path.Clone();
try
{
if (SelectedEntry == null || !SelectedEntry.GetRoot().TryGetEntry(path, out var centry))
throw new Exception("Not found! " + oriPath.Path);
SelectedEntry = centry;
}
catch (Exception e)
{
PopupService.Popup(e);
}
}
public void OnBackEnter()
{
Go(new ContentPath(GetHistory()));
}
public void OnGoEnter()
{
Go(new ContentPath(SearchText));
if (CurrentEntry.Parent is null)
{
SetHubRoot();
return;
}
CurrentEntry.Parent?.GoCurrent();
}
public void OnUnpack()
{
if (SelectedEntry == null) return;
if(CurrentEntry is not ServerFolderContentEntry serverEntry)
return;
var myTempDir = FileService.EnsureTempDir(out var tmpDir);
var loading = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loading.LoadingName = "Unpacking entry";
PopupService.Popup(loading);
Task.Run(() => ContentService.Unpack(SelectedEntry.FileApi, myTempDir, loading));
var startInfo = new ProcessStartInfo(){
FileName = "explorer.exe",
Arguments = tmpDir,
};
_logger.Log("Opening " + tmpDir);
Process.Start(startInfo);
Task.Run(() => ContentService.Unpack(serverEntry.FileApi, myTempDir, loading));
ExplorerHelper.OpenFolder(tmpDir);
}
private async Task<ContentEntry> CreateEntry(string serverUrl)
public void OnGoEnter()
{
var loading = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loading.LoadingName = "Loading entry";
PopupService.Popup(loading);
var rurl = serverUrl.ToRobustUrl();
var info = await ContentService.GetBuildInfo(rurl, CancellationService.Token);
var hashApi = await ContentService.EnsureItems(info.RobustManifestInfo, loading,
CancellationService.Token);
var rootEntry = new ContentEntry(this, "", "", serverUrl, hashApi);
foreach (var item in hashApi.Manifest.Values)
if (string.IsNullOrWhiteSpace(ServerText))
{
var path = new ContentPath(item.Path);
rootEntry.CreateItem(path, item);
SetHubRoot();
SearchText = string.Empty;
return;
}
loading.Dispose();
return rootEntry;
try
{
var cur = ServiceProvider.GetService<ServerFolderContentEntry>()!;
cur.Init(this, ServerText.ToRobustUrl());
var curContent = cur.Go(new ContentPath(SearchText));
if(curContent == null)
throw new NullReferenceException($"{SearchText} not found in {ServerText}");
CurrentEntry = curContent;
}
catch (Exception e)
{
PopupService.Popup(e);
ServerText = string.Empty;
SearchText = string.Empty;
SetHubRoot();
}
}
private void AppendHistory(string str)
partial void OnCurrentEntryChanged(IContentEntry value)
{
if (_history.Count >= 10) _history.RemoveAt(9);
_history.Insert(0, str);
SearchText = value.FullPath.ToString();
if (value.GetRoot() is ServerFolderContentEntry serverEntry)
{
ServerText = serverEntry.ServerUrl.ToString();
}
}
protected override void InitialiseInDesignMode()
{
var root = ViewHelperService.GetViewModel<FolderContentEntry>();
root.Init(this);
var child = root.AddFolder("Biba");
child.AddFolder("Boba");
child.AddFolder("Buba");
CurrentEntry = root;
}
private string GetHistory()
protected override void Initialise()
{
if (_history.Count == 0) return "";
var h = _history[0];
_history.RemoveAt(0);
return h;
SetHubRoot();
}
public void OnPageOpen(object? args)
public void SetHubRoot()
{
ServerText = string.Empty;
SearchText = string.Empty;
var root = ViewHelperService.GetViewModel<ServerListContentEntry>();
root.InitHubList(this);
CurrentEntry = root;
}
public void Go(RobustUrl url, ContentPath path)
{
ServerText = url.ToString();
SearchText = path.ToString();
OnGoEnter();
}
}
public class ContentEntry
public interface IContentHolder
{
private readonly Dictionary<string, ContentEntry> _childs = new();
public IContentEntry CurrentEntry { get; set; }
}
public interface IContentEntry
{
public IContentHolder Holder { get; }
private readonly ContentBrowserViewModel _viewModel;
public readonly HashApi FileApi;
public readonly RobustManifestItem? Item;
internal ContentEntry(ContentBrowserViewModel viewModel, string name, string pathName, string serverName, HashApi fileApi, RobustManifestItem? item = null)
public IContentEntry? Parent { get; set; }
public string? Name { get; }
public string IconPath { get; }
public ContentPath FullPath => Parent?.FullPath.With(Name) ?? new ContentPath(Name);
public IContentEntry? Go(ContentPath path);
public void GoCurrent()
{
var entry = Go(ContentPath.Empty);
if(entry is not null) Holder.CurrentEntry = entry;
}
public IContentEntry GetRoot()
{
if (Parent is null) return this;
return Parent.GetRoot();
}
}
public sealed class LazyContentEntry : IContentEntry
{
public IContentHolder Holder { get; set; }
public IContentEntry? Parent { get; set; }
public string? Name { get; }
public string IconPath { get; }
private readonly IContentEntry _lazyEntry;
private readonly Action _lazyEntryInit;
public LazyContentEntry (IContentHolder holder,string name, IContentEntry entry, Action lazyEntryInit)
{
Holder = holder;
Name = name;
ServerName = serverName;
PathName = pathName;
_viewModel = viewModel;
FileApi = fileApi;
Item = item;
IconPath = entry.IconPath;
_lazyEntry = entry;
_lazyEntryInit = lazyEntryInit;
}
public bool IsDirectory => Item == null;
public string Name { get; private set; }
public string PathName { get; }
public string ServerName { get; }
public string IconPath { get; set; } = "/Assets/svg/folder.svg";
public ContentEntry? Parent { get; private set; }
public bool IsRoot => Parent == null;
//TODO: Remove LINQ later...
public IReadOnlyList<ContentEntry> Childs => _childs.Values.OrderBy(v => v,new ContentComparer()).ToList();
public bool TryOpen([NotNullWhen(true)] out Stream? stream,[NotNullWhen(true)] out RobustManifestItem? item){
stream = null;
item = null;
if(Item is null || !FileApi.TryOpen(Item.Value, out stream))
return false;
item = Item;
return true;
}
public bool TryGetChild(string name, [NotNullWhen(true)] out ContentEntry? child)
public IContentEntry? Go(ContentPath path)
{
return _childs.TryGetValue(name, out child);
_lazyEntryInit?.Invoke();
return _lazyEntry;
}
}
public sealed class ExtContentExecutor
{
public ServerFolderContentEntry _root;
private DecompilerService _decompilerService;
public ExtContentExecutor(ServerFolderContentEntry root, DecompilerService decompilerService)
{
_root = root;
_decompilerService = decompilerService;
}
public bool TryAddChild(ContentEntry contentEntry)
public bool TryExecute(RobustManifestItem manifestItem)
{
if (_childs.TryAdd(contentEntry.PathName, contentEntry))
var ext = Path.GetExtension(manifestItem.Path);
if (ext == ".dll")
{
contentEntry.Parent = this;
_decompilerService.OpenServerDecompiler(_root.ServerUrl);
return true;
}
return false;
}
}
public ContentPath GetPath()
public sealed partial class ManifestContentEntry : IContentEntry
{
public IContentHolder Holder { get; set; } = default!;
public IContentEntry? Parent { get; set; }
public string? Name { get; set; }
public string IconPath => "/Assets/svg/file.svg";
private RobustManifestItem _manifestItem;
private HashApi _hashApi = default!;
private ExtContentExecutor _extContentExecutor = default!;
public void Init(IContentHolder holder, RobustManifestItem manifestItem, HashApi api, ExtContentExecutor executor)
{
if (Parent != null)
Holder = holder;
Name = new ContentPath(manifestItem.Path).GetName();
_manifestItem = manifestItem;
_hashApi = api;
_extContentExecutor = executor;
}
public IContentEntry? Go(ContentPath path)
{
if (_extContentExecutor.TryExecute(_manifestItem))
return null;
var ext = Path.GetExtension(_manifestItem.Path);
try
{
var path = Parent.GetPath();
path.Pathes.Add(PathName);
return path;
if (!_hashApi.TryOpen(_manifestItem, out var stream))
return null;
var myTempFile = Path.Combine(Path.GetTempPath(), "tempie" + ext);
var sw = new FileStream(myTempFile, FileMode.Create, FileAccess.Write, FileShare.None);
stream.CopyTo(sw);
sw.Dispose();
stream.Dispose();
var startInfo = new ProcessStartInfo(myTempFile)
{
UseShellExecute = true
};
Process.Start(startInfo);
}
return new ContentPath([PathName]);
}
public ContentEntry GetOrCreateDirectory(ContentPath rootPath)
{
if (rootPath.Pathes.Count == 0) return this;
var fName = rootPath.GetNext();
if (!TryGetChild(fName, out var child))
catch (Exception e)
{
child = new ContentEntry(_viewModel, fName, fName, ServerName, FileApi);
TryAddChild(child);
_extContentExecutor._root.PopupService.Popup(e);
}
return child.GetOrCreateDirectory(rootPath);
}
public ContentEntry GetRoot()
{
if (Parent == null) return this;
return Parent.GetRoot();
}
public ContentEntry CreateItem(ContentPath path, RobustManifestItem item)
{
var dir = path.GetDirectory();
var dirEntry = GetOrCreateDirectory(dir);
var name = path.GetName();
var entry = new ContentEntry(_viewModel, name, name, ServerName, FileApi, item);
dirEntry.TryAddChild(entry);
entry.IconPath = "/Assets/svg/file.svg";
return entry;
}
public bool TryGetEntry(ContentPath path, out ContentEntry? entry)
{
entry = null;
if (path.Pathes.Count == 0)
{
entry = this;
return true;
}
var fName = path.GetNext();
if (!TryGetChild(fName, out var child)) return false;
return child.TryGetEntry(path, out entry);
}
public void OnPathGo()
{
_viewModel.Go(GetPath());
return null;
}
}
public struct ContentPath
[ViewModelRegister(typeof(FileContentEntryView), false), ConstructGenerator]
public sealed partial class FolderContentEntry : BaseFolderContentEntry
{
[GenerateProperty, DesignConstruct] public override ViewHelperService ViewHelperService { get; } = default!;
public FolderContentEntry AddFolder(string folderName)
{
var folder = ViewHelperService.GetViewModel<FolderContentEntry>();
folder.Init(Holder, folderName);
return AddChild(folder);
}
protected override void InitialiseInDesignMode() { }
protected override void Initialise() { }
}
[ViewModelRegister(typeof(FileContentEntryView), false), ConstructGenerator]
public sealed partial class ServerFolderContentEntry : BaseFolderContentEntry
{
[GenerateProperty, DesignConstruct] public override ViewHelperService ViewHelperService { get; } = default!;
[GenerateProperty] public ContentService ContentService { get; } = default!;
[GenerateProperty] public CancellationService CancellationService { get; } = default!;
[GenerateProperty] public PopupMessageService PopupService { get; } = default!;
[GenerateProperty] public DecompilerService DecompilerService { get; } = default!;
public RobustUrl ServerUrl { get; private set; }
public HashApi FileApi { get; private set; } = default!;
private ExtContentExecutor _contentExecutor = default!;
public void Init(IContentHolder holder, RobustUrl serverUrl)
{
base.Init(holder);
_contentExecutor = new ExtContentExecutor(this, DecompilerService);
IsLoading = true;
var loading = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loading.LoadingName = "Loading entry";
PopupService.Popup(loading);
ServerUrl = serverUrl;
Task.Run(async () =>
{
var buildInfo = await ContentService.GetBuildInfo(serverUrl, CancellationService.Token);
FileApi = await ContentService.EnsureItems(buildInfo.RobustManifestInfo, loading,
CancellationService.Token);
foreach (var (path, item) in FileApi.Manifest)
{
CreateContent(new ContentPath(path), item);
}
IsLoading = false;
loading.Dispose();
});
}
public ManifestContentEntry CreateContent(ContentPath path, RobustManifestItem manifestItem)
{
var pathDir = path.GetDirectory();
BaseFolderContentEntry parent = this;
while (pathDir.TryNext(out var dirPart))
{
if (!parent.TryGetChild(dirPart, out var folderContentEntry))
{
folderContentEntry = ViewHelperService.GetViewModel<FolderContentEntry>();
((FolderContentEntry)folderContentEntry).Init(Holder, dirPart);
parent.AddChild(folderContentEntry);
}
parent = folderContentEntry as BaseFolderContentEntry ?? throw new InvalidOperationException();
}
var manifestContent = new ManifestContentEntry();
manifestContent.Init(Holder, manifestItem, FileApi, _contentExecutor);
parent.AddChild(manifestContent);
return manifestContent;
}
protected override void InitialiseInDesignMode() { }
protected override void Initialise() { }
}
[ViewModelRegister(typeof(FileContentEntryView), false), ConstructGenerator]
public sealed partial class ServerListContentEntry : BaseFolderContentEntry
{
[GenerateProperty, DesignConstruct] public override ViewHelperService ViewHelperService { get; } = default!;
[GenerateProperty] public ConfigurationService ConfigurationService { get; } = default!;
[GenerateProperty] public IServiceProvider ServiceProvider { get; } = default!;
[GenerateProperty] public RestService RestService { get; } = default!;
public void InitHubList(IContentHolder holder)
{
base.Init(holder);
var servers = ConfigurationService.GetConfigValue(LauncherConVar.Hub)!;
foreach (var server in servers)
{
var serverFolder = ServiceProvider.GetService<ServerListContentEntry>()!;
var serverLazy = new LazyContentEntry(Holder, server.Name , serverFolder, () => serverFolder.InitServerList(Holder, server));
AddChild(serverLazy);
}
}
public async void InitServerList(IContentHolder holder, ServerHubRecord hubRecord)
{
base.Init(holder, hubRecord.Name);
IsLoading = true;
var servers =
await RestService.GetAsync<List<ServerHubInfo>>(new Uri(hubRecord.MainUrl), CancellationToken.None);
foreach (var server in servers)
{
var serverFolder = ServiceProvider.GetService<ServerFolderContentEntry>()!;
var serverLazy = new LazyContentEntry(Holder, server.StatusData.Name , serverFolder, () => serverFolder.Init(Holder, server.Address.ToRobustUrl()));
AddChild(serverLazy);
}
IsLoading = true;
}
protected override void InitialiseInDesignMode()
{
}
protected override void Initialise()
{
}
}
public abstract class BaseFolderContentEntry : ViewModelBase, IContentEntry
{
public bool IsLoading { get; set; } = false;
public abstract ViewHelperService ViewHelperService { get; }
public ObservableCollection<IContentEntry> Entries { get; } = [];
private Dictionary<string, IContentEntry> _childs = [];
public string IconPath => "/Assets/svg/folder.svg";
public IContentHolder Holder { get; private set; }
public IContentEntry? Parent { get; set; }
public string? Name { get; private set; }
public IContentEntry? Go(ContentPath path)
{
if (path.IsEmpty()) return this;
if (_childs.TryGetValue(path.GetNext(), out var child))
return child.Go(path);
return null;
}
public void Init(IContentHolder holder, string? name = null)
{
Name = name;
Holder = holder;
}
public T AddChild<T>(T child) where T: IContentEntry
{
if(child.Name is null) throw new InvalidOperationException();
child.Parent = this;
_childs.Add(child.Name, child);
Entries.Add(child);
return child;
}
public bool TryGetChild(string name,[NotNullWhen(true)] out IContentEntry? child)
{
return _childs.TryGetValue(name, out child);
}
}
public struct ContentPath : IEquatable<ContentPath>
{
public static readonly ContentPath Empty = new();
public List<string> Pathes { get; }
public ContentPath()
@@ -404,17 +469,23 @@ public struct ContentPath
Pathes = pathes;
}
public ContentPath(string path)
public ContentPath(string? path)
{
Pathes = string.IsNullOrEmpty(path)
? new List<string>()
: path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).ToList();
: path.Split(['/'], StringSplitOptions.RemoveEmptyEntries).ToList();
}
public ContentPath With(string? name)
{
if (name != null) return new ContentPath([..Pathes, name]);
return new ContentPath(Pathes);
}
public ContentPath GetDirectory()
{
if (Pathes.Count == 0)
return this; // Root remains root when getting the directory.
return this;
var directoryPathes = Pathes.Take(Pathes.Count - 1).ToList();
return new ContentPath(directoryPathes);
@@ -439,6 +510,14 @@ public struct ContentPath
return string.IsNullOrWhiteSpace(nextName) ? GetNext() : nextName;
}
public bool TryNext([NotNullWhen(true)]out string? part)
{
part = null;
if (Pathes.Count == 0) return false;
part = GetNext();
return true;
}
public ContentPath Clone()
{
return new ContentPath(new List<string>(Pathes));
@@ -450,19 +529,35 @@ public struct ContentPath
{
return Path;
}
public bool IsEmpty()
{
return Pathes.Count == 0;
}
public bool Equals(ContentPath other)
{
return Pathes.Equals(other.Pathes);
}
public override bool Equals(object? obj)
{
return obj is ContentPath other && Equals(other);
}
public override int GetHashCode()
{
return Pathes.GetHashCode();
}
}
public sealed class ContentComparer : IComparer<ContentEntry>
public sealed class ContentComparer : IComparer<IContentEntry>
{
public int Compare(ContentEntry? x, ContentEntry? y)
public int Compare(IContentEntry? x, IContentEntry? y)
{
if (ReferenceEquals(x, y)) return 0;
if (y is null) return 1;
if (x is null) return -1;
var iconComparison = string.Compare(x.IconPath, y.IconPath, StringComparison.Ordinal);
if (iconComparison != 0) return -iconComparison;
var nameComparison = string.Compare(x.Name, y.Name, StringComparison.Ordinal);
if (nameComparison != 0) return nameComparison;
return string.Compare(x.ServerName, y.ServerName, StringComparison.Ordinal);
return string.Compare(x.Name, y.Name, StringComparison.Ordinal);
}
}

View File

@@ -1,6 +0,0 @@
namespace Nebula.Launcher.ViewModels.Pages;
public interface IViewModelPage
{
public void OnPageOpen(object? args);
}

View File

@@ -1,60 +0,0 @@
using System.Collections.ObjectModel;
using System.Linq;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.Pages;
public partial class ServerListViewModel
{
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private RestService RestService { get; }
public ObservableCollection<ServerEntryModelView> FavoriteServers { get; } = [];
private void UpdateFavoriteEntries()
{
foreach(var fav in FavoriteServers.ToList()){
FavoriteServers.Remove(fav);
}
var servers = ConfigurationService.GetConfigValue(LauncherConVar.Favorites);
if (servers is null || servers.Length == 0)
{
return;
}
foreach (var server in servers)
{
var s = ServerViewContainer.Get(server.ToRobustUrl());
s.IsFavorite = true;
FavoriteServers.Add(s);
}
ApplyFilter();
}
public void AddFavorite(ServerEntryModelView entryModelView)
{
entryModelView.IsFavorite = true;
AddFavorite(entryModelView.Address);
}
public void AddFavorite(RobustUrl robustUrl)
{
var servers = (ConfigurationService.GetConfigValue(LauncherConVar.Favorites) ?? []).ToList();
servers.Add(robustUrl.ToString());
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
UpdateFavoriteEntries();
}
public void RemoveFavorite(ServerEntryModelView entryModelView)
{
var servers = (ConfigurationService.GetConfigValue(LauncherConVar.Favorites) ?? []).ToList();
servers.Remove(entryModelView.Address.ToString());
ConfigurationService.SetConfigValue(LauncherConVar.Favorites, servers.ToArray());
entryModelView.IsFavorite = false;
UpdateFavoriteEntries();
}
}

View File

@@ -1,252 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Controls;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Launcher.ViewModels.Pages;
[ViewModelRegister(typeof(ServerListView))]
[ConstructGenerator]
public partial class ServerListViewModel : ViewModelBase, IViewModelPage
{
[ObservableProperty] private string _searchText = string.Empty;
[ObservableProperty] private bool _isFavoriteMode;
[ObservableProperty] private bool _isFilterVisible;
public ObservableCollection<ServerEntryModelView> Servers { get; }= new();
public ObservableCollection<Exception> HubErrors { get; } = new();
public readonly ServerFilter CurrentFilter = new ServerFilter();
public Action? OnSearchChange;
[GenerateProperty] private HubService HubService { get; }
[GenerateProperty] private PopupMessageService PopupMessageService { get; }
[GenerateProperty] private CancellationService CancellationService { get; }
[GenerateProperty] private DebugService DebugService { get; }
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; }
private ServerViewContainer ServerViewContainer { get; set; }
private List<ServerHubInfo> UnsortedServers { get; } = new();
//Design think
protected override void InitialiseInDesignMode()
{
ServerViewContainer = new ServerViewContainer(this, ViewHelperService);
HubErrors.Add(new Exception("UVI"));
}
//real think
protected override void Initialise()
{
ServerViewContainer = new ServerViewContainer(this, ViewHelperService);
foreach (var info in HubService.ServerList) UnsortedServers.Add(info);
HubService.HubServerChangedEventArgs += HubServerChangedEventArgs;
HubService.HubServerLoaded += UpdateServerEntries;
HubService.HubServerLoadingError += HubServerLoadingError;
OnSearchChange += OnChangeSearch;
if (!HubService.IsUpdating) UpdateServerEntries();
UpdateFavoriteEntries();
}
public void ApplyFilter()
{
foreach (var entry in ServerViewContainer.Items)
{
entry.ProcessFilter(CurrentFilter);
}
}
public void OnFilterChanged(FilterBoxChangedEventArgs args)
{
if (args.Checked)
CurrentFilter.Tags.Add(args.Tag);
else
CurrentFilter.Tags.Remove(args.Tag);
ApplyFilter();
}
private void HubServerLoadingError(Exception obj)
{
HubErrors.Add(obj);
}
private void UpdateServerEntries()
{
foreach(var fav in Servers.ToList()){
Servers.Remove(fav);
}
Task.Run(() =>
{
UnsortedServers.Sort(new ServerComparer());
foreach (var info in UnsortedServers)
{
var view = ServerViewContainer.Get(info.Address.ToRobustUrl(), info.StatusData);
Servers.Add(view);
}
ApplyFilter();
});
}
private void OnChangeSearch()
{
CurrentFilter.SearchText = SearchText;
ApplyFilter();
}
private void HubServerChangedEventArgs(HubServerChangedEventArgs obj)
{
if (obj.Action == HubServerChangeAction.Add)
foreach (var info in obj.Items)
UnsortedServers.Add(info);
if (obj.Action == HubServerChangeAction.Remove)
foreach (var info in obj.Items)
UnsortedServers.Remove(info);
if (obj.Action == HubServerChangeAction.Clear)
{
UnsortedServers.Clear();
ServerViewContainer.Clear();
UpdateFavoriteEntries();
}
}
public void FilterRequired()
{
IsFilterVisible = !IsFilterVisible;
}
public void AddFavoriteRequired()
{
var p = ViewHelperService.GetViewModel<AddFavoriteViewModel>();
PopupMessageService.Popup(p);
}
public void UpdateRequired()
{
HubErrors.Clear();
Task.Run(HubService.UpdateHub);
}
public void OnPageOpen(object? args)
{
if (args is bool fav)
{
IsFavoriteMode = fav;
}
}
}
public class ServerViewContainer(
ServerListViewModel serverListViewModel,
ViewHelperService viewHelperService
)
{
private readonly Dictionary<string, ServerEntryModelView> _entries = new();
public ICollection<ServerEntryModelView> Items => _entries.Values;
public void Clear()
{
_entries.Clear();
}
public ServerEntryModelView Get(RobustUrl url, ServerStatus? serverStatus = null)
{
ServerEntryModelView? entry;
lock (_entries)
{
if (_entries.TryGetValue(url.ToString(), out entry))
{
return entry;
}
entry = viewHelperService.GetViewModel<ServerEntryModelView>().WithData(url, serverStatus);
_entries.Add(url.ToString(), entry);
}
entry.OnFavoriteToggle += () =>
{
if (entry.IsFavorite) serverListViewModel.RemoveFavorite(entry);
else serverListViewModel.AddFavorite(entry);
};
return entry;
}
}
public class ServerComparer : IComparer<ServerHubInfo>, IComparer<ServerStatus>, IComparer<(RobustUrl,ServerStatus)>
{
public int Compare(ServerHubInfo? x, ServerHubInfo? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return Compare(x.StatusData, y.StatusData);
}
public int Compare(ServerStatus? x, ServerStatus? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return y.Players.CompareTo(x.Players);
}
public int Compare((RobustUrl, ServerStatus) x, (RobustUrl, ServerStatus) y)
{
return Compare(x.Item2, y.Item2);
}
}
public sealed class ServerFilter
{
public string SearchText { get; set; } = "";
public HashSet<string> Tags { get; } = new();
public bool IsMatchByName(string name)
{
if (string.IsNullOrWhiteSpace(SearchText))
return true;
return name.Contains(SearchText, StringComparison.OrdinalIgnoreCase);
}
public bool IsMatchByTags(IEnumerable<string> itemTags)
{
if (Tags.Count == 0)
return true;
var itemTagSet = new HashSet<string>(itemTags);
return Tags.All(tag => itemTagSet.Contains(tag));
}
public bool IsMatch(string name, IEnumerable<string> itemTags)
{
return IsMatchByName(name) && IsMatchByTags(itemTags);
}
}

View File

@@ -0,0 +1,323 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.Controls;
using Nebula.Launcher.Models;
using Nebula.Launcher.ServerListProviders;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ViewModels.Pages;
[ViewModelRegister(typeof(ServerOverviewView))]
[ConstructGenerator]
public partial class ServerOverviewModel : ViewModelBase
{
[ObservableProperty] private string _searchText = string.Empty;
[ObservableProperty] private bool _isFilterVisible;
[ObservableProperty] private ServerListView _currentServerList = new();
public readonly ServerFilter CurrentFilter = new();
public Action? OnSearchChange;
[GenerateProperty] private IServiceProvider ServiceProvider { get; }
[GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
public ObservableCollection<ServerListTabTemplate> Items { get; private set; }
[ObservableProperty] private ServerListTabTemplate _selectedItem;
[GenerateProperty, DesignConstruct] private ServerViewContainer ServerViewContainer { get; }
private Dictionary<string, ServerListView> _viewCache = [];
//Design think
protected override void InitialiseInDesignMode()
{
Items = new ObservableCollection<ServerListTabTemplate>([
new ServerListTabTemplate(new TestServerList(), "Test think"),
new ServerListTabTemplate(new TestServerList(), "Test think2")
]);
SelectedItem = Items[0];
}
//real think
protected override void Initialise()
{
ConfigurationService.SubscribeVarChanged(LauncherConVar.Hub, OnHubListChanged, true);
}
private void OnHubListChanged(ServerHubRecord[]? value)
{
var tempItems = new List<ServerListTabTemplate>();
foreach (var record in value ?? [])
{
tempItems.Add(new ServerListTabTemplate(ServiceProvider.GetService<HubServerListProvider>()!.With(record.MainUrl), record.Name));
}
tempItems.Add(new ServerListTabTemplate(FavoriteServerListProvider, "Favorite"));
Items = new ObservableCollection<ServerListTabTemplate>(tempItems);
SelectedItem = Items[0];
OnSearchChange += SearchChangeEvent;
}
private void SearchChangeEvent()
{
CurrentFilter.SearchText = SearchText;
ApplyFilter();
}
public void ApplyFilter()
{
foreach (var entry in ServerViewContainer.Items)
{
if(entry is IFilterConsumer filterConsumer)
filterConsumer.ProcessFilter(CurrentFilter);
}
}
public void OnFilterChanged(FilterBoxChangedEventArgs args)
{
if (args.Checked)
CurrentFilter.Tags.Add(args.Tag);
else
CurrentFilter.Tags.Remove(args.Tag);
ApplyFilter();
}
public void FilterRequired()
{
IsFilterVisible = !IsFilterVisible;
}
public void UpdateRequired()
{
ServerViewContainer.Clear();
CurrentServerList.RefreshFromProvider();
CurrentServerList.RequireStatusUpdate();
CurrentServerList.ApplyFilter(CurrentFilter);
}
partial void OnSelectedItemChanged(ServerListTabTemplate value)
{
if (!_viewCache.TryGetValue(value.TabName, out var view))
{
view = ServerListView.TakeFrom(value.ServerListProvider);
_viewCache[value.TabName] = view;
}
CurrentServerList = view;
ApplyFilter();
}
}
[ServiceRegister]
public class ServerViewContainer
{
private readonly ViewHelperService _viewHelperService;
private readonly List<string> _favorites = [];
private readonly Dictionary<string, string> _customNames = [];
public ServerViewContainer()
{
_viewHelperService = new ViewHelperService();
}
[UsedImplicitly]
public ServerViewContainer(ViewHelperService viewHelperService, ConfigurationService configurationService)
{
_viewHelperService = viewHelperService;
configurationService.SubscribeVarChanged(LauncherConVar.Favorites, OnFavoritesChange, true);
configurationService.SubscribeVarChanged(LauncherConVar.ServerCustomNames, OnCustomNamesChanged, true);
}
private void OnCustomNamesChanged(Dictionary<string,string>? value)
{
var oldNames =
_customNames.ToDictionary(k => k.Key, v => v.Value); //Clone think
_customNames.Clear();
if(value == null)
{
foreach (var (ip,_) in oldNames)
{
if(!_entries.TryGetValue(ip, out var listEntry) || listEntry is not IEntryNameHolder entryNameHolder)
continue;
entryNameHolder.Name = null;
}
return;
}
foreach (var (oldIp, oldName) in oldNames)
{
if(value.TryGetValue(oldIp, out var newName))
{
if (oldName == newName)
value.Remove(newName);
continue;
}
if(!_entries.TryGetValue(oldIp, out var listEntry) ||
listEntry is not IEntryNameHolder entryNameHolder)
continue;
entryNameHolder.Name = null;
}
foreach (var (ip, name) in value)
{
_customNames.Add(ip, name);
if(!_entries.TryGetValue(ip, out var listEntry) || listEntry is not IEntryNameHolder entryNameHolder)
continue;
entryNameHolder.Name = name;
}
}
private void OnFavoritesChange(string[]? value)
{
_favorites.Clear();
if(value == null) return;
foreach (var favorite in value)
{
_favorites.Add(favorite);
if (_entries.TryGetValue(favorite, out var entry) && entry is IFavoriteEntryModelView favoriteView)
{
favoriteView.IsFavorite = true;
}
}
}
private readonly Dictionary<string, IListEntryModelView> _entries = new();
public ICollection<IListEntryModelView> Items => _entries.Values;
public void Clear()
{
_entries.Clear();
}
public IListEntryModelView Get(RobustUrl url, ServerStatus? serverStatus = null)
{
IListEntryModelView? entry;
lock (_entries)
{
_customNames.TryGetValue(url.ToString(), out var customName);
if (_entries.TryGetValue(url.ToString(), out entry))
{
return entry;
}
if (serverStatus is not null)
entry = _viewHelperService.GetViewModel<ServerEntryModelView>().WithData(url, customName, serverStatus);
else
entry = _viewHelperService.GetViewModel<ServerCompoundEntryViewModel>().LoadServerEntry(url, customName, CancellationToken.None);
if(_favorites.Contains(url.ToString()) &&
entry is IFavoriteEntryModelView favoriteEntryModelView)
favoriteEntryModelView.IsFavorite = true;
_entries.Add(url.ToString(), entry);
}
return entry;
}
}
public interface IListEntryModelView
{
}
public interface IFavoriteEntryModelView
{
public bool IsFavorite { get; set; }
}
public interface IEntryNameHolder
{
public string? Name { get; set; }
}
public class ServerComparer : IComparer<ServerHubInfo>, IComparer<ServerStatus>, IComparer<(RobustUrl,ServerStatus)>
{
public int Compare(ServerHubInfo? x, ServerHubInfo? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return Compare(x.StatusData, y.StatusData);
}
public int Compare(ServerStatus? x, ServerStatus? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
return y.Players.CompareTo(x.Players);
}
public int Compare((RobustUrl, ServerStatus) x, (RobustUrl, ServerStatus) y)
{
return Compare(x.Item2, y.Item2);
}
}
public sealed class ServerFilter
{
public string SearchText { get; set; } = "";
public HashSet<string> Tags { get; } = new();
public bool IsMatchByName(string name)
{
if (string.IsNullOrWhiteSpace(SearchText))
return true;
return name.Contains(SearchText, StringComparison.OrdinalIgnoreCase);
}
public bool IsMatchByTags(IEnumerable<string> itemTags)
{
if (Tags.Count == 0)
return true;
var itemTagSet = new HashSet<string>(itemTags);
return Tags.All(tag => itemTagSet.Contains(tag));
}
public bool IsMatch(string name, IEnumerable<string> itemTags)
{
return IsMatchByName(name) && IsMatchByTags(itemTags);
}
}
public sealed record ServerCustomNameEntry(string Url, string Name);

View File

@@ -1,5 +1,7 @@
using System;
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.ServerListProviders;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.Views.Pages;
using Nebula.Shared.Services;
@@ -26,9 +28,10 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
[GenerateProperty]
public override PopupMessageService PopupMessageService { get; }
[GenerateProperty] private ServerListViewModel ServerListViewModel { get; }
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
[GenerateProperty] private DebugService DebugService { get; }
public override string Title => "Add to favorite";
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
public override string Title => LocalisationService.GetString("popup-add-favorite");
public override bool IsClosable => true;
[ObservableProperty] private string _ipInput;
@@ -39,7 +42,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
try
{
var uri = IpInput.ToRobustUrl();
ServerListViewModel.AddFavorite(uri);
FavoriteServerListProvider.AddFavorite(uri);
Dispose();
}
catch (Exception e)

View File

@@ -0,0 +1,57 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services;
namespace Nebula.Launcher.ViewModels.Popup;
[ViewModelRegister(typeof(EditServerNameView), false)]
[ConstructGenerator]
public sealed partial class EditServerNameViewModel : PopupViewModelBase
{
[GenerateProperty] public override PopupMessageService PopupMessageService { get; }
[GenerateProperty] public ConfigurationService ConfigurationService { get; }
public override string Title => LocalisationService.GetString("popup-edit-name");
public override bool IsClosable => true;
[ObservableProperty] private string _ipInput;
[ObservableProperty] private string _nameInput;
public void OnEnter()
{
if(string.IsNullOrWhiteSpace(IpInput))
return;
if (string.IsNullOrWhiteSpace(NameInput))
{
RemoveServerName();
Dispose();
return;
}
AddServerName();
Dispose();
}
private void AddServerName()
{
var currentNames = ConfigurationService.GetConfigValue(LauncherConVar.ServerCustomNames)!;
currentNames.Add(IpInput, NameInput);
ConfigurationService.SetConfigValue(LauncherConVar.ServerCustomNames, currentNames);
}
private void RemoveServerName()
{
var currentNames = ConfigurationService.GetConfigValue(LauncherConVar.ServerCustomNames)!;
currentNames.Remove(IpInput);
ConfigurationService.SetConfigValue(LauncherConVar.ServerCustomNames, currentNames);
}
protected override void InitialiseInDesignMode()
{
}
protected override void Initialise()
{
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.ObjectModel;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services;
@@ -10,7 +11,7 @@ namespace Nebula.Launcher.ViewModels.Popup;
public sealed partial class ExceptionListViewModel : PopupViewModelBase
{
[GenerateProperty] public override PopupMessageService PopupMessageService { get; }
public override string Title => "Exception was thrown";
public override string Title => LocalisationService.GetString("popup-exception");
public override bool IsClosable => true;
public ObservableCollection<Exception> Errors { get; } = new();

View File

@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services;
@@ -12,7 +13,7 @@ public partial class InfoPopupViewModel : PopupViewModelBase
[ObservableProperty] private string _infoText = "Test";
public override string Title => "Info";
public override string Title => LocalisationService.GetString("popup-information");
public bool IsInfoClosable { get; set; } = true;
public override bool IsClosable => IsInfoClosable;

View File

@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
@@ -16,7 +17,7 @@ public sealed partial class LoadingContextViewModel : PopupViewModelBase, ILoadi
[ObservableProperty] private int _resolvedJobs;
public string LoadingName { get; set; } = "Loading...";
public string LoadingName { get; set; } = LocalisationService.GetString("popup-loading");
public bool IsCancellable { get; set; } = true;
public override bool IsClosable => false;

View File

@@ -1,4 +1,6 @@
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using Avalonia.Media;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services;
@@ -35,4 +37,45 @@ public sealed partial class LogPopupModelView : PopupViewModelBase
{
Logs.Add(LogInfo.FromString(str));
}
public void Clear()
{
Logs.Clear();
}
}
public sealed class LogInfo
{
public string Category { get; set; } = "LOG";
public IBrush CategoryColor { get; set; } = Brush.Parse("#424242");
public string Message { get; set; } = "";
public static LogInfo FromString(string input)
{
var matches = Regex.Matches(input, @"(\[(?<c>.*)\] (?<m>.*))|(?<m>.*)");
var category = "All";
if (matches[0].Groups.TryGetValue("c", out var c)) category = c.Value;
var color = Brush.Parse("#444444");
switch (category)
{
case "DEBG":
color = Brush.Parse("#2436d4");
break;
case "ERRO":
color = Brush.Parse("#d42436");
break;
case "INFO":
color = Brush.Parse("#0ab3c9");
break;
}
var message = matches[0].Groups["m"].Value;
return new LogInfo
{
Category = category, Message = message, CategoryColor = color
};
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services;
@@ -24,6 +25,6 @@ public partial class TfaViewModel : PopupViewModelBase
}
[GenerateProperty] public override PopupMessageService PopupMessageService { get; }
public override string Title => "2fa";
public override string Title => LocalisationService.GetString("popup-twofa");
public override bool IsClosable => true;
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Launcher.ServerListProviders;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.Views;
using Nebula.Shared.Models;
using Nebula.Shared.Services;
using BindingFlags = System.Reflection.BindingFlags;
namespace Nebula.Launcher.ViewModels;
[ViewModelRegister(typeof(ServerCompoundEntryView), false)]
[ConstructGenerator]
public sealed partial class ServerCompoundEntryViewModel :
ViewModelBase, IFavoriteEntryModelView, IFilterConsumer, IListEntryModelView, IEntryNameHolder
{
[ObservableProperty] private ServerEntryModelView? _currentEntry;
[ObservableProperty] private Control? _entryControl;
[ObservableProperty] private string _message = "Loading server entry...";
[ObservableProperty] private bool _isFavorite;
[ObservableProperty] private bool _loading = true;
private string? _name;
public string? Name
{
get => _name;
set
{
_name = value;
OnPropertyChanged();
if (CurrentEntry != null)
CurrentEntry.Name = value;
}
}
[GenerateProperty] private RestService RestService { get; }
[GenerateProperty] private IServiceProvider ServiceProvider{ get; }
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
protected override void InitialiseInDesignMode()
{
Name = "TEST.TEST";
}
protected override void Initialise()
{
}
public ServerCompoundEntryViewModel LoadServerEntry(RobustUrl url,string? name, CancellationToken cancellationToken)
{
Task.Run(async () =>
{
try
{
Message = "Loading server entry...";
var status = await RestService.GetAsync<ServerStatus>(url.StatusUri, cancellationToken);
CurrentEntry = ServiceProvider.GetService<ServerEntryModelView>()!.WithData(url,name, status);
CurrentEntry.IsFavorite = IsFavorite;
CurrentEntry.Loading = false;
Loading = false;
}
catch (Exception e)
{
Message = e.Message;
}
}, cancellationToken);
return this;
}
public void ToggleFavorites()
{
CurrentEntry?.ToggleFavorites();
}
public void ProcessFilter(ServerFilter? serverFilter)
{
if(CurrentEntry is IFilterConsumer filterConsumer)
filterConsumer.ProcessFilter(serverFilter);
}
}

View File

@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia.Controls;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.ProcessHelper;
using Nebula.Launcher.ServerListProviders;
using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.ViewModels.Popup;
@@ -23,34 +21,39 @@ namespace Nebula.Launcher.ViewModels;
[ViewModelRegister(typeof(ServerEntryView), false)]
[ConstructGenerator]
public partial class ServerEntryModelView : ViewModelBase
public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, IListEntryModelView, IFavoriteEntryModelView, IEntryNameHolder
{
[ObservableProperty] private string _description = "Fetching info...";
[ObservableProperty] private bool _expandInfo;
[ObservableProperty] private bool _isFavorite;
[ObservableProperty] private bool _isVisible;
private string _lastError = "";
private Process? _p;
private ILogger _logger;
private ILogger? _processLogger;
private ServerInfo? _serverInfo;
[ObservableProperty] private bool _runVisible = true;
[ObservableProperty] private bool _tagDataVisible;
[ObservableProperty] private bool _loading;
[ObservableProperty] private string _realName;
public string? Name
{
get => RealName;
set => RealName = value ?? Status.Name;
}
private ILogger _logger;
private ServerInfo? _serverInfo;
private ContentLogConsumer _currentContentLogConsumer;
private ProcessRunHandler<GameProcessStartInfoProvider>? _currentInstance;
public LogPopupModelView CurrLog;
public Action? OnFavoriteToggle;
public RobustUrl Address { get; private set; }
[GenerateProperty] private AuthService AuthService { get; } = default!;
[GenerateProperty] private ContentService ContentService { get; } = default!;
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
[GenerateProperty] private CancellationService CancellationService { get; } = default!;
[GenerateProperty] private DebugService DebugService { get; } = default!;
[GenerateProperty] private RunnerService RunnerService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
[GenerateProperty] private ViewHelperService ViewHelperService { get; } = default!;
[GenerateProperty] private RestService RestService { get; } = default!;
[GenerateProperty] private MainViewModel MainViewModel { get; } = default!;
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; } = default!;
[GenerateProperty] private GameRunnerPreparer GameRunnerPreparer { get; } = default!;
public ServerStatus Status { get; private set; } =
new(
@@ -66,22 +69,9 @@ public partial class ServerEntryModelView : ViewModelBase
);
public ObservableCollection<ServerLink> Links { get; } = new();
public bool RunVisible => Process == null;
public ObservableCollection<string> Tags { get; } = [];
public ICommand OnLinkGo { get; } = new LinkGoCommand();
private Process? Process
{
get => _p;
set
{
_p = value;
OnPropertyChanged(nameof(RunVisible));
}
}
public async Task<ServerInfo?> GetServerInfo()
{
if (_serverInfo == null)
@@ -100,6 +90,8 @@ public partial class ServerEntryModelView : ViewModelBase
protected override void InitialiseInDesignMode()
{
IsVisible = true;
RealName = "TEST.TEST";
Description = "Server of meow girls! Nya~ \nNyaMeow\nOOOINK!!";
Links.Add(new ServerLink("Discord", "discord", "https://cinka.ru"));
Status = new ServerStatus("Ameba",
@@ -114,10 +106,17 @@ public partial class ServerEntryModelView : ViewModelBase
{
_logger = DebugService.GetLogger(this);
CurrLog = ViewHelperService.GetViewModel<LogPopupModelView>();
_currentContentLogConsumer = new(CurrLog, PopupMessageService);
}
public void ProcessFilter(ServerFilter serverFilter)
public void ProcessFilter(ServerFilter? serverFilter)
{
if (serverFilter == null)
{
IsVisible = true;
return;
}
IsVisible = serverFilter.IsMatch(Status.Name, Tags);
}
@@ -128,163 +127,78 @@ public partial class ServerEntryModelView : ViewModelBase
foreach (var tag in Status.Tags) Tags.Add(tag);
OnPropertyChanged(nameof(Status));
}
public ServerEntryModelView WithData(RobustUrl url, ServerStatus? serverStatus)
public ServerEntryModelView WithData(RobustUrl url, string? name,ServerStatus serverStatus)
{
Address = url;
if (serverStatus is not null)
SetStatus(serverStatus);
else
FetchStatus();
SetStatus(serverStatus);
Name = name;
return this;
}
private async void FetchStatus()
public void EditName()
{
try
{
SetStatus(await RestService.GetAsync<ServerStatus>(Address.StatusUri, CancellationService.Token));
}
catch (Exception e)
{
_logger.Error(e);
Status = new ServerStatus("ErrorLand", $"ERROR: {e.Message}", [], "", -1, -1, -1, false,
DateTime.Now,
-1);
}
var popup = ViewHelperService.GetViewModel<EditServerNameViewModel>();
popup.IpInput = Address.ToString();
popup.NameInput = Name ?? string.Empty;
PopupMessageService.Popup(popup);
}
public void OpenContentViewer()
{
MainViewModel.RequirePage<ContentBrowserViewModel>().Go(Address.ToString(), new ContentPath());
MainViewModel.RequirePage<ContentBrowserViewModel>().Go(Address, ContentPath.Empty);
}
public void ToggleFavorites()
{
OnFavoriteToggle?.Invoke();
IsFavorite = !IsFavorite;
if(IsFavorite)
FavoriteServerListProvider.AddFavorite(this);
else
FavoriteServerListProvider.RemoveFavorite(this);
}
public void RunInstance()
{
Task.Run(RunAsync);
{
CurrLog.Clear();
Task.Run(RunInstanceAsync);
}
public async Task RunAsync()
private async void RunInstanceAsync()
{
try
{
var authProv = AuthService.SelectedAuth;
using var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loadingContext.LoadingName = "Loading instance...";
((ILoadingHandler)loadingContext).AppendJob();
var buildInfo =
await ContentService.GetBuildInfo(Address, CancellationService.Token);
using (var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>())
{
loadingContext.LoadingName = "Loading instance...";
((ILoadingHandler)loadingContext).AppendJob();
PopupMessageService.Popup(loadingContext);
await RunnerService.PrepareRun(buildInfo, loadingContext, CancellationService.Token);
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
Process = Process.Start(new ProcessStartInfo
{
FileName = "dotnet.exe",
Arguments = Path.Join(path, "Nebula.Runner.dll"),
Environment =
{
{ "ROBUST_AUTH_USERID", authProv?.UserId.ToString() },
{ "ROBUST_AUTH_TOKEN", authProv?.Token.Token },
{ "ROBUST_AUTH_SERVER", authProv?.AuthServer },
{ "ROBUST_AUTH_PUBKEY", buildInfo.BuildInfo.Auth.PublicKey },
{ "GAME_URL", Address.ToString() },
{ "AUTH_LOGIN", authProv?.Login }
},
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8
});
((ILoadingHandler)loadingContext).AppendResolvedJob();
}
if (Process is null) return;
PopupMessageService.Popup(loadingContext);
_currentInstance =
await GameRunnerPreparer.GetGameProcessStartInfoProvider(Address, loadingContext, CancellationService.Token);
_processLogger = DebugService.GetLogger($"PROCESS_{Process.Id}");
Process.EnableRaisingEvents = true;
Process.BeginOutputReadLine();
Process.BeginErrorReadLine();
Process.OutputDataReceived += OnOutputDataReceived;
Process.ErrorDataReceived += OnErrorDataReceived;
Process.Exited += OnExited;
}
catch (TaskCanceledException e)
{
PopupMessageService.Popup("Task canceled: " + e.Message);
_logger.Error("Task canceled");
_logger.Error(e);
}
catch (Exception e)
{
PopupMessageService.Popup(e);
}
_currentInstance.RegisterLogger(_currentContentLogConsumer);
_currentInstance.RegisterLogger(new DebugLoggerBridge(DebugService.GetLogger($"PROCESS_{Random.Shared.Next(65535)}")));
_currentInstance.OnProcessExited += OnProcessExited;
RunVisible = false;
_currentInstance.Start();
}
private void OnExited(object? sender, EventArgs e)
private void OnProcessExited(ProcessRunHandler<GameProcessStartInfoProvider> obj)
{
if (Process is null) return;
Process.OutputDataReceived -= OnOutputDataReceived;
Process.ErrorDataReceived -= OnErrorDataReceived;
Process.Exited -= OnExited;
_processLogger?.Log("PROCESS EXIT WITH CODE " + Process.ExitCode);
if (Process.ExitCode != 0)
PopupMessageService.Popup($"Game exit with code {Process.ExitCode}.\nReason: {_lastError}");
_processLogger?.Dispose();
RunVisible = true;
if (_currentInstance == null) return;
Process.Dispose();
Process = null;
}
private void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
_lastError = e.Data;
_processLogger?.Error(e.Data);
CurrLog.Append(e.Data);
}
}
private void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
_processLogger?.Log(e.Data);
CurrLog.Append(e.Data);
}
}
public void ReadLog()
{
PopupMessageService.Popup(CurrLog);
_currentInstance.OnProcessExited -= OnProcessExited;
_currentInstance.Dispose();
_currentInstance = null;
}
public void StopInstance()
{
Process?.CloseMainWindow();
_currentInstance?.Stop();
}
public void ReadLog()
{
PopupMessageService.Popup(CurrLog);
}
public async void ExpandInfoRequired()
@@ -301,58 +215,37 @@ public partial class ServerEntryModelView : ViewModelBase
if (info.Links is null) return;
foreach (var link in info.Links) Links.Add(link);
}
private static string FindDotnetPath()
{
var pathEnv = Environment.GetEnvironmentVariable("PATH");
var paths = pathEnv?.Split(Path.PathSeparator);
if (paths != null)
foreach (var path in paths)
{
var dotnetPath = Path.Combine(path, "dotnet");
if (File.Exists(dotnetPath)) return dotnetPath;
}
return "dotnet";
}
}
public sealed class LogInfo
public sealed class ContentLogConsumer : IProcessLogConsumer
{
public string Category { get; set; } = "LOG";
public IBrush CategoryColor { get; set; } = Brush.Parse("#424242");
public string Message { get; set; } = "";
private readonly LogPopupModelView _currLog;
private readonly PopupMessageService _popupMessageService;
public static LogInfo FromString(string input)
public ContentLogConsumer(LogPopupModelView currLog, PopupMessageService popupMessageService)
{
var matches = Regex.Matches(input, @"(\[(?<c>.*)\] (?<m>.*))|(?<m>.*)");
var category = "All";
_currLog = currLog;
_popupMessageService = popupMessageService;
}
if (matches[0].Groups.TryGetValue("c", out var c)) category = c.Value;
public void Out(string text)
{
_currLog.Append(text);
}
var color = Brush.Parse("#444444");
public void Error(string text)
{
_currLog.Append(text);
}
switch (category)
{
case "DEBG":
color = Brush.Parse("#2436d4");
break;
case "ERRO":
color = Brush.Parse("#d42436");
break;
case "INFO":
color = Brush.Parse("#0ab3c9");
break;
}
var message = matches[0].Groups["m"].Value;
return new LogInfo
{
Category = category, Message = message, CategoryColor = color
};
public void Fatal(string text)
{
_popupMessageService.Popup("Fatal error while stop instance:" + text);
}
}
public class LinkGoCommand : ICommand
{
public LinkGoCommand()
@@ -372,4 +265,9 @@ public class LinkGoCommand : ICommand
}
public event EventHandler? CanExecuteChanged;
}
public interface IFilterConsumer
{
public void ProcessFilter(ServerFilter? serverFilter);
}

View File

@@ -0,0 +1,52 @@
<UserControl 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"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="pages:FolderContentEntry"
x:Class="Nebula.Launcher.Views.FileContentEntryView">
<Design.DataContext>
<pages:FolderContentEntry/>
</Design.DataContext>
<ScrollViewer
Grid.Column="0"
Grid.ColumnSpan="4"
Grid.Row="1"
Margin="0,0,0,5">
<ItemsControl ItemsSource="{Binding Entries}" Padding="0,0,0,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type pages:IContentEntry}">
<Button
Command="{Binding GoCurrent}"
CornerRadius="0"
Height="30"
HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Spacing="15">
<Border
Background="#00000000"
BorderThickness="0,0,2,0"
CornerRadius="0">
<Svg
Height="15"
Margin="10,0,10,0"
Path="{Binding IconPath}" />
<Border.BorderBrush>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
<GradientStop Color="#442222" Offset="0.0" />
<GradientStop Color="#222222" Offset="1.0" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
<Label>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</Label>
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</UserControl>

View File

@@ -0,0 +1,22 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.Views;
public partial class FileContentEntryView : UserControl
{
// This constructor is used when the view is created by the XAML Previewer
public FileContentEntryView()
{
InitializeComponent();
}
// This constructor is used when the view is created via dependency injection
public FileContentEntryView(FolderContentEntry viewModel)
: this()
{
DataContext = viewModel;
}
}

View File

@@ -10,7 +10,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:Nebula.Shared.Models;assembly=Nebula.Shared"
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models1="clr-namespace:Nebula.Launcher.Models">
<Design.DataContext>
<viewModels:MainViewModel />
</Design.DataContext>
@@ -63,7 +64,7 @@
Padding="0"
SelectedItem="{Binding SelectedListItem}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type models:ListItemTemplate}">
<DataTemplate DataType="{x:Type models1:ListItemTemplate}">
<StackPanel Orientation="Horizontal" Spacing="19">
<Svg
Height="40"

View File

@@ -4,7 +4,7 @@
ExtendClientAreaTitleBarHeightHint="-1"
ExtendClientAreaToDecorationsHint="True"
Height="500"
Icon="/Assets/avalonia-logo.ico"
Icon="/Assets/nebula.ico"
MinHeight="500"
MinWidth="800"
SystemDecorations="BorderOnly"

View File

@@ -5,6 +5,7 @@
x:Class="Nebula.Launcher.Views.Pages.AccountInfoView"
x:DataType="pages:AccountInfoViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
@@ -28,7 +29,7 @@
<GradientStop Color="#292222" Offset="1.0" />
</LinearGradientBrush>
</Border.Background>
<Label HorizontalAlignment="Center">Profiles:</Label>
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="account-profiles"/>
</Border>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ItemsControl
@@ -59,17 +60,13 @@
Command="{Binding OnSelect}"
CornerRadius="0,0,0,10"
Padding="5">
<Label>
Select
</Label>
<customControls:LocalizedLabel LocalId="account-profile-select"/>
</Button>
<Button
Command="{Binding OnDelete}"
CornerRadius="0,10,0,0"
Padding="5">
<Label>
Delete
</Label>
<customControls:LocalizedLabel LocalId="account-profile-delete"/>
</Button>
</StackPanel>
</Panel>
@@ -102,22 +99,27 @@
Margin="0,0,0,20"
Path="/Assets/svg/user.svg" />
<StackPanel HorizontalAlignment="Center">
<StackPanel IsVisible="{Binding DoRetryAuth}">
<Border Background="{StaticResource DefaultSelected}" BoxShadow="{StaticResource DefaultShadow}">
<Button
Command="{Binding DoCurrentAuth}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center">
<customControls:LocalizedLabel LocalId="account-auth-retry"/>
</Button>
</Border>
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="account-auth-try-another"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label VerticalAlignment="Center">
Login:
</Label>
<customControls:LocalizedLabel VerticalAlignment="Center" LocalId="account-auth-login"/>
<TextBox Text="{Binding CurrentLogin}" MinWidth="200" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label HorizontalAlignment="Left" VerticalAlignment="Center">
Password:
</Label>
<customControls:LocalizedLabel HorizontalAlignment="Left" VerticalAlignment="Center" LocalId="account-auth-password"/>
<TextBox PasswordChar="#" MinWidth="200" Text="{Binding CurrentPassword}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label VerticalAlignment="Center">
Auth server:
</Label>
<customControls:LocalizedLabel VerticalAlignment="Center" LocalId="account-auth-server"/>
<Button Command="{Binding ExpandAuthUrlCommand}" VerticalAlignment="Stretch">
<Label>+</Label>
</Button>
@@ -150,7 +152,7 @@
Command="{Binding DoAuth}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center">
<Label>Auth</Label>
<customControls:LocalizedLabel LocalId="account-auth-button"/>
</Button>
</Border>
<Border BoxShadow="{StaticResource DefaultShadow}">
@@ -158,7 +160,7 @@
Command="{Binding SaveProfileCommand}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center">
<Label>Save profile</Label>
<customControls:LocalizedLabel LocalId="account-auth-save"/>
</Button>
</Border>
<Button Command="{Binding ExpandAuthViewCommand}" HorizontalAlignment="Right">
@@ -175,7 +177,7 @@
Path="/Assets/svg/user.svg" />
<Label>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock>Hello,</TextBlock>
<customControls:LocalizedLabel LocalId="account-auth-hello"/>
<TextBlock Text="{Binding CurrentLogin}" />
</StackPanel>
</Label>
@@ -186,12 +188,12 @@
Spacing="5">
<Border BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding Logout}">
<Label>Logout</Label>
<customControls:LocalizedLabel LocalId="account-auth-logout"/>
</Button>
</Border>
<Border BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding SaveProfileCommand}">
<Label>Save profile</Label>
<customControls:LocalizedLabel LocalId="account-auth-save"/>
</Button>
</Border>
</StackPanel>

View File

@@ -0,0 +1,66 @@
<UserControl 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"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Nebula.Launcher.Views.Pages.ConfigurationView"
x:DataType="pages:ConfigurationViewModel">
<Design.DataContext>
<pages:ConfigurationViewModel />
</Design.DataContext>
<ScrollViewer>
<StackPanel Spacing="10" Margin="10">
<ItemsControl
ItemsSource="{Binding ConfigurationVerbose}"
Padding="0" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Spacing="10" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<StackPanel Orientation="Horizontal" Spacing="5">
<Button
Classes="ConfigBorder"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Padding="5"
Margin="5"
Command="{Binding InvokeUpdateConfiguration}">
<customControls:LocalizedLabel LocalId="config-save"/>
</Button>
<Button
Classes="ConfigBorder"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Padding="5"
Margin="5"
Command="{Binding ResetConfig}">
<customControls:LocalizedLabel LocalId="config-reset"/>
</Button>
<Button
Classes="ConfigBorder"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Padding="5"
Margin="5"
Command="{Binding OpenDataFolder}">
<customControls:LocalizedLabel LocalId="config-open-data"/>
</Button>
<Button
Classes="ConfigBorder"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Padding="5"
Margin="5"
Command="{Binding ExportLogs}">
<customControls:LocalizedLabel LocalId="config-export-logs"/>
</Button>
</StackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>

View File

@@ -0,0 +1,20 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.Views.Pages;
public partial class ConfigurationView : UserControl
{
public ConfigurationView()
{
InitializeComponent();
}
public ConfigurationView(ConfigurationViewModel viewModel)
: this()
{
DataContext = viewModel;
}
}

View File

@@ -8,7 +8,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:services="clr-namespace:Nebula.Launcher.Services">
<Design.DataContext>
<pages:ContentBrowserViewModel />
</Design.DataContext>
@@ -31,14 +32,14 @@
Margin="5"
Text="{Binding ServerText}"
VerticalAlignment="Center"
Watermark="Server Url..." />
Watermark="{services:LocaledText content-view-server}" />
<TextBox
Grid.Column="1"
Grid.Row="0"
Margin="5"
Text="{Binding SearchText}"
VerticalAlignment="Center"
Watermark="Path..." />
Watermark="{services:LocaledText content-view-path}" />
<Button
Command="{Binding OnBackEnter}"
Grid.Column="2"
@@ -61,44 +62,11 @@
<Svg Path="/Assets/svg/next.svg" />
</Button>
<ScrollViewer
Grid.Column="0"
Grid.ColumnSpan="4"
Grid.Row="1"
Margin="0,0,0,5">
<ItemsControl ItemsSource="{Binding Entries}" Padding="0,0,0,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type pages:ContentEntry}">
<Button
Command="{Binding OnPathGo}"
CornerRadius="0"
Height="30"
HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Spacing="15">
<Border
Background="#00000000"
BorderThickness="0,0,2,0"
CornerRadius="0">
<Svg
Height="15"
Margin="10,0,10,0"
Path="{Binding IconPath}" />
<Border.BorderBrush>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
<GradientStop Color="#442222" Offset="0.0" />
<GradientStop Color="#222222" Offset="1.0" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
<Label>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</Label>
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ScrollViewer Grid.Column="0"
Grid.ColumnSpan="4"
Grid.Row="1" Content="{Binding CurrentEntry}">
</ScrollViewer>
</Grid>
</UserControl>

View File

@@ -2,48 +2,58 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.Pages.ServerListView"
x:DataType="pages:ServerListViewModel"
x:Class="Nebula.Launcher.Views.Pages.ServerOverviewView"
x:DataType="pages:ServerOverviewModel"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Nebula.Launcher.Controls">
xmlns:controls="clr-namespace:Nebula.Launcher.Controls"
xmlns:models="clr-namespace:Nebula.Launcher.Models"
xmlns:services="clr-namespace:Nebula.Launcher.Services">
<Design.DataContext>
<pages:ServerListViewModel />
<pages:ServerOverviewModel />
</Design.DataContext>
<Grid
ColumnDefinitions="*"
Margin="0"
RowDefinitions="*,40">
<ScrollViewer
Grid.RowSpan="2"
Margin="5,0,0,10"
Padding="0,0,10,0">
<StackPanel Margin="0,0,0,30">
<ItemsControl ItemsSource="{Binding HubErrors}" Margin="10,0,10,0" />
<ItemsControl
IsVisible="{Binding IsFavoriteMode}"
ItemsSource="{Binding FavoriteServers}"
Padding="0" />
<ItemsControl
IsVisible="{Binding !IsFavoriteMode}"
ItemsSource="{Binding Servers}"
Padding="0" />
</StackPanel>
</ScrollViewer>
RowDefinitions="40,*,40">
<Border Grid.Row="0"
<ListBox
Background="Transparent"
ItemsSource="{Binding Items}"
Padding="0"
SelectedItem="{Binding SelectedItem}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type models:ServerListTabTemplate}">
<StackPanel Orientation="Horizontal" Spacing="19">
<TextBlock Text="{Binding TabName}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Border
Child="{Binding CurrentServerList}"
Grid.Row="1"
Grid.RowSpan="2" />
<Border Grid.Row="1"
Background="{StaticResource DefaultGrad}"
Margin="0,0,0,0" CornerRadius="20,20,0,0"
VerticalAlignment="Bottom"
IsVisible="{Binding IsFilterVisible}">
<StackPanel Orientation="Vertical" Spacing="2" Margin="15">
<controls:FilterBox Name="EssentialFilters" FilterBoxName="Roleplay" FilterCommand="{Binding OnFilterChanged}"/>
<controls:FilterBox Name="LanguageFilters" FilterBoxName="Language" FilterCommand="{Binding OnFilterChanged}"/>
<controls:FilterBox Name="EssentialFilters" FilterBoxName="filter-roleplay" FilterCommand="{Binding OnFilterChanged}"/>
<controls:FilterBox Name="LanguageFilters" FilterBoxName="filter-language" FilterCommand="{Binding OnFilterChanged}"/>
</StackPanel>
</Border>
@@ -51,11 +61,11 @@
Background="{StaticResource DefaultGrad}"
BoxShadow="0 2 25 0 #121212"
CornerRadius="0"
Grid.Row="1" />
Grid.Row="2" />
<Grid
ColumnDefinitions="*,40,40,40"
Grid.Row="1"
Grid.Row="2"
Margin="-25,0,0,0"
RowDefinitions="*">
<TextBox
@@ -63,13 +73,7 @@
Text="{Binding SearchText}"
TextChanged="TextBox_OnTextChanged"
VerticalAlignment="Center"
Watermark="Server name..." />
<Button
Command="{Binding AddFavoriteRequired}"
Grid.Column="1"
Padding="10">
<Svg IsVisible="{Binding IsFavoriteMode}" Path="/Assets/svg/star.svg" />
</Button>
Watermark="{services:LocaledText 'server-search'}" />
<Button
Command="{Binding FilterRequired}"
Grid.Column="2"

View File

@@ -1,12 +1,12 @@
using Avalonia.Controls;
using ServerListViewModel = Nebula.Launcher.ViewModels.Pages.ServerListViewModel;
using Nebula.Launcher.ViewModels.Pages;
namespace Nebula.Launcher.Views.Pages;
public partial class ServerListView : UserControl
public partial class ServerOverviewView : UserControl
{
// This constructor is used when the view is created by the XAML Previewer
public ServerListView()
public ServerOverviewView()
{
InitializeComponent();
@@ -21,7 +21,7 @@ public partial class ServerListView : UserControl
}
// This constructor is used when the view is created via dependency injection
public ServerListView(ServerListViewModel viewModel)
public ServerOverviewView(ServerOverviewModel viewModel)
: this()
{
DataContext = viewModel;
@@ -29,7 +29,7 @@ public partial class ServerListView : UserControl
private void TextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
{
var context = (ServerListViewModel?)DataContext;
var context = (ServerOverviewModel?)DataContext;
context?.OnSearchChange?.Invoke();
}
}

View File

@@ -8,6 +8,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:popup="clr-namespace:Nebula.Launcher.ViewModels.Popup"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.DataContext>
<popup:AddFavoriteViewModel />
@@ -18,7 +19,7 @@
</Border>
<Border Background="{StaticResource DefaultSelected}" BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding OnEnter}" HorizontalAlignment="Stretch">
<Label HorizontalAlignment="Center">Add</Label>
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="favorite-add"/>
</Button>
</Border>
<Label>

View File

@@ -0,0 +1,27 @@
<UserControl 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"
xmlns:popup="clr-namespace:Nebula.Launcher.ViewModels.Popup"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Nebula.Launcher.Views.Popup.EditServerNameView"
x:DataType="popup:EditServerNameViewModel">
<Design.DataContext>
<popup:EditServerNameViewModel />
</Design.DataContext>
<StackPanel Margin="15" Spacing="10">
<Border BoxShadow="{StaticResource DefaultShadow}">
<TextBlock Text="{Binding IpInput}" Margin="10,8,10,8"/>
</Border>
<Border BoxShadow="{StaticResource DefaultShadow}">
<TextBox Text="{Binding NameInput}" Watermark="custom server name" />
</Border>
<Border Background="{StaticResource DefaultSelected}" BoxShadow="{StaticResource DefaultShadow}">
<Button Command="{Binding OnEnter}" HorizontalAlignment="Stretch">
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="servername-set"/>
</Button>
</Border>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,20 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Nebula.Launcher.ViewModels.Popup;
namespace Nebula.Launcher.Views.Popup;
public partial class EditServerNameView : UserControl
{
public EditServerNameView()
{
InitializeComponent();
}
public EditServerNameView(EditServerNameViewModel viewModel)
: this()
{
DataContext = viewModel;
}
}

View File

@@ -15,7 +15,7 @@
<Panel HorizontalAlignment="Center" VerticalAlignment="Center">
<Label>
<TextBlock Text="{Binding InfoText}" />
<TextBlock Text="{Binding InfoText}" TextWrapping="Wrap"/>
</Label>
</Panel>
</UserControl>

View File

@@ -2,6 +2,7 @@
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"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
xmlns:popup="clr-namespace:Nebula.Launcher.ViewModels.Popup"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Nebula.Launcher.Views.Popup.LoadingContextView"
@@ -29,7 +30,7 @@
VerticalAlignment="Center"
Command="{Binding Cancel}"
IsVisible="{Binding IsCancellable}">
<Label>Cancel</Label>
<customControls:LocalizedLabel LocalId="task-cancel"/>
</Button>
</Panel>
</StackPanel>

View File

@@ -17,7 +17,7 @@
ItemsSource="{Binding Logs}"
Padding="0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type viewModels:LogInfo}">
<DataTemplate DataType="{x:Type popup:LogInfo}">
<Border CornerRadius="5" Margin="0,0,0,5">
<StackPanel Orientation="Horizontal" Spacing="5" Margin="0">
<Border MinWidth="100"

View File

@@ -2,6 +2,7 @@
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"
xmlns:customControls="clr-namespace:Nebula.Launcher.Controls"
xmlns:popup="clr-namespace:Nebula.Launcher.ViewModels.Popup"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Nebula.Launcher.Views.Popup.TfaView">
@@ -9,7 +10,7 @@
<popup:TfaViewModel />
</Design.DataContext>
<StackPanel HorizontalAlignment="Stretch" Spacing="25" VerticalAlignment="Center">
<Label HorizontalAlignment="Center">You have two-factor authentication enabled. Please enter the code.</Label>
<customControls:LocalizedLabel HorizontalAlignment="Center" LocalId="twofa-enabled"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10" x:Name="TContainer">
<Border BoxShadow="{StaticResource DefaultShadow}">
<TextBox MaxLength="1"/>
@@ -32,7 +33,7 @@
</StackPanel>
<Border BoxShadow="{StaticResource DefaultShadow}" Background="{StaticResource DefaultSelected}" HorizontalAlignment="Center">
<Button Click="Button_OnClick">
<Label HorizontalAlignment="Center" Margin="15,5,15,5">OK</Label>
<customControls:LocalizedLabel HorizontalAlignment="Center" Margin="15,5,15,5" LocalId="twofa-set"/>
</Button>
</Border>
</StackPanel>

View File

@@ -0,0 +1,78 @@
<UserControl 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"
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
xmlns:views="clr-namespace:Nebula.Launcher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Nebula.Launcher.Views.ServerCompoundEntryView"
x:DataType="viewModels:ServerCompoundEntryViewModel">
<Design.DataContext>
<viewModels:ServerCompoundEntryViewModel />
</Design.DataContext>
<Panel>
<Border IsVisible="{Binding Loading}"
Background="{StaticResource DefaultGrad}"
BoxShadow="-2 0 5 -1 #121212"
CornerRadius="10"
Margin="5">
<Grid ColumnDefinitions="*,80,50,50" RowDefinitions="35,*,*">
<Border
Background="Transparent"
BoxShadow="0 3 3 -2 #121212"
CornerRadius="10"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="0"/>
<ScrollViewer
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalScrollBarVisibility="Hidden"
Margin="10,0,0,0"
VerticalScrollBarVisibility="Disabled"
x:Name="AutoScrollViewer">
<StackPanel Orientation="Horizontal">
<Label VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" />
</Label>
<Label VerticalAlignment="Center">
<TextBlock Text="{Binding Message}" />
</Label>
</StackPanel>
</ScrollViewer>
<Panel
Grid.Column="2"
Grid.Row="0"
Margin="5,0,0,0">
<Button
Command="{Binding ToggleFavorites}"
CornerRadius="10,10,10,10"
HorizontalAlignment="Stretch"
IsVisible="{Binding !IsFavorite}"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/star.svg" />
</Button>
<Button
Command="{Binding ToggleFavorites}"
CornerRadius="10,10,10,10"
HorizontalAlignment="Stretch"
IsVisible="{Binding IsFavorite}"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/starfull.svg" />
</Button>
</Panel>
</Grid>
</Border>
<Panel IsVisible="{Binding !Loading}">
<views:ServerEntryView IsVisible="{Binding !Loading}" DataContext="{Binding CurrentEntry}"/>
</Panel>
</Panel>
</UserControl>

View File

@@ -0,0 +1,17 @@
using Avalonia.Controls;
using Nebula.Launcher.ViewModels;
namespace Nebula.Launcher.Views;
public partial class ServerCompoundEntryView : UserControl
{
public ServerCompoundEntryView()
{
InitializeComponent();
}
public ServerCompoundEntryView(ServerCompoundEntryViewModel viewModel) : this()
{
DataContext = viewModel;
}
}

View File

@@ -13,6 +13,7 @@
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
xmlns:views="clr-namespace:Nebula.Launcher.Views"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:services="clr-namespace:Nebula.Launcher.Services"
IsVisible="{Binding IsVisible}">
<Design.DataContext>
<viewModels:ServerEntryModelView />
@@ -24,7 +25,7 @@
CornerRadius="10"
Margin="5">
<Grid ColumnDefinitions="*,80,50,50" RowDefinitions="35,*,*">
<Grid ColumnDefinitions="*,80,50,50,50" RowDefinitions="35,*,*">
<Border
Background="Transparent"
BoxShadow="0 3 3 -2 #121212"
@@ -47,7 +48,7 @@
VerticalScrollBarVisibility="Disabled"
x:Name="AutoScrollViewer">
<Label VerticalAlignment="Center">
<TextBlock Text="{Binding Status.Name}" />
<TextBlock Text="{Binding RealName}" />
</Label>
</ScrollViewer>
</Button>
@@ -67,9 +68,19 @@
</Label>
</StackPanel>
<Panel
<Button
Grid.Column="2"
Grid.Row="0"
Command="{Binding EditName}"
CornerRadius="10,10,10,10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/pencil.svg" />
</Button>
<Panel
Grid.Column="3"
Grid.Row="0"
Margin="5,0,0,0">
<Button
Command="{Binding ToggleFavorites}"
@@ -90,7 +101,7 @@
</Panel>
<Panel
Grid.Column="3"
Grid.Column="4"
Grid.Row="0"
Margin="5,0,0,0">
<Button
@@ -134,7 +145,7 @@
Margin="5">
<StackPanel Margin="5" Spacing="5">
<StackPanel Orientation="Horizontal">
<Label FontSize="10" VerticalAlignment="Center">Tags:</Label>
<Label FontSize="10" VerticalAlignment="Center" Content="{services:LocaledText serverentry-tag}"/>
<ItemsControl ItemsSource="{Binding Tags}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type system:String}">
@@ -165,7 +176,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label FontSize="10" VerticalAlignment="Center">Map:</Label>
<Label FontSize="10" VerticalAlignment="Center" Content="{services:LocaledText serverentry-map}"/>
<Border
Background="{StaticResource DefaultForeground}"
BorderThickness="0"
@@ -180,7 +191,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label FontSize="10" VerticalAlignment="Center">Preset:</Label>
<Label FontSize="10" VerticalAlignment="Center" Content="{services:LocaledText serverentry-preset}"/>
<Border
Background="{StaticResource DefaultForeground}"
BorderThickness="0"

View File

@@ -7,14 +7,14 @@ public static class CurrentConVar
{
public static readonly ConVar<string[]> EngineManifestUrl =
ConVarBuilder.Build<string[]>("engine.manifestUrl", [
"https://robust-builds.cdn.spacestation14.com/manifest.json",
"https://harpy.durenko.tatar/manifests/manifest",
"https://robust-builds.fallback.cdn.spacestation14.com/manifest.json"
]);
public static readonly ConVar<string[]> EngineModuleManifestUrl =
ConVarBuilder.Build<string[]>("engine.moduleManifestUrl",
[
"https://robust-builds.cdn.spacestation14.com/modules.json",
"https://harpy.durenko.tatar/manifests/modules",
"https://robust-builds.fallback.cdn.spacestation14.com/modules.json"
]);
@@ -24,15 +24,15 @@ public static class CurrentConVar
public static readonly ConVar<string> RobustAssemblyName =
ConVarBuilder.Build("engine.robustAssemblyName", "Robust.Client");
public static readonly ConVar<string[][]> Hub = ConVarBuilder.Build<string[][]>("launcher.hub", [
[
"https://hub.spacestation14.com/api/servers",
"https://auth.fallback.spacestation14.com/"
]
]);
public static readonly ConVar<Dictionary<string, EngineVersionInfo>> EngineManifestBackup =
ConVarBuilder.Build<Dictionary<string, EngineVersionInfo>>("engine.manifest.backup");
public static readonly ConVar<ModulesInfo> ModuleManifestBackup =
ConVarBuilder.Build<ModulesInfo>("module.manifest.backup");
public static readonly ConVar<Dictionary<string,string>> DotnetUrl = ConVarBuilder.Build<Dictionary<string,string>>("dotnet.url",
new(){
{"win-x64", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-win-x64.zip"},
{"win-x86", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-win-x86.zip"},
{"linux-x64", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-linux-x64.tar.gz"}
});
}

View File

@@ -1,3 +0,0 @@
namespace Nebula.Shared.Models;
public record ListItemTemplate(Type ModelType, string IconKey, string Label, object? args);

View File

@@ -12,22 +12,32 @@ public static class ServiceExt
public static void AddServices(this IServiceCollection services, Assembly assembly)
{
foreach (var (type, inference) in GetServicesWithHelpAttribute(assembly))
foreach (var (type, inference, isSingleton) in GetServicesWithHelpAttribute(assembly))
{
Console.WriteLine("[ServiceMng] ADD SERVICE " + type);
if (inference is null)
services.AddSingleton(type);
if (isSingleton)
{
if (inference is null)
services.AddSingleton(type);
else
services.AddSingleton(inference, type);
}
else
services.AddSingleton(inference, type);
{
if (inference is null)
services.AddTransient(type);
else
services.AddTransient(inference, type);
}
}
}
private static IEnumerable<(Type, Type?)> GetServicesWithHelpAttribute(Assembly assembly)
private static IEnumerable<(Type, Type?, bool)> GetServicesWithHelpAttribute(Assembly assembly)
{
foreach (var type in assembly.GetTypes())
{
var attr = type.GetCustomAttribute<ServiceRegisterAttribute>();
if (attr is not null) yield return (type, attr.Inference);
if (attr is not null) yield return (type, attr.Inference, attr.IsSingleton);
}
}
}

View File

@@ -53,25 +53,21 @@ public class AuthService(
SelectedAuth = null;
}
public async Task<bool> SetAuth(CurrentAuthInfo info)
public async Task SetAuth(CurrentAuthInfo info)
{
SelectedAuth = info;
return await EnsureToken();
await EnsureToken();
}
public async Task<bool> EnsureToken()
public async Task EnsureToken()
{
if (SelectedAuth is null) return false;
if (SelectedAuth is null) throw new Exception("Auth info is not set!");
var authUrl = new Uri($"{SelectedAuth.AuthServer}api/auth/ping");
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, authUrl);
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("SS14Auth", SelectedAuth.Token.Token);
using var resp = await _httpClient.SendAsync(requestMessage, cancellationService.Token);
if (!resp.IsSuccessStatusCode) SelectedAuth = null;
return resp.IsSuccessStatusCode;
}
}

View File

@@ -8,6 +8,8 @@ namespace Nebula.Shared.Services;
public class ConVar<T>
{
internal ConfigurationService.OnConfigurationChangedDelegate<T?>? OnValueChanged;
public ConVar(string name, T? defaultValue = default)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
@@ -33,7 +35,10 @@ public static class ConVarBuilder
[ServiceRegister]
public class ConfigurationService
{
public delegate void OnConfigurationChangedDelegate<in T>(T value);
public IReadWriteFileApi ConfigurationApi { get; init; }
private readonly ILogger _logger;
public ConfigurationService(FileService fileService, DebugService debugService)
@@ -42,6 +47,16 @@ public class ConfigurationService
ConfigurationApi = fileService.CreateFileApi("config");
}
public ConfigChangeSubscriberDisposable<T> SubscribeVarChanged<T>(ConVar<T> convar, OnConfigurationChangedDelegate<T?> @delegate, bool invokeNow = false)
{
convar.OnValueChanged += @delegate;
if (invokeNow)
{
@delegate(GetConfigValue(convar));
}
return new ConfigChangeSubscriberDisposable<T>(convar, @delegate);
}
public T? GetConfigValue<T>(ConVar<T> conVar)
{
@@ -99,8 +114,12 @@ public class ConfigurationService
public void SetConfigValue<T>(ConVar<T> conVar, T value)
{
ArgumentNullException.ThrowIfNull(conVar);
if (value == null) throw new ArgumentNullException(nameof(value));
if (value == null)
{
ConfigurationApi.Remove(GetFileName(conVar));
conVar.OnValueChanged?.Invoke(conVar.DefaultValue);
return;
}
if (!conVar.Type.IsInstanceOfType(value))
{
@@ -121,6 +140,7 @@ public class ConfigurationService
stream.Seek(0, SeekOrigin.Begin);
ConfigurationApi.Save(GetFileName(conVar), stream);
conVar.OnValueChanged?.Invoke(value);
}
catch (Exception e)
{
@@ -132,4 +152,20 @@ public class ConfigurationService
{
return $"{conVar.Name}.json";
}
}
public sealed class ConfigChangeSubscriberDisposable<T> : IDisposable
{
private readonly ConVar<T> _convar;
private readonly ConfigurationService.OnConfigurationChangedDelegate<T> _delegate;
public ConfigChangeSubscriberDisposable(ConVar<T> convar, ConfigurationService.OnConfigurationChangedDelegate<T> @delegate)
{
_convar = convar;
_delegate = @delegate;
}
public void Dispose()
{
_convar.OnValueChanged -= _delegate;
}
}

View File

@@ -83,7 +83,7 @@ public partial class ContentService
if (hashApi.TryOpen(item, out var stream))
{
_logger.Log($"Unpack {item.Hash} to: {item.Path}");
otherApi.Save(item.Hash, stream);
otherApi.Save(item.Path, stream);
stream.Close();
}
else

View File

@@ -72,17 +72,19 @@ internal class ServiceLogger : ILogger
if (!DebugService.DoFileLog) return;
if(!Directory.Exists(directory)) Directory.CreateDirectory(directory);
_path = Path.Combine(directory, $"{Category}.log");
_fileStream = File.Open(Path.Combine(directory,$"{Category}.log"), FileMode.Create, FileAccess.Write, FileShare.Read);
_streamWriter = new StreamWriter(_fileStream);
File.Create(_path).Dispose();
}
public string Category { get; init; }
private Dictionary<string, ServiceLogger> Childs { get; init; } = new();
private readonly FileStream _fileStream;
private readonly StreamWriter _streamWriter;
private FileStream? _fileStream;
private StreamWriter? _streamWriter;
private readonly string _path;
public ServiceLogger GetLogger(string category)
{
@@ -109,17 +111,25 @@ internal class ServiceLogger : ILogger
private void LogToFile(string output)
{
if(!DebugService.DoFileLog) return;
_fileStream = File.Open(_path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
_streamWriter = new StreamWriter(_fileStream);
Root?.LogToFile(output);
_streamWriter.WriteLine(output);
_streamWriter.Flush();
_streamWriter.Dispose();
_fileStream.Dispose();
_fileStream = null;
_streamWriter = null;
}
public void Dispose()
{
if (!DebugService.DoFileLog) return;
_streamWriter.Dispose();
_fileStream.Dispose();
_streamWriter?.Dispose();
_fileStream?.Dispose();
foreach (var (_, child) in Childs)
{
child.Dispose();

View File

@@ -0,0 +1,70 @@
using System.Diagnostics;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
namespace Nebula.Shared.Services;
[ServiceRegister]
public class DotnetResolverService(DebugService debugService, ConfigurationService configurationService)
{
private HttpClient _httpClient = new HttpClient();
private static readonly string FullPath = Path.Join(FileService.RootPath, "dotnet", DotnetUrlHelper.GetRuntimeIdentifier());
private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension());
public async Task<string> EnsureDotnet(){
if(!Directory.Exists(FullPath))
await Download();
return ExecutePath;
}
private async Task Download(){
debugService.GetLogger("DotnetResolver").Log($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}...");
var ridExt =
DotnetUrlHelper.GetCurrentPlatformDotnetUrl(configurationService.GetConfigValue(CurrentConVar.DotnetUrl)!);
using var response = await _httpClient.GetAsync(ridExt);
using var zipArchive = new ZipArchive(await response.Content.ReadAsStreamAsync());
Directory.CreateDirectory(FullPath);
zipArchive.ExtractToDirectory(FullPath);
debugService.GetLogger("DotnetResolver").Log($"Downloading dotnet complete.");
}
}
public static class DotnetUrlHelper
{
public static string GetExtension()
{
if (OperatingSystem.IsWindows()) return ".exe";
return "";
}
public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl)
{
string? rid = GetRuntimeIdentifier();
if (dotnetUrl.TryGetValue(rid, out var url))
{
return url;
}
throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}");
}
public static string GetRuntimeIdentifier()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.Is64BitProcess ? "win-x64" : "win-x86";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "linux-x64";
}
throw new PlatformNotSupportedException("Unsupported operating system");
}
}

View File

@@ -1,90 +0,0 @@
using Nebula.Shared.Models;
using Nebula.Shared.Services.Logging;
namespace Nebula.Shared.Services;
[ServiceRegister]
public class HubService
{
private readonly ConfigurationService _configurationService;
private readonly RestService _restService;
private readonly ILogger _logger;
private readonly List<ServerHubInfo> _serverList = new();
public Action<HubServerChangedEventArgs>? HubServerChangedEventArgs;
public Action? HubServerLoaded;
public Action<Exception>? HubServerLoadingError;
public HubService(ConfigurationService configurationService, RestService restService, DebugService debugService)
{
_configurationService = configurationService;
_restService = restService;
_logger = debugService.GetLogger(this);
UpdateHub();
}
public IReadOnlyList<ServerHubInfo> ServerList => _serverList;
public bool IsUpdating { get; private set; }
public async void UpdateHub()
{
if (IsUpdating) return;
_serverList.Clear();
IsUpdating = true;
HubServerChangedEventArgs?.Invoke(new HubServerChangedEventArgs([], HubServerChangeAction.Clear));
foreach (var urlStr in _configurationService.GetConfigValue(CurrentConVar.Hub)!)
{
var invoked = false;
Exception? exception = null;
foreach (var uri in urlStr)
{
try
{
var servers =
await _restService.GetAsync<List<ServerHubInfo>>(new Uri(uri), CancellationToken.None);
_serverList.AddRange(servers);
HubServerChangedEventArgs?.Invoke(new HubServerChangedEventArgs(servers, HubServerChangeAction.Add));
invoked = true;
break;
}
catch (Exception e)
{
_logger.Error($"Failed to get servers for {uri}");
_logger.Error(e);
exception = e;
}
}
if(exception is not null && !invoked)
HubServerLoadingError?.Invoke(new Exception("No hub is available.", exception));
}
IsUpdating = false;
HubServerLoaded?.Invoke();
}
}
public class HubServerChangedEventArgs : EventArgs
{
public HubServerChangeAction Action;
public List<ServerHubInfo> Items;
public HubServerChangedEventArgs(List<ServerHubInfo> items, HubServerChangeAction action)
{
Items = items;
Action = action;
}
}
public enum HubServerChangeAction
{
Add,
Remove,
Clear
}

View File

@@ -1,3 +1,4 @@
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net;
using System.Text;
@@ -24,12 +25,14 @@ public class RestService
_logger = debug.GetLogger(this);
}
[Pure]
public async Task<T> GetAsync<T>(Uri uri, CancellationToken cancellationToken) where T : notnull
{
var response = await _client.GetAsync(uri, cancellationToken);
return await ReadResult<T>(response, cancellationToken, uri);
}
[Pure]
public async Task<T> GetAsyncDefault<T>(Uri uri, T defaultValue, CancellationToken cancellationToken) where T : notnull
{
try
@@ -43,6 +46,7 @@ public class RestService
}
}
[Pure]
public async Task<K> PostAsync<K, T>(T information, Uri uri, CancellationToken cancellationToken) where K : notnull
{
var json = JsonSerializer.Serialize(information, _serializerOptions);
@@ -51,6 +55,7 @@ public class RestService
return await ReadResult<K>(response, cancellationToken, uri);
}
[Pure]
public async Task<T> PostAsync<T>(Stream stream, Uri uri, CancellationToken cancellationToken) where T : notnull
{
using var multipartFormContent =
@@ -60,12 +65,14 @@ public class RestService
return await ReadResult<T>(response, cancellationToken, uri);
}
[Pure]
public async Task<T> DeleteAsync<T>(Uri uri, CancellationToken cancellationToken) where T : notnull
{
var response = await _client.DeleteAsync(uri, cancellationToken);
return await ReadResult<T>(response, cancellationToken, uri);
}
[Pure]
private async Task<T> ReadResult<T>(HttpResponseMessage response, CancellationToken cancellationToken, Uri uri) where T : notnull
{
var content = await response.Content.ReadAsStringAsync(cancellationToken);

View File

@@ -13,20 +13,6 @@ public sealed class RunnerService(
AssemblyService assemblyService)
{
private ILogger _logger = debugService.GetLogger("RunnerService");
public async Task PrepareRun(RobustBuildInfo buildInfo, ILoadingHandler loadingHandler,
CancellationToken cancellationToken)
{
_logger.Log("Prepare Content!");
var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion);
if (engine is null)
throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion);
await contentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandler, cancellationToken);
await engineService.EnsureEngineModules("Robust.Client.WebView", buildInfo.BuildInfo.Build.EngineVersion);
}
public async Task Run(string[] runArgs, RobustBuildInfo buildInfo, IRedialApi redialApi,
ILoadingHandler loadingHandler,

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Nebula.UpdateResolver.Configuration;
namespace Nebula.UpdateResolver;
public static class DotnetStandalone
{
private static readonly HttpClient HttpClient = new HttpClient();
private static readonly string FullPath = Path.Join(MainWindow.RootPath, "dotnet", DotnetUrlHelper.GetRuntimeIdentifier());
private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension());
public static async Task<Process?> Run(string dllPath)
{
await EnsureDotnet();
return Process.Start(new ProcessStartInfo
{
FileName = ExecutePath,
Arguments = dllPath,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8
});
}
private static async Task EnsureDotnet(){
if(!Directory.Exists(FullPath))
await Download();
}
private static async Task Download(){
LogStandalone.Log($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}...");
var ridExt =
DotnetUrlHelper.GetCurrentPlatformDotnetUrl(ConfigurationStandalone.GetConfigValue(UpdateConVars.DotnetUrl)!);
using var response = await HttpClient.GetAsync(ridExt);
using var zipArchive = new ZipArchive(await response.Content.ReadAsStreamAsync());
Directory.CreateDirectory(FullPath);
zipArchive.ExtractToDirectory(FullPath);
LogStandalone.Log($"Downloading dotnet complete.");
}
}
public static class DotnetUrlHelper
{
public static string GetExtension()
{
if (OperatingSystem.IsWindows()) return ".exe";
return "";
}
public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl)
{
string? rid = GetRuntimeIdentifier();
if (dotnetUrl.TryGetValue(rid, out var url))
{
return url;
}
throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}");
}
public static string GetRuntimeIdentifier()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.Is64BitProcess ? "win-x64" : "win-x86";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "linux-x64";
}
throw new PlatformNotSupportedException("Unsupported operating system");
}
}

View File

@@ -0,0 +1,21 @@
using System;
namespace Nebula.UpdateResolver;
public static class LogStandalone
{
public static Action<string, int>? OnLog;
public static void LogError(Exception e){
Log($"{e.GetType().Name}: "+ e.Message);
Log(e.StackTrace);
if(e.InnerException != null)
LogError(e.InnerException);
}
public static void Log(string? message, int percentage = 0)
{
if(message is null) return;
OnLog?.Invoke(message, percentage);
}
}

View File

@@ -23,6 +23,19 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();
LogStandalone.OnLog += (message, percentage) =>
{
ProgressLabel.Content = message;
if (percentage == 0)
PercentLabel.Content = "";
else
PercentLabel.Content = percentage + "%";
var messageOut =
$"[{DateTime.Now.ToUniversalTime():yyyy-MM-dd HH:mm:ss}]: {message} {PercentLabel.Content}";
Console.WriteLine(messageOut);
LogStr += messageOut + "\n";
};
Start();
}
@@ -31,11 +44,11 @@ public partial class MainWindow : Window
try
{
var info = await EnsureFiles();
Log("Downloading files...");
LogStandalone.Log("Downloading files...");
foreach (var file in info.ToDelete)
{
Log("Deleting " + file.Path);
LogStandalone.Log("Deleting " + file.Path);
FileApi.Remove(file.Path);
}
@@ -55,30 +68,21 @@ public partial class MainWindow : Window
await using var stream = await response.Content.ReadAsStreamAsync();
FileApi.Save(file.Path, stream);
resolved++;
Log("Saving " + file.Path, (int)(resolved / (float)count * 100f));
LogStandalone.Log("Saving " + file.Path, (int)(resolved / (float)count * 100f));
loadedManifest.Add(file);
Save(loadedManifest);
}
Log("Download finished. Running launcher...");
LogStandalone.Log("Download finished. Running launcher...");
var process = Process.Start(new ProcessStartInfo
{
FileName = "dotnet.exe",
Arguments = Path.Join(FileApi.RootPath, "Nebula.Launcher.dll"),
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8
});
await DotnetStandalone.Run(Path.Join(FileApi.RootPath, "Nebula.Launcher.dll"));
}
catch(HttpRequestException e){
LogError(e);
Log("Проблемы с интернет-соединением...");
LogStandalone.LogError(e);
LogStandalone.Log("Network connection error...");
var logPath = Path.Join(RootPath,"updateResloverError.txt");
File.WriteAllText(logPath, LogStr);
await File.WriteAllTextAsync(logPath, LogStr);
Process.Start(new ProcessStartInfo(){
FileName = "notepad",
Arguments = logPath
@@ -86,9 +90,9 @@ public partial class MainWindow : Window
}
catch (Exception e)
{
LogError(e);
LogStandalone.LogError(e);
var logPath = Path.Join(RootPath,"updateResloverError.txt");
File.WriteAllText(logPath, LogStr);
await File.WriteAllTextAsync(logPath, LogStr);
Process.Start(new ProcessStartInfo(){
FileName = "notepad",
Arguments = logPath
@@ -102,7 +106,7 @@ public partial class MainWindow : Window
private async Task<ManifestEnsureInfo> EnsureFiles()
{
Log("Ensuring launcher manifest...");
LogStandalone.Log("Ensuring launcher manifest...");
var manifest = await RestStandalone.GetAsync<LauncherManifest>(
new Uri(ConfigurationStandalone.GetConfigValue(UpdateConVars.UpdateCacheUrl)! + "/manifest.json"), CancellationToken.None);
@@ -110,10 +114,10 @@ public partial class MainWindow : Window
var toDelete = new HashSet<LauncherManifestEntry>();
var filesExist = new HashSet<LauncherManifestEntry>();
Log("Manifest loaded!");
LogStandalone.Log("Manifest loaded!");
if (ConfigurationStandalone.TryGetConfigValue(UpdateConVars.CurrentLauncherManifest, out var currentManifest))
{
Log("Delta manifest loaded!");
LogStandalone.Log("Delta manifest loaded!");
foreach (var file in currentManifest.Entries)
{
if (!manifest.Entries.Contains(file))
@@ -133,31 +137,11 @@ public partial class MainWindow : Window
toDownload = manifest.Entries;
}
Log("Saving launcher manifest...");
LogStandalone.Log("Saving launcher manifest...");
return new ManifestEnsureInfo(toDownload, toDelete, filesExist);
}
private void LogError(Exception e){
Log($"{e.GetType().Name}: "+ e.Message);
Log(e.StackTrace);
if(e.InnerException != null)
LogError(e.InnerException);
}
private void Log(string? message, int percentage = 0)
{
if(message is null) return;
ProgressLabel.Content = message;
if (percentage == 0)
PercentLabel.Content = "";
else
PercentLabel.Content = percentage + "%";
var messageOut = $"[{DateTime.Now.ToUniversalTime():yyyy-MM-dd HH:mm:ss}]: {message} {PercentLabel.Content}";
Console.WriteLine(messageOut);
LogStr += messageOut + "\n";
}
private void Save(HashSet<LauncherManifestEntry> entries)
{

View File

@@ -9,6 +9,7 @@
<PublishSingleFile>true</PublishSingleFile>
<!--<PublishTrimmed>true</PublishTrimmed>-->
<SelfContained>true</SelfContained>
<ApplicationIcon>Assets/nebula.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using Nebula.UpdateResolver.Configuration;
namespace Nebula.UpdateResolver;
@@ -8,4 +9,11 @@ public static class UpdateConVars
ConVarBuilder.Build<string>("update.url","https://durenko.tatar/nebula/manifest/");
public static readonly ConVar<LauncherManifest> CurrentLauncherManifest =
ConVarBuilder.Build<LauncherManifest>("update.manifest");
public static readonly ConVar<Dictionary<string,string>> DotnetUrl = ConVarBuilder.Build<Dictionary<string,string>>("dotnet.url",
new(){
{"win-x64", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-win-x64.zip"},
{"win-x86", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-win-x86.zip"},
{"linux-x64", "https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.6/dotnet-runtime-9.0.6-linux-x64.tar.gz"}
});
}

View File

@@ -1,19 +1,54 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArchiving_002EUtils_002EWindows_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27e9f12ad1e4318b9b02849ec3e6a502fa3ee761c4f0522ba756ab30cde1c_003FArchiving_002EUtils_002EWindows_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAvaloniaXamlLoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F80462644bd1cc7e0b229dc4f5752b48c01cb67b46ae563b1b5078cc2556b98_003FAvaloniaXamlLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABorder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F5fda7f1253ea19edc15f91b94a33322b857f1a9319fbffea8d26e9d304178_003FBorder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABrushes_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F86e7f7d5cebacb8f8e37f52cb9a1f6a4b8933239631e3d969a4bc881ae92f9_003FBrushes_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AButton_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcc84c38d8785b88e166e6741b6a4c0dfa09eaf6e41eb151b255817e11f27570_003FButton_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACancellationToken_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2565b9d99fdde488bc7801b84387b2cc864959cfb63212e1ff576fc9c6bb7e_003FCancellationToken_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F50341a469131fa51e5443b9bd96c4ca1c96bfa709f7f41fd15941ff6296a8dc_003FCollection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AConnectHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffcc079c54e9940c5ac59f0141dda9ad01b4928_003F79_003F23ddd790_003FConnectHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AConsole_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ffd57398b7dc3a8ce7da2786f2c67289c3d974658a9e90d0c1e84db3d965fbf1_003FConsole_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F57361bc4e5442f644ff63ec7e745da2eb4bbb6c769d1fb683bab5f6f952b1ab_003FControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADecorator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Feecfe7fcb95caaf3978fdce4ae36e346b34986d1d844b0dce2fcb67e5952c_003FDecorator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADesign_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9a2912aa19f1b0ab2229159cec21d718356660fc49cd8e5257a66b584b69b_003FDesign_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADispatcher_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fe6d04341b5ca8c55e2be617e1b6fc5a12cc8647f7272d94f614ae7fb1c0e8d_003FDispatcher_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADrawingContext_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F7f67edd2b798d6c80b015913cde68b729bfe416b62cf075ea3953ffeff639c_003FDrawingContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcae7ff14a5884c649c9045d4ef4f987ea0928_003Fa6_003F6011c781_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileShare_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003F54_003Fc3f4f140_003FFileShare_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFile_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3f31e7e8aa33de883c2ccfa62a9c81bfc246c36e825b489476f9472032e512_003FFile_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrozenDictionary_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F89dff9063ddb01ff8125b579122b88bf4de94526490d77bcbbef7d0ee662a_003FFrozenDictionary_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFuture_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb3575a2f41d7c2dbfaa36e866b8a361e11dd7223ff82bc574c1d5d4b7522f735_003FFuture_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpClient_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc439425da351c75ac7d966a1cc8324b51a9c471865af79d2f2f3fcb65e392_003FHttpClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpContent_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9657cc383c70851dc2bdcf91eff27f21196844abfe552fc9c3243ff36974cd_003FHttpContent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpMessageHandler_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffcc079c54e9940c5ac59f0141dda9ad01b4928_003Fa7_003F885f5fd9_003FHttpMessageHandler_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpMessageInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffcc079c54e9940c5ac59f0141dda9ad01b4928_003Fb5_003F70346b10_003FHttpMessageInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpResponseMessage_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4cfeb8b377bc81e1fbb5f7d7a02492cb6ac23e88c8c9d7155944f0716f3d4b_003FHttpResponseMessage_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIDispatcherImpl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F22d92db124764b1ab49745245c66f01b1e1a00_003F0f_003F01061787_003FIDispatcherImpl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIDisposable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003F98_003Fd1b23281_003FIDisposable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIndex_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2a1a813823579c69832f1304f97761e7be433bd6aa928f351d138050b56a38_003FIndex_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInt32_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fa882d183338544fdbcbdfc7b6d3dcb78916630765551644a221b5be9c45a121b_003FInt32_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonSerializer_002ERead_002EString_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27c4858128168eda568c1334d70d5241efb9461e2a3209258a04deee5d9c367_003FJsonSerializer_002ERead_002EString_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AListBox_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3a6cdc26ff4d30986a9a16b6bbc9bb6a7f2657431c82cde5c66dd377cf51e2b_003FListBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeLibrary_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F88c2c65e1618f68cb5969f70dfc0986e9571015ac8d487b18d26e89c926264_003FNativeLibrary_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeLibrary_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F49393f3cda2f9a5c2fa811fc9179dcbaf5bd94d9dc8afc76aaff2bc23287f3_003FNativeLibrary_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObservableCollection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3e2c48e6b3ec8b39cf721287f93972c7f3df25d306753bcc539eaad73126c68_003FObservableCollection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APanel_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9b699722324e3615b57977447b25bf953fccb2d6e912ae584f16b7e691ad9d3_003FPanel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AParallel_002EForEachAsync_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc1d1ed6be2d5d4de542b4af5b36e82f6d1d1a389a35a4e4f9748d137d1c651_003FParallel_002EForEachAsync_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AProcessStartInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc5ffb8c166be164bc221db4c64e826a1e8ff54f2f1c9ee8e7f9cfabce707fa4_003FProcessStartInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APropertyInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F408236be4b0703755f3ed96daaae245919a792d65ce5eaa672d9fa945b1f_003FPropertyInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScrollBar_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fda7bce95d5f888176a5f93c8965e402ca33cba794ac7e7aa776363c664488d_003FScrollBar_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AServiceCollectionContainerBuilderExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa8ceca48b7b645dd875a40ee6d28725416d08_003F1b_003F6cd78dc8_003FServiceCollectionContainerBuilderExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AServiceProviderServiceExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4f1fdec7cbfe4433a7ec3a6d1bd0e54210118_003F04_003Fe2f5322d_003FServiceProviderServiceExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASingle_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fe27543f11ad92fdb62cde92eebaa1afb3de86a016ad85f76d1554b0389cd3f3_003FSingle_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AString_002EManipulation_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fe75a5575ba872c8ea754c015cb363850e6c661f39569712d5b74aaca67263c_003FString_002EManipulation_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStyle_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcfbd5689fdab68d1c02f6a9b3c5921abcc409b8743dcc958da77cc1cfcb8e_003FStyle_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATextBox_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F43273dba3ac6a4e11aefe78fbbccf5d36f07542ca37ecebffb25c95d1a1c16b_003FTextBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUri_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6a1fb5a19c4883d19f63515be2d0cce5e0e9929bb30469a912a58ad2e1e6152_003FUri_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">INFO</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AValuePrinter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F80d1676fb411442983574149e0b6aebc72e00_003F2f_003F26a40f58_003FValuePrinter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AZipFileExtensions_002EZipArchive_002ECreate_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1dd11f63b66adf34b6a6d76e1e0c0fd1df69d78b5fbfdcdf31c67b6bb40e9e4_003FZipFileExtensions_002EZipArchive_002ECreate_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AZipFile_002ECreate_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F5161553fb4bfeb0f7caff73da46449e1fb0d343789e21ff4d481db57d521976_003FZipFile_002ECreate_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">INFO</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.2\ref\net9.0\System.Net.Http.dll" /&gt;&#xD;
&lt;Assembly Path="C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.2\System.Net.Http.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>