14 Commits

Author SHA1 Message Date
Cinkafox
0c6bbaadac - tweak: loading popup thinks
* - tweak: change loading handle logic

* - tweak: beautify loading thinks

* - fix: speed thinks while downloading
2025-12-06 23:25:25 +03:00
d7f775e80c - add: linux support 2025-12-03 23:16:18 +03:00
6eead05308 - fix: update RobustNatives 2025-11-08 18:39:54 +03:00
673a972598 Merge remote-tracking branch 'origin/master' 2025-11-08 13:42:36 +03:00
f44589454c - fix: auth renew and null fix 2025-11-08 13:42:11 +03:00
fd06729035 - fix: update resolver startup 2025-10-04 19:59:23 +03:00
a09ace0d39 - fix: UpdateResolver preview think 2025-09-08 21:26:12 +03:00
56c373134f - fix: little thinks 2025-09-07 21:21:50 +03:00
fa68b4bcd5 - fix: Message on error 2025-08-17 21:40:31 +03:00
b86b65fd66 - fix: profiles token refresh now 2025-08-17 21:02:45 +03:00
6c967efd85 - fix: auth logic part 2 2025-08-07 22:34:25 +03:00
6a6bb4f27c - fix: auth logic part 1 2025-08-06 21:29:00 +03:00
f6a15e9c45 - add: multiauth 2025-07-15 18:38:53 +03:00
c148f6ed34 - add: nice error view 2025-07-14 10:06:38 +03:00
91 changed files with 3188 additions and 1313 deletions

View File

@@ -45,6 +45,7 @@
<entry key="Nebula.Launcher/Views/ServerListView.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/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.Launcher/Views/Tabs/ServerListTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/VisualErrorView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.UpdateResolver/App.axaml" value="Nebula.UpdateResolver/Nebula.UpdateResolver.csproj" /> <entry key="Nebula.UpdateResolver/App.axaml" value="Nebula.UpdateResolver/Nebula.UpdateResolver.csproj" />
<entry key="Nebula.UpdateResolver/MainWindow.axaml" value="Nebula.UpdateResolver/Nebula.UpdateResolver.csproj" /> <entry key="Nebula.UpdateResolver/MainWindow.axaml" value="Nebula.UpdateResolver/Nebula.UpdateResolver.csproj" />
</map> </map>

View File

@@ -28,14 +28,16 @@ public class App : Application
{ {
case IClassicDesktopStyleApplicationLifetime desktop: case IClassicDesktopStyleApplicationLifetime desktop:
DisableAvaloniaDataAnnotationValidation(); DisableAvaloniaDataAnnotationValidation();
desktop.MainWindow = new MessageWindow(out provider); desktop.MainWindow = (Window)(provider = new MessageWindow());
break; break;
case ISingleViewApplicationLifetime singleViewPlatform: case ISingleViewApplicationLifetime singleViewPlatform:
singleViewPlatform.MainView = new MessageView(out provider); singleViewPlatform.MainView = (Control)(provider = new MessageView());
break; break;
} }
provider?.ShowMessage("Launcher is already running.","hey shithead!"); provider?.ShowMessage(
"Error: An instance of the application is already running. Please close the existing instance before launching a new one.",
"Duplicate instance detected.");
return; return;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

@@ -24,8 +24,9 @@ account-auth-server = Authentication Server
account-auth-button = Authenticate account-auth-button = Authenticate
account-auth-save = Save Profile account-auth-save = Save Profile
account-auth-hello = Hello, account-auth-hello = Hello,
account-auth-current-server = Current server auth:
account-auth-logout = Log out account-auth-logout = Log out
auth-current-login-name = Current login: {$login} auth-current-login-name = Current login {$auth_server}: {$login}
auth-current-login-no-name = Profile not selected auth-current-login-no-name = Profile not selected
auth-processing = Processing authentication request... auth-processing = Processing authentication request...
@@ -37,6 +38,7 @@ auth-name-resolution-error = Failed to resolve server address. Check your networ
auth-secure-error = Failed to cinnect to the server using SSL auth-secure-error = Failed to cinnect to the server using SSL
auth-config-read = Reading authentication configuration... auth-config-read = Reading authentication configuration...
auth-try-auth-config = Attempting to authenticate using saved configuration. auth-try-auth-config = Attempting to authenticate using saved configuration.
auth-try-auth-profile = Attempting to authenticate using profile
config-export-logs = Export logs config-export-logs = Export logs
config-open-data = Open data path config-open-data = Open data path
@@ -68,3 +70,4 @@ popup-login-credentials-warning-cancel = Cancel
popup-login-credentials-warning-proceed = Proceed popup-login-credentials-warning-proceed = Proceed
goto-path-home = Root folder goto-path-home = Root folder
tab-favorite = Favorite

View File

@@ -24,8 +24,9 @@ account-auth-server = Сервер аутентификации
account-auth-button = Аутентифицировать account-auth-button = Аутентифицировать
account-auth-save = Сохранить профиль account-auth-save = Сохранить профиль
account-auth-hello = Привет, account-auth-hello = Привет,
account-auth-current-server = Текущий сервер авторизации:
account-auth-logout = Выйти account-auth-logout = Выйти
auth-current-login-name = Текущий профиль: {$login} auth-current-login-name = Текущий профиль {$auth_server}: {$login}
auth-current-login-no-name = Профиль не выбран auth-current-login-no-name = Профиль не выбран
auth-processing = Обработка запроса аутентификации... auth-processing = Обработка запроса аутентификации...
@@ -37,6 +38,7 @@ auth-name-resolution-error = Не удалось разрешить адрес
auth-secure-error = Не удалось подключиться к серверу по SSL. Проверьте сетевые настройки. auth-secure-error = Не удалось подключиться к серверу по SSL. Проверьте сетевые настройки.
auth-config-read = Чтение конфигурации аутентификации... auth-config-read = Чтение конфигурации аутентификации...
auth-try-auth-config = Попытка аутентификации с использованием сохраненной конфигурации. auth-try-auth-config = Попытка аутентификации с использованием сохраненной конфигурации.
auth-try-auth-profile = Попытка аутентификации с использованием профиля
config-export-logs = Экспортировать логи config-export-logs = Экспортировать логи
config-open-data = Открыть путь данных config-open-data = Открыть путь данных
@@ -68,3 +70,4 @@ popup-login-credentials-warning-cancel = Отмена
popup-login-credentials-warning-proceed = Продолжить popup-login-credentials-warning-proceed = Продолжить
goto-path-home = Корн. папка goto-path-home = Корн. папка
tab-favorite = Избранное

View File

@@ -0,0 +1,20 @@
using System;
using System.Security.Cryptography;
using System.Text;
using Avalonia.Media;
namespace Nebula.Launcher.ViewModels.Pages;
public static class ColorUtils
{
public static Color GetColorFromString(string input)
{
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input));
var r = byte.Clamp(hash[0], 10, 200);
var g = byte.Clamp(hash[1], 10, 100);
var b = byte.Clamp(hash[2], 10, 100);
return Color.FromArgb(Byte.MaxValue, r, g, b);
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
namespace Nebula.Launcher.ViewModels.Pages;
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;
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;
using Nebula.Shared.Configurations;
namespace Nebula.Launcher.Configurations;
public abstract class ComplexConVarBinder<T> : INotifyPropertyChanged, INotifyPropertyChanging
{
private readonly ConVarObserver<T> _baseConVar;
private readonly Lock _lock = new();
private readonly SemaphoreSlim _valueChangeSemaphore = new(1, 1);
public T? Value
{
get
{
lock (_lock)
{
return _baseConVar.Value;
}
}
set
{
_ = SetValueAsync(value);
}
}
public bool HasValue
{
get
{
lock (_lock)
{
return _baseConVar.HasValue;
}
}
}
protected ComplexConVarBinder(ConVarObserver<T> baseConVar)
{
_baseConVar = baseConVar ?? throw new ArgumentNullException(nameof(baseConVar));
_baseConVar.PropertyChanged += BaseConVarOnPropertyChanged;
_baseConVar.PropertyChanging += BaseConVarOnPropertyChanging;
}
private async Task SetValueAsync(T? value)
{
await _valueChangeSemaphore.WaitAsync().ConfigureAwait(false);
try
{
var newValue = await OnValueChange(value).ConfigureAwait(false);
lock (_lock)
{
_baseConVar.Value = newValue;
}
}
finally
{
_valueChangeSemaphore.Release();
}
}
protected abstract Task<T?> OnValueChange(T? newValue);
private void BaseConVarOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HasValue)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value)));
}
private void BaseConVarOnPropertyChanging(object? sender, PropertyChangingEventArgs e)
{
PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(nameof(HasValue)));
PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(nameof(Value)));
}
public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangingEventHandler? PropertyChanging;
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
namespace Nebula.Launcher.ViewModels.Pages;
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!;
}
}

View File

@@ -0,0 +1,39 @@
using System;
using System.Linq;
namespace Nebula.Launcher.ViewModels.Pages;
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);
}
}

View File

@@ -0,0 +1,19 @@
using System.Globalization;
namespace Nebula.Launcher.ViewModels.Pages;
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);
}
}

View File

@@ -0,0 +1,9 @@
namespace Nebula.Launcher.ViewModels.Pages;
public interface IConfigControl
{
public string ConfigName { get; }
public bool Dirty {get;}
public abstract void SetValue(object value);
public abstract object GetValue();
}

View File

@@ -0,0 +1,14 @@
namespace Nebula.Launcher.ViewModels.Pages;
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);
}
}

View File

@@ -0,0 +1,14 @@
namespace Nebula.Launcher.ViewModels.Pages;
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;
}
}

View File

@@ -0,0 +1,53 @@
using Avalonia.Controls;
using Avalonia.Layout;
namespace Nebula.Launcher.ViewModels.Pages;
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()!;
}
}

View File

@@ -14,7 +14,7 @@ public class LocalizedLabel : Label
set set
{ {
SetValue(LocalIdProperty, value); SetValue(LocalIdProperty, value);
Content = LocalisationService.GetString(value); Content = LocalizationService.GetString(value);
} }
} }
} }

View File

@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Reactive;
using Avalonia.Threading;
namespace Nebula.Launcher.Controls;
public class SimpleGraph : Control
{
// Bindable data: list of doubles or points
public static readonly StyledProperty<ObservableCollection<double>> ValuesProperty =
AvaloniaProperty.Register<SimpleGraph,ObservableCollection<double>>(nameof(Values));
public static readonly StyledProperty<IBrush> GraphBrushProperty =
AvaloniaProperty.Register<SimpleGraph, IBrush>(nameof(GraphBrush), Brushes.CornflowerBlue);
public static readonly StyledProperty<IBrush> GridBrushProperty =
AvaloniaProperty.Register<SimpleGraph, IBrush>(nameof(GridBrush), Brushes.LightGray);
static SimpleGraph()
{
ValuesProperty.Changed.Subscribe(
new AnonymousObserver<AvaloniaPropertyChangedEventArgs<ObservableCollection<double>>>(args =>
{
if (args.Sender is not SimpleGraph g)
return;
g.InvalidateVisual();
g.Values.CollectionChanged += g.ValuesOnCollectionChanged;
}));
}
public SimpleGraph()
{
Values = new ObservableCollection<double>();
}
private void ValuesOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
Dispatcher.UIThread.Post(InvalidateVisual);
}
public ObservableCollection<double> Values
{
get => GetValue(ValuesProperty);
set => SetValue(ValuesProperty, value);
}
public IBrush GraphBrush
{
get => GetValue(GraphBrushProperty);
set => SetValue(GraphBrushProperty, value);
}
public IBrush GridBrush
{
get => GetValue(GridBrushProperty);
set => SetValue(GridBrushProperty, value);
}
public override void Render(DrawingContext context)
{
base.Render(context);
if (Bounds.Width <= 0 || Bounds.Height <= 0)
return;
// background grid
DrawGrid(context, Bounds);
if (Values.Count == 0)
return;
var min = Values.Min();
var max = Values.Max();
if (Math.Abs(min - max) < 0.001)
{
min -= 1;
max += 1;
}
var geo = new StreamGeometry();
using (var ctx = geo.Open())
{
if (Values.Count > 1)
{
Point p0 = Map(0, Values[0]);
ctx.BeginFigure(p0, false);
for (int i = 0; i < Values.Count - 1; i++)
{
var p1 = Map(i, Values[i]);
var p2 = Map(i + 1, Values[i + 1]);
// control points for smoothing
var c1 = new Point((p1.X + p2.X) / 2, p1.Y);
var c2 = new Point((p1.X + p2.X) / 2, p2.Y);
ctx.CubicBezierTo(c1, c2, p2);
}
ctx.EndFigure(false);
}
}
// stroke
context.DrawGeometry(null, new Pen(GraphBrush, 2), geo);
// draw points
for (var i = 0; i < Values.Count; i++)
{
var p = Map(i, Values[i]);
context.DrawEllipse(GraphBrush, null, p, 3, 3);
}
return;
// map data index/value -> point
Point Map(int i, double val)
{
var x = Bounds.X + Bounds.Width * (i / (double)Math.Max(1, Values.Count - 1));
var y = Bounds.Y + Bounds.Height - (val - min) / (max - min) * Bounds.Height;
return new Point(x, y);
}
}
private void DrawGrid(DrawingContext dc, Rect r)
{
var pen = new Pen(GridBrush, 0.5);
var rows = 4;
var cols = Math.Max(2, Values?.Count ?? 2);
for (var i = 0; i <= rows; i++)
{
var y = r.Y + i * (r.Height / rows);
dc.DrawLine(pen, new Point(r.X, y), new Point(r.Right, y));
}
for (var j = 0; j <= cols; j++)
{
var x = r.X + j * (r.Width / cols);
dc.DrawLine(pen, new Point(x, r.Y), new Point(x, r.Bottom));
}
}
}

View File

@@ -1,11 +1,13 @@
using Avalonia; using System;
using Avalonia.Controls;
using Avalonia.Data.Converters; using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Platform;
using Nebula.Launcher.ViewModels.Pages;
using Color = System.Drawing.Color;
namespace Nebula.Launcher.Converters; namespace Nebula.Launcher.Converters;
public class TypeConverters public static class TypeConverters
{ {
public static FuncValueConverter<string, string?> IconConverter { get; } = public static FuncValueConverter<string, string?> IconConverter { get; } =
new(iconKey => new(iconKey =>
@@ -13,4 +15,17 @@ public class TypeConverters
if (iconKey == null) return null; if (iconKey == null) return null;
return $"/Assets/svg/{iconKey}.svg"; return $"/Assets/svg/{iconKey}.svg";
}); });
public static FuncValueConverter<string, IImage?> ImageConverter { get; } =
new(iconKey =>
{
if (iconKey == null) return null;
return new Avalonia.Media.Imaging.Bitmap(AssetLoader.Open(new Uri($"avares://Nebula.Launcher/Assets/error_presentation/{iconKey}.png")));
});
public static FuncValueConverter<string, Avalonia.Media.Color> NameColorRepresentation { get; } =
new((str)=>ColorUtils.GetColorFromString(str ?? throw new ArgumentNullException(nameof(str),"Name of color is null!")));
public static FuncValueConverter<string, bool> StringIsNotEmpty { get; } =
new(iconKey => !string.IsNullOrEmpty(iconKey));
} }

View File

@@ -3,6 +3,8 @@ using System.Globalization;
using Nebula.Launcher.Models; using Nebula.Launcher.Models;
using Nebula.Launcher.Models.Auth; using Nebula.Launcher.Models.Auth;
using Nebula.Shared.ConfigMigrations; using Nebula.Shared.ConfigMigrations;
using Nebula.Shared.Configurations;
using Nebula.Shared.Configurations.Migrations;
using Nebula.Shared.Services; using Nebula.Shared.Services;
namespace Nebula.Launcher; namespace Nebula.Launcher;
@@ -12,10 +14,11 @@ public static class LauncherConVar
public static readonly ConVar<bool> DoMigration = public static readonly ConVar<bool> DoMigration =
ConVarBuilder.Build("migration.doMigrate", true); ConVarBuilder.Build("migration.doMigrate", true);
public static readonly ConVar<AuthTokenCredentials[]> AuthProfiles = public static readonly ConVar<string[]> AuthProfiles =
ConVarBuilder.BuildWithMigration<AuthTokenCredentials[]>("auth.profiles.v3", ConVarBuilder.BuildWithMigration<string[]>("auth.profiles.v4",
MigrationQueueBuilder.Instance MigrationQueueBuilder.Instance
.With(new ProfileMigrationV2("auth.profiles.v2","auth.profiles.v3")) .With(new ProfileMigrationV2("auth.profiles.v2","auth.profiles.v4"))
.With(new ProfileMigrationV3V4("auth.profiles.v3","auth.profiles.v4"))
.Build(), .Build(),
[]); []);
@@ -34,18 +37,22 @@ public static class LauncherConVar
"WizDen", "WizDen",
[ [
"https://harpy.durenko.tatar/auth-api/", "https://harpy.durenko.tatar/auth-api/",
"https://auth.spacestation14.com/",
"https://auth.fallback.spacestation14.com/", "https://auth.fallback.spacestation14.com/",
]),
new AuthServerCredentials(
"SimpleStation",
[
"https://auth.simplestation.org/",
]) ])
]); ]);
public static readonly ConVar<ServerHubRecord[]> Hub = ConVarBuilder.Build<ServerHubRecord[]>("launcher.hub.v2", [ 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("WizDen", "https://harpy.durenko.tatar/hub-api/api/servers"),
new ServerHubRecord("AltHub","https://web.networkgamez.com/api/servers") new ServerHubRecord("AltHub","https://hub.singularity14.co.uk/api/servers")
]); ]);
public static readonly ConVar<string> CurrentLang = ConVarBuilder.Build<string>("launcher.language", CultureInfo.CurrentCulture.Name); 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", 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"); "https://github.com/icsharpcode/ILSpy/releases/download/v9.0/ILSpy_binaries_9.0.0.7889-x64.zip");
} }

View File

@@ -2,16 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:Nebula.Launcher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
Width="600"
Height="400"
x:Class="Nebula.Launcher.MessageBox.MessageView"> x:Class="Nebula.Launcher.MessageBox.MessageView">
<Grid RowDefinitions="50,*" ColumnDefinitions="*"> <views:VisualErrorView x:Name="ErrorView"/>
<Border Grid.Column="0" Background="#222222" Padding="10" BorderBrush="#444444" BorderThickness="0,0,0,3">
<Label VerticalAlignment="Center" x:Name="Title">Text</Label>
</Border>
<Panel Margin="5" Grid.Row="1">
<Label x:Name="Message">Message</Label>
</Panel>
</Grid>
</UserControl> </UserControl>

View File

@@ -1,21 +1,22 @@
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Nebula.Launcher.ViewModels;
namespace Nebula.Launcher.MessageBox; namespace Nebula.Launcher.MessageBox;
public partial class MessageView : UserControl, IMessageContainerProvider public partial class MessageView : UserControl, IMessageContainerProvider
{ {
public MessageView(out IMessageContainerProvider provider) private readonly VisualErrorViewModel _context;
public MessageView()
{ {
InitializeComponent(); InitializeComponent();
provider = this; _context = new VisualErrorViewModel();
ErrorView.Content = _context;
} }
public void ShowMessage(string message, string title) public void ShowMessage(string message, string title)
{ {
Title.Content = title; _context.Title = title;
Message.Content = message; _context.Description = message;
} }
} }

View File

@@ -3,10 +3,52 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:messageBox="clr-namespace:Nebula.Launcher.MessageBox" xmlns:messageBox="clr-namespace:Nebula.Launcher.MessageBox"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" SystemDecorations="BorderOnly"
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="260"
Width="600" Width="600"
Height="400" Height="260"
CanResize="False"
x:Class="Nebula.Launcher.MessageBox.MessageWindow" x:Class="Nebula.Launcher.MessageBox.MessageWindow"
Title="MessageWindow"> Title="MessageWindow">
<Grid ColumnDefinitions="*" RowDefinitions="30,*">
<messageBox:MessageView
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
x:Name="MessageView" />
<Border
BorderThickness="0,0,0,2"
CornerRadius="0"
Grid.Column="0"
Grid.Row="0">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
<GradientStop Color="#222222" Offset="0.0" />
<GradientStop Color="#442222" Offset="1.0" />
</LinearGradientBrush>
</Border.BorderBrush>
<Panel
Height="30"
PointerPressed="InputElement_OnPointerPressed">
<TextBlock
FontSize="10"
Foreground="White"
IsVisible="False"
Margin="15,0"
Text="Nebula Launcher"
VerticalAlignment="Center" />
<StackPanel
HorizontalAlignment="Right"
Margin="5,0,5,0"
Orientation="Horizontal"
Spacing="8">
<Button
Click="Close_Click"
Content="🗙"
Foreground="Azure" />
</StackPanel>
</Panel>
</Border>
</Grid>
</Window> </Window>

View File

@@ -1,12 +1,28 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
namespace Nebula.Launcher.MessageBox; namespace Nebula.Launcher.MessageBox;
public partial class MessageWindow : Window public partial class MessageWindow : Window, IMessageContainerProvider
{ {
public MessageWindow(out IMessageContainerProvider provider) public MessageWindow()
{ {
InitializeComponent(); InitializeComponent();
Content = new MessageView(out provider); }
public void ShowMessage(string message, string title)
{
MessageView.ShowMessage(message, title);
}
private void Close_Click(object? sender, RoutedEventArgs e)
{
Close();
}
private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
{
BeginMoveDrag(e);
} }
} }

View File

@@ -1,10 +1,12 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Windows.Input; using System.Windows.Input;
using Avalonia.Media;
using Nebula.Shared.Services; using Nebula.Shared.Services;
namespace Nebula.Launcher.Models.Auth; namespace Nebula.Launcher.Models.Auth;
public sealed record ProfileAuthCredentials( public sealed record ProfileEntry(
AuthTokenCredentials Credentials, ProfileAuthCredentials Credentials,
string AuthName,
[property: JsonIgnore] ICommand OnSelect = default!, [property: JsonIgnore] ICommand OnSelect = default!,
[property: JsonIgnore] ICommand OnDelete = default!); [property: JsonIgnore] ICommand OnDelete = default!);

View File

@@ -31,7 +31,7 @@
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/> <PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
<PackageReference Include="libsodium" Version="1.0.20"/> <PackageReference Include="libsodium" Version="1.0.20"/>
<PackageReference Include="Robust.Natives" Version="0.1.1" /> <PackageReference Include="Robust.Natives" Version="0.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -35,7 +35,7 @@ public sealed class GameProcessStartInfoProvider(DotnetResolverService resolverS
{ {
var baseStart = await base.GetProcessStartInfo(); var baseStart = await base.GetProcessStartInfo();
var authProv = accountInfoViewModel.Credentials; var authProv = accountInfoViewModel.Credentials.Value;
if(authProv is null) if(authProv is null)
throw new Exception("Client is without selected auth"); throw new Exception("Client is without selected auth");

View File

@@ -5,23 +5,39 @@ using Microsoft.Extensions.DependencyInjection;
using Nebula.Shared; using Nebula.Shared;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Utils;
using Robust.LoaderApi;
namespace Nebula.Launcher.ProcessHelper; namespace Nebula.Launcher.ProcessHelper;
[ServiceRegister] [ServiceRegister]
public sealed class GameRunnerPreparer(IServiceProvider provider, ContentService contentService, EngineService engineService) public sealed class GameRunnerPreparer(IServiceProvider provider, ContentService contentService, EngineService engineService)
{ {
public async Task<ProcessRunHandler<GameProcessStartInfoProvider>> GetGameProcessStartInfoProvider(RobustUrl address, ILoadingHandler loadingHandler, CancellationToken cancellationToken = default) public async Task<ProcessRunHandler<GameProcessStartInfoProvider>> GetGameProcessStartInfoProvider(RobustUrl address, ILoadingHandlerFactory loadingHandlerFactory, CancellationToken cancellationToken = default)
{ {
var buildInfo = await contentService.GetBuildInfo(address, cancellationToken); var buildInfo = await contentService.GetBuildInfo(address, cancellationToken);
var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion); var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion, loadingHandlerFactory, cancellationToken);
if (engine is null) if (engine is null)
throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion); throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion);
await contentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandler, cancellationToken); var hashApi = await contentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandlerFactory, cancellationToken);
await engineService.EnsureEngineModules("Robust.Client.WebView", buildInfo.BuildInfo.Build.EngineVersion);
if (hashApi.TryOpen("manifest.yml", out var stream))
{
var modules = ContentManifestParser.ExtractModules(stream);
foreach (var moduleStr in modules)
{
var module = await engineService.EnsureEngineModules(moduleStr, loadingHandlerFactory, buildInfo.BuildInfo.Build.EngineVersion);
if(module is null)
throw new Exception("Module not found: " + moduleStr);
}
await stream.DisposeAsync();
}
var gameInfo = var gameInfo =
provider.GetService<GameProcessStartInfoProvider>()!.WithBuildInfo(buildInfo.BuildInfo.Auth.PublicKey, provider.GetService<GameProcessStartInfoProvider>()!.WithBuildInfo(buildInfo.BuildInfo.Auth.PublicKey,

View File

@@ -74,6 +74,7 @@ public sealed partial class HubServerListProvider : IServerListProvider
catch (Exception e) catch (Exception e)
{ {
_errors.Add(new Exception($"Some error while loading server list from {HubUrl}. See inner exception", e)); _errors.Add(new Exception($"Some error while loading server list from {HubUrl}. See inner exception", e));
_errors.Add(e);
} }
IsLoaded = true; IsLoaded = true;

View File

@@ -6,6 +6,7 @@ using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Nebula.Launcher.ViewModels.Popup; using Nebula.Launcher.ViewModels.Popup;
using Nebula.Shared; using Nebula.Shared;
@@ -25,7 +26,6 @@ public sealed partial class DecompilerService
[GenerateProperty] private ViewHelperService ViewHelperService {get;} [GenerateProperty] private ViewHelperService ViewHelperService {get;}
[GenerateProperty] private ContentService ContentService {get;} [GenerateProperty] private ContentService ContentService {get;}
[GenerateProperty] private FileService FileService {get;} [GenerateProperty] private FileService FileService {get;}
[GenerateProperty] private CancellationService CancellationService {get;}
[GenerateProperty] private EngineService EngineService {get;} [GenerateProperty] private EngineService EngineService {get;}
[GenerateProperty] private DebugService DebugService {get;} [GenerateProperty] private DebugService DebugService {get;}
@@ -44,16 +44,14 @@ public sealed partial class DecompilerService
Process.Start(startInfo); Process.Start(startInfo);
} }
public async void OpenServerDecompiler(RobustUrl url) public async void OpenServerDecompiler(RobustUrl url, CancellationToken cancellationToken)
{ {
var myTempDir = FileService.EnsureTempDir(out var tmpDir); var myTempDir = FileService.EnsureTempDir(out var tmpDir);
ILoadingHandler loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>(); using var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>();
var buildInfo = var buildInfo =
await ContentService.GetBuildInfo(url, CancellationService.Token); await ContentService.GetBuildInfo(url, cancellationToken);
var engine = await EngineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion); var engine = await EngineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion, loadingHandler, cancellationToken);
if (engine is null) if (engine is null)
throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion); throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion);
@@ -64,7 +62,8 @@ public sealed partial class DecompilerService
await stream.DisposeAsync(); await stream.DisposeAsync();
} }
var hashApi = await ContentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandler, CancellationService.Token);
var hashApi = await ContentService.EnsureItems(buildInfo.RobustManifestInfo, loadingHandler, cancellationToken);
foreach (var (file, hash) in hashApi.Manifest) foreach (var (file, hash) in hashApi.Manifest)
{ {
@@ -73,8 +72,6 @@ public sealed partial class DecompilerService
await stream.DisposeAsync(); await stream.DisposeAsync();
} }
((IDisposable)loadingHandler).Dispose();
_logger.Log("File extracted. " + tmpDir); _logger.Log("File extracted. " + tmpDir);
OpenDecompiler(string.Join(' ', myTempDir.AllFiles.Select(f=>Path.Join(tmpDir, f))) + " --newinstance"); OpenDecompiler(string.Join(' ', myTempDir.AllFiles.Select(f=>Path.Join(tmpDir, f))) + " --newinstance");
@@ -94,7 +91,7 @@ public sealed partial class DecompilerService
private async Task Download(){ private async Task Download(){
using var loading = ViewHelperService.GetViewModel<LoadingContextViewModel>(); using var loading = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loading.LoadingName = "Download ILSpy"; loading.LoadingName = "Download ILSpy";
loading.SetJobsCount(1); loading.CreateLoadingContext().SetJobsCount(1);
PopupMessageService.Popup(loading); PopupMessageService.Popup(loading);
using var response = await _httpClient.GetAsync(ConfigurationService.GetConfigValue(LauncherConVar.ILSpyUrl)); using var response = await _httpClient.GetAsync(ConfigurationService.GetConfigValue(LauncherConVar.ILSpyUrl));
using var zipArchive = new ZipArchive(await response.Content.ReadAsStreamAsync()); using var zipArchive = new ZipArchive(await response.Content.ReadAsStreamAsync());

View File

@@ -11,7 +11,7 @@ using Nebula.Shared.Services;
namespace Nebula.Launcher.Services; namespace Nebula.Launcher.Services;
[ConstructGenerator, ServiceRegister] [ConstructGenerator, ServiceRegister]
public partial class LocalisationService public partial class LocalizationService
{ {
[GenerateProperty] private ConfigurationService ConfigurationService { get; } [GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private DebugService DebugService { get; } [GenerateProperty] private DebugService DebugService { get; }
@@ -68,12 +68,12 @@ public partial class LocalisationService
public class LocaledText : MarkupExtension public class LocaledText : MarkupExtension
{ {
public string Key { get; set; } public string Key { get; set; }
public Dictionary<string, object>? Options { get; set; }
public LocaledText(string key) => Key = key; public LocaledText(string key) => Key = key;
public override object ProvideValue(IServiceProvider serviceProvider) public override object ProvideValue(IServiceProvider serviceProvider)
{ {
// Fetch the localized string using the key return LocalizationService.GetString(Key, Options);
return LocalisationService.GetString(Key);
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Avalonia.Logging;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using Nebula.Launcher.Models; using Nebula.Launcher.Models;
@@ -40,17 +41,9 @@ public partial class MainViewModel : ViewModelBase
[ObservableProperty] private bool _isPopupClosable = true; [ObservableProperty] private bool _isPopupClosable = true;
[ObservableProperty] private bool _popup; [ObservableProperty] private bool _popup;
[ObservableProperty] private ListItemTemplate? _selectedListItem; [ObservableProperty] private ListItemTemplate? _selectedListItem;
[ObservableProperty] private string? _loginText = LocalizationService.GetString("auth-current-login-no-name");
public bool IsLoggedIn => AccountInfoViewModel.Credentials is not null; [GenerateProperty] private LocalizationService LocalizationService { get; } // Не убирать! Без этой хуйни вся локализация идет в пизду!
public string LoginName => AccountInfoViewModel.Credentials?.Login ?? string.Empty;
public string LoginText => LocalisationService.GetString("auth-current-login-name",
new Dictionary<string, object>
{
{ "login", LoginName }
});
[GenerateProperty] private LocalisationService LocalisationService { get; } // Не убирать! Без этой хуйни вся локализация идет в пизду!
[GenerateProperty] private AccountInfoViewModel AccountInfoViewModel { get; } [GenerateProperty] private AccountInfoViewModel AccountInfoViewModel { get; }
[GenerateProperty] private DebugService DebugService { get; } = default!; [GenerateProperty] private DebugService DebugService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!; [GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
@@ -66,7 +59,7 @@ public partial class MainViewModel : ViewModelBase
{ {
Items = new ObservableCollection<ListItemTemplate>(_templates.Select(a=> Items = new ObservableCollection<ListItemTemplate>(_templates.Select(a=>
{ {
return a with { Label = LocalisationService.GetString(a.Label) }; return a with { Label = LocalizationService.GetString(a.Label) };
} }
)); ));
RequirePage<AccountInfoViewModel>(); RequirePage<AccountInfoViewModel>();
@@ -74,15 +67,15 @@ public partial class MainViewModel : ViewModelBase
protected override void Initialise() protected override void Initialise()
{ {
AccountInfoViewModel.PropertyChanged += (sender, args) => AccountInfoViewModel.Credentials.PropertyChanged += (_, args) =>
{ {
if (args.PropertyName != nameof(AccountInfoViewModel.Credentials)) if (args.PropertyName is not nameof(AccountInfoViewModel.Credentials.Value))
return; return;
UpdateCredentialsInfo();
OnPropertyChanged(nameof(LoginText));
OnPropertyChanged(nameof(IsLoggedIn));
}; };
UpdateCredentialsInfo();
_logger = DebugService.GetLogger(this); _logger = DebugService.GetLogger(this);
using var stream = typeof(MainViewModel).Assembly using var stream = typeof(MainViewModel).Assembly
@@ -99,24 +92,45 @@ public partial class MainViewModel : ViewModelBase
CheckMigration(); CheckMigration();
var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>(); var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loadingHandler.LoadingName = LocalisationService.GetString("migration-config-task"); loadingHandler.LoadingName = LocalizationService.GetString("migration-config-task");
loadingHandler.IsCancellable = false; loadingHandler.IsCancellable = false;
ConfigurationService.MigrateConfigs(loadingHandler); ConfigurationService.MigrateConfigs(loadingHandler);
if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent()) if (!VCRuntimeDllChecker.AreVCRuntimeDllsPresent())
{ {
OnPopupRequired(LocalisationService.GetString("vcruntime-check-error")); OnPopupRequired(LocalizationService.GetString("vcruntime-check-error"));
Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170"); Helper.OpenBrowser("https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170");
} }
} }
private void UpdateCredentialsInfo()
{
if(AccountInfoViewModel.Credentials.HasValue)
{
LoginText =
LocalizationService.GetString("auth-current-login-name",
new Dictionary<string, object>
{
{ "login", AccountInfoViewModel.Credentials.Value?.Login ?? "" },
{
"auth_server",
AccountInfoViewModel.GetServerAuthName(AccountInfoViewModel.Credentials.Value?.AuthServer) ?? ""
}
});
}
else
{
LoginText = LocalizationService.GetString("auth-current-login-no-name");
}
}
private void CheckMigration() private void CheckMigration()
{ {
if (!ConfigurationService.GetConfigValue(LauncherConVar.DoMigration)) if (!ConfigurationService.GetConfigValue(LauncherConVar.DoMigration))
return; return;
var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>(); var loadingHandler = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loadingHandler.LoadingName = LocalisationService.GetString("migration-label-task"); loadingHandler.LoadingName = LocalizationService.GetString("migration-label-task");
loadingHandler.IsCancellable = false; loadingHandler.IsCancellable = false;
if (!ContentService.CheckMigration(loadingHandler)) if (!ContentService.CheckMigration(loadingHandler))

View File

@@ -5,11 +5,12 @@ using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using Nebula.Launcher.Configurations;
using Nebula.Launcher.Models.Auth; using Nebula.Launcher.Models.Auth;
using Nebula.Launcher.Services; using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Popup; using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views.Pages; using Nebula.Launcher.Views.Pages;
using Nebula.Shared.Configurations;
using Nebula.Shared.Models.Auth; using Nebula.Shared.Models.Auth;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging; using Nebula.Shared.Services.Logging;
@@ -23,82 +24,52 @@ namespace Nebula.Launcher.ViewModels.Pages;
public partial class AccountInfoViewModel : ViewModelBase public partial class AccountInfoViewModel : ViewModelBase
{ {
[ObservableProperty] private bool _authMenuExpand; [ObservableProperty] private bool _authMenuExpand;
[ObservableProperty] private bool _authUrlConfigExpand; [ObservableProperty] private bool _authUrlConfigExpand;
[ObservableProperty] private int _authViewSpan = 1; [ObservableProperty] private int _authViewSpan = 1;
[ObservableProperty] private string _currentAuthServer = string.Empty; [ObservableProperty] private string _currentAuthServer = string.Empty;
[ObservableProperty] private string _currentLogin = string.Empty; [ObservableProperty] private string _currentLogin = string.Empty;
[ObservableProperty] private string _currentPassword = string.Empty; [ObservableProperty] private string _currentPassword = string.Empty;
[ObservableProperty] private bool _isLogged; [ObservableProperty] private bool _isLogged;
[ObservableProperty] private bool _doRetryAuth; [ObservableProperty] private bool _doRetryAuth;
[ObservableProperty] private AuthTokenCredentials? _credentials; [ObservableProperty] private AuthServerCredentials _authItemSelect;
[ObservableProperty] private string _authServerName;
private bool _isProfilesEmpty; private bool _isProfilesEmpty;
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!; [GenerateProperty] private PopupMessageService PopupMessageService { get; }
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!; [GenerateProperty] private ConfigurationService ConfigurationService { get; }
[GenerateProperty] private DebugService DebugService { get; } [GenerateProperty] private DebugService DebugService { get; }
[GenerateProperty] private AuthService AuthService { get; } = default!; [GenerateProperty] private AuthService AuthService { get; }
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!; [GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; }
public ObservableCollection<ProfileAuthCredentials> Accounts { get; } = new(); public ObservableCollection<ProfileEntry> Accounts { get; } = new();
public ObservableCollection<AuthServerCredentials> AuthUrls { get; } = new(); public ObservableCollection<AuthServerCredentials> AuthUrls { get; } = new();
[ObservableProperty] private AuthServerCredentials _authItemSelect; public ComplexConVarBinder<AuthTokenCredentials?> Credentials { get; private set; }
private ILogger _logger; private ILogger _logger;
//Design think //Design think
protected override void InitialiseInDesignMode() protected override void InitialiseInDesignMode()
{ {
AddAccount(new AuthTokenCredentials(Guid.Empty, LoginToken.Empty, "Binka", "")); AuthUrls.Add(new AuthServerCredentials("Test",["example.com","variant.lab"]));
AddAccount(new AuthTokenCredentials(Guid.Empty, LoginToken.Empty, "Binka", ""));
AuthUrls.Add(new AuthServerCredentials("Test",["example.com"])); AddAccount(new ProfileAuthCredentials("Binka", "","example.com"));
AddAccount(new ProfileAuthCredentials("Vilka","", "variant.lab"));
} }
//Real think //Real think
protected override void Initialise() protected override void Initialise()
{ {
_logger = DebugService.GetLogger(this); _logger = DebugService.GetLogger(this);
Credentials = new AuthTokenCredentialsVar(this);
Task.Run(ReadAuthConfig); Task.Run(ReadAuthConfig);
} Credentials.Value = Credentials.Value;
public async void AuthByProfile(ProfileAuthCredentials credentials)
{
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = LocalisationService.GetString("auth-try-auth-profile");
message.IsInfoClosable = false;
PopupMessageService.Popup(message);
try
{
await CatchAuthError(async () => await TryAuth(credentials.Credentials), () => message.Dispose());
}
catch (Exception ex)
{
CurrentLogin = credentials.Credentials.Login;
CurrentAuthServer = credentials.Credentials.AuthServer;
var unexpectedError = new Exception(LocalisationService.GetString("auth-error"), ex);
_logger.Error(unexpectedError);
PopupMessageService.Popup(unexpectedError);
return;
}
ConfigurationService.SetConfigValue(LauncherConVar.AuthCurrent, Credentials);
message.Dispose();
} }
public void DoAuth(string? code = null) public void DoAuth(string? code = null)
{ {
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>(); var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = LocalisationService.GetString("auth-processing"); message.InfoText = LocalizationService.GetString("auth-processing");
message.IsInfoClosable = false; message.IsInfoClosable = false;
PopupMessageService.Popup(message); PopupMessageService.Popup(message);
@@ -112,54 +83,32 @@ public partial class AccountInfoViewModel : ViewModelBase
Task.Run(async () => Task.Run(async () =>
{ {
Exception? exception = null; Exception? exception = null;
foreach (var server in serverCandidates) foreach (var server in serverCandidates)
{ {
try try
{ {
await CatchAuthError(async () => await TryAuth(CurrentLogin, CurrentPassword, server, code), ()=> message.Dispose()); await CatchAuthError(async() =>
{
Credentials.Value = await AuthService.Auth(CurrentLogin, CurrentPassword, server, code);
}, ()=> message.Dispose());
break; break;
} }
catch (Exception ex) catch (Exception ex)
{ {
var unexpectedError = new Exception(LocalisationService.GetString("auth-error"), ex); exception = new Exception(LocalizationService.GetString("auth-error"), ex);
_logger.Error(unexpectedError);
PopupMessageService.Popup(unexpectedError);
} }
} }
message.Dispose(); message.Dispose();
if (!IsLogged) if (exception != null)
{ {
PopupMessageService.Popup(exception ?? new Exception(LocalisationService.GetString("auth-error"))); PopupMessageService.Popup(new Exception("Error while auth", exception));
} }
}); });
} }
private async Task TryAuth(AuthTokenCredentials authTokenCredentials)
{
CurrentLogin = authTokenCredentials.Login;
CurrentAuthServer = authTokenCredentials.AuthServer;
await SetAuth(authTokenCredentials);
IsLogged = true;
}
private async Task SetAuth(AuthTokenCredentials authTokenCredentials)
{
await AuthService.EnsureToken(authTokenCredentials);
Credentials = authTokenCredentials;
}
private async Task TryAuth(string login, string password, string authServer, string? code)
{
Credentials = await AuthService.Auth(login, password, authServer, code);
CurrentLogin = login;
CurrentPassword = password;
CurrentAuthServer = authServer;
IsLogged = true;
ConfigurationService.SetConfigValue(LauncherConVar.AuthCurrent, Credentials);
}
private async Task CatchAuthError(Func<Task> a, Action? onError) private async Task CatchAuthError(Func<Task> a, Action? onError)
{ {
DoRetryAuth = false; DoRetryAuth = false;
@@ -176,15 +125,24 @@ public partial class AccountInfoViewModel : ViewModelBase
case AuthenticateDenyCode.TfaRequired: case AuthenticateDenyCode.TfaRequired:
case AuthenticateDenyCode.TfaInvalid: case AuthenticateDenyCode.TfaInvalid:
var p = ViewHelperService.GetViewModel<TfaViewModel>(); var p = ViewHelperService.GetViewModel<TfaViewModel>();
p.OnTfaEntered += OnTfaEntered;
PopupMessageService.Popup(p); PopupMessageService.Popup(p);
_logger.Log("TFA required"); _logger.Log("TFA required");
break; break;
case AuthenticateDenyCode.InvalidCredentials: case AuthenticateDenyCode.InvalidCredentials:
PopupError(LocalisationService.GetString("auth-invalid-credentials"), e); PopupError(LocalizationService.GetString("auth-invalid-credentials"), e);
break;
case AuthenticateDenyCode.AccountLocked:
PopupError(LocalizationService.GetString("auth-account-locked"), e);
break;
case AuthenticateDenyCode.AccountUnconfirmed:
PopupError(LocalizationService.GetString("auth-account-unconfirmed"), e);
break;
case AuthenticateDenyCode.None:
PopupError(LocalizationService.GetString("auth-none"),e);
break; break;
default: default:
throw; PopupError(LocalizationService.GetString("auth-error-fuck"), e);
break;
} }
} }
catch (HttpRequestException e) catch (HttpRequestException e)
@@ -193,22 +151,46 @@ public partial class AccountInfoViewModel : ViewModelBase
switch (e.HttpRequestError) switch (e.HttpRequestError)
{ {
case HttpRequestError.ConnectionError: case HttpRequestError.ConnectionError:
PopupError(LocalisationService.GetString("auth-connection-error"), e); PopupError(LocalizationService.GetString("auth-connection-error"), e);
DoRetryAuth = true; DoRetryAuth = true;
break; break;
case HttpRequestError.NameResolutionError: case HttpRequestError.NameResolutionError:
PopupError(LocalisationService.GetString("auth-name-resolution-error"), e); PopupError(LocalizationService.GetString("auth-name-resolution-error"), e);
DoRetryAuth = true; DoRetryAuth = true;
break; break;
case HttpRequestError.SecureConnectionError: case HttpRequestError.SecureConnectionError:
PopupError(LocalisationService.GetString("auth-secure-error"), e); PopupError(LocalizationService.GetString("auth-secure-error"), e);
DoRetryAuth = true; DoRetryAuth = true;
break; break;
case HttpRequestError.UserAuthenticationError:
PopupError(LocalizationService.GetString("auth-user-authentication-error"), e);
break;
case HttpRequestError.Unknown:
PopupError(LocalizationService.GetString("auth-unknown"), e);
break;
case HttpRequestError.HttpProtocolError:
PopupError(LocalizationService.GetString("auth-http-protocol-error"), e);
break;
case HttpRequestError.ExtendedConnectNotSupported:
PopupError(LocalizationService.GetString("auth-extended-connect-not-support"), e);
break;
case HttpRequestError.VersionNegotiationError:
PopupError(LocalizationService.GetString("auth-version-negotiation-error"), e);
break;
case HttpRequestError.ProxyTunnelError:
PopupError(LocalizationService.GetString("auth-proxy-tunnel-error"), e);
break;
case HttpRequestError.InvalidResponse:
PopupError(LocalizationService.GetString("auth-invalid-response"), e);
break;
case HttpRequestError.ResponseEnded:
PopupError(LocalizationService.GetString("auth-response-ended"), e);
break;
case HttpRequestError.ConfigurationLimitExceeded:
PopupError(LocalizationService.GetString("auth-configuration-limit-exceeded"), e);
break;
default: default:
var authError = new Exception(LocalisationService.GetString("auth-error"), e); var authError = new Exception(LocalizationService.GetString("auth-error"), e);
_logger.Error(authError); _logger.Error(authError);
PopupMessageService.Popup(authError); PopupMessageService.Popup(authError);
break; break;
@@ -216,15 +198,16 @@ public partial class AccountInfoViewModel : ViewModelBase
} }
} }
private void OnTfaEntered(string code)
{
DoAuth(code);
}
public void Logout() public void Logout()
{ {
IsLogged = false; Credentials.Value = null;
Credentials = null; CurrentAuthServer = "";
}
public string GetServerAuthName(string? url)
{
if (url is null) return "";
return AuthUrls.FirstOrDefault(p => p.Servers.Contains(url))?.Name ?? "CustomAuth";
} }
private void UpdateAuthMenu() private void UpdateAuthMenu()
@@ -235,13 +218,22 @@ public partial class AccountInfoViewModel : ViewModelBase
AuthViewSpan = 1; AuthViewSpan = 1;
} }
private void AddAccount(AuthTokenCredentials credentials) private void AddAccount(ProfileAuthCredentials credentials)
{ {
var onDelete = new DelegateCommand<ProfileAuthCredentials>(OnDeleteProfile); var onDelete = new DelegateCommand<ProfileEntry>(OnDeleteProfile);
var onSelect = new DelegateCommand<ProfileAuthCredentials>(AuthByProfile); var onSelect = new DelegateCommand<ProfileEntry>((p) =>
{
CurrentLogin = p.Credentials.Login;
CurrentPassword = p.Credentials.Password;
CurrentAuthServer = p.Credentials.AuthServer;
DoAuth();
});
var alpm = new ProfileAuthCredentials( var serverName = GetServerAuthName(credentials.AuthServer);
var alpm = new ProfileEntry(
credentials, credentials,
serverName,
onSelect, onSelect,
onDelete); onDelete);
@@ -251,66 +243,100 @@ public partial class AccountInfoViewModel : ViewModelBase
Accounts.Add(alpm); Accounts.Add(alpm);
} }
private void ReadAuthConfig() private async Task ReadAuthConfig()
{ {
var message = ViewHelperService.GetViewModel<InfoPopupViewModel>(); var message = ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = LocalisationService.GetString("auth-config-read"); message.InfoText = LocalizationService.GetString("auth-config-read");
message.IsInfoClosable = false; message.IsInfoClosable = false;
PopupMessageService.Popup(message); PopupMessageService.Popup(message);
foreach (var profile in
ConfigurationService.GetConfigValue(LauncherConVar.AuthProfiles)!)
AddAccount(profile);
if (Accounts.Count == 0) UpdateAuthMenu(); _logger.Log("Reading auth config");
AuthUrls.Clear(); AuthUrls.Clear();
var authUrls = ConfigurationService.GetConfigValue(LauncherConVar.AuthServers)!; var authUrls = ConfigurationService.GetConfigValue(LauncherConVar.AuthServers)!;
foreach (var url in authUrls) AuthUrls.Add(url); foreach (var url in authUrls) AuthUrls.Add(url);
if(authUrls.Length > 0) AuthItemSelect = authUrls[0]; if(authUrls.Length > 0) AuthItemSelect = authUrls[0];
message.Dispose();
DoCurrentAuth(); var profileCandidates = new List<string>();
}
public async void DoCurrentAuth() foreach (var profileRaw in
{ ConfigurationService.GetConfigValue(LauncherConVar.AuthProfiles)!)
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)
{ {
_logger.Log($"Decrypting profile...");
try try
{ {
await CatchAuthError(async () => await TryAuth(currProfile), () => message.Dispose()); var decoded =
await CryptographicStore.Decrypt<ProfileAuthCredentials>(profileRaw,
CryptographicStore.GetComputerKey());
_logger.Log($"Decrypted profile: {decoded.Login}");
profileCandidates.Add(profileRaw);
AddAccount(decoded);
} }
catch (Exception ex) catch (Exception e)
{ {
var unexpectedError = new Exception(LocalisationService.GetString("auth-error"), ex); _logger.Error("Error while decrypting profile");
_logger.Error(unexpectedError); _logger.Error(e);
PopupMessageService.Popup(unexpectedError);
return;
} }
} }
ConfigurationService.SetConfigValue(LauncherConVar.AuthProfiles, profileCandidates.ToArray());
if (Accounts.Count == 0) UpdateAuthMenu();
message.Dispose(); message.Dispose();
} }
[RelayCommand] public void DoCurrentAuth()
private void OnSaveProfile()
{ {
if(Credentials is null) return; DoAuth();
}
AddAccount(Credentials); private async Task<AuthTokenCredentials?> CheckOrRenewToken(AuthTokenCredentials? authTokenCredentials)
{
if(authTokenCredentials is null)
return null;
var daysLeft = (int)(authTokenCredentials.Token.ExpireTime - DateTime.Now).TotalDays;
if(daysLeft >= 4)
{
_logger.Log("Token " + authTokenCredentials.Login + " is active, "+daysLeft+" days left, undo renewing!");
return authTokenCredentials;
}
try
{
_logger.Log($"Renewing token for {authTokenCredentials.Login}");
return await ExceptionHelper.TryRun(() => AuthService.Refresh(authTokenCredentials), 3,
(attempt, e) => { _logger.Error(new Exception("Error while renewing, attempts: " + attempt, e)); });
}
catch (AuthTokenExpiredException e)
{
_logger.Error(e);
return null;
}
catch (Exception e)
{
var unexpectedError = new Exception(LocalizationService.GetString("auth-error"), e);
_logger.Error(unexpectedError);
return authTokenCredentials;
}
}
public void OnSaveProfile()
{
if(Credentials.Value is null ||
string.IsNullOrEmpty(CurrentPassword)) return;
AddAccount(new ProfileAuthCredentials(CurrentLogin, CurrentPassword, Credentials.Value.AuthServer));
_isProfilesEmpty = Accounts.Count == 0; _isProfilesEmpty = Accounts.Count == 0;
UpdateAuthMenu(); UpdateAuthMenu();
DirtyProfile(); DirtyProfile();
} }
private void OnDeleteProfile(ProfileAuthCredentials account) private void OnDeleteProfile(ProfileEntry account)
{ {
Accounts.Remove(account); Accounts.Remove(account);
_isProfilesEmpty = Accounts.Count == 0; _isProfilesEmpty = Accounts.Count == 0;
@@ -320,7 +346,7 @@ public partial class AccountInfoViewModel : ViewModelBase
private void PopupError(string message, Exception e) private void PopupError(string message, Exception e)
{ {
message = LocalisationService.GetString("auth-error-occured") + message; message = LocalizationService.GetString("auth-error-occured") + message;
_logger.Error(new Exception(message, e)); _logger.Error(new Exception(message, e));
var messageView = ViewHelperService.GetViewModel<InfoPopupViewModel>(); var messageView = ViewHelperService.GetViewModel<InfoPopupViewModel>();
@@ -329,14 +355,12 @@ public partial class AccountInfoViewModel : ViewModelBase
PopupMessageService.Popup(messageView); PopupMessageService.Popup(messageView);
} }
[RelayCommand] public void OnExpandAuthUrl()
private void OnExpandAuthUrl()
{ {
AuthUrlConfigExpand = !AuthUrlConfigExpand; AuthUrlConfigExpand = !AuthUrlConfigExpand;
} }
[RelayCommand] public void OnExpandAuthView()
private void OnExpandAuthView()
{ {
AuthMenuExpand = !AuthMenuExpand; AuthMenuExpand = !AuthMenuExpand;
UpdateAuthMenu(); UpdateAuthMenu();
@@ -345,6 +369,79 @@ public partial class AccountInfoViewModel : ViewModelBase
private void DirtyProfile() private void DirtyProfile()
{ {
ConfigurationService.SetConfigValue(LauncherConVar.AuthProfiles, ConfigurationService.SetConfigValue(LauncherConVar.AuthProfiles,
Accounts.Select(a => a.Credentials).ToArray()); Accounts.Select(a => CryptographicStore.Encrypt(a.Credentials, CryptographicStore.GetComputerKey())).ToArray());
}
public sealed class AuthTokenCredentialsVar(AccountInfoViewModel accountInfoViewModel)
: ComplexConVarBinder<AuthTokenCredentials?>(
accountInfoViewModel.ConfigurationService.SubscribeVarChanged(LauncherConVar.AuthCurrent))
{
protected override async Task<AuthTokenCredentials?> OnValueChange(AuthTokenCredentials? currProfile)
{
if (currProfile is null)
{
accountInfoViewModel.IsLogged = false;
accountInfoViewModel._logger.Log("clearing credentials");
return null;
}
var message = accountInfoViewModel.ViewHelperService.GetViewModel<InfoPopupViewModel>();
message.InfoText = LocalizationService.GetString("auth-try-auth-config");
message.IsInfoClosable = false;
accountInfoViewModel.PopupMessageService.Popup(message);
accountInfoViewModel._logger.Log($"trying auth with {currProfile.Login}");
var errorRun = false;
currProfile = await accountInfoViewModel.CheckOrRenewToken(currProfile);
if (currProfile is null)
{
message.Dispose();
accountInfoViewModel._logger.Log("profile credentials update required!");
accountInfoViewModel.PopupMessageService.Popup("profile credentials update required!");
accountInfoViewModel.IsLogged = false;
return null;
}
try
{
await accountInfoViewModel.CatchAuthError(async () =>
{
await accountInfoViewModel.AuthService.EnsureToken(currProfile);
}, () =>
{
message.Dispose();
errorRun = true;
});
message.Dispose();
}
catch (Exception ex)
{
accountInfoViewModel.CurrentLogin = currProfile.Login;
accountInfoViewModel.CurrentAuthServer = currProfile.AuthServer;
var unexpectedError = new Exception(LocalizationService.GetString("auth-error"), ex);
accountInfoViewModel._logger.Error(unexpectedError);
accountInfoViewModel.PopupMessageService.Popup(unexpectedError);
errorRun = true;
}
if (errorRun)
{
accountInfoViewModel.IsLogged = false;
return null;
}
accountInfoViewModel.IsLogged = true;
accountInfoViewModel.AuthServerName = accountInfoViewModel.GetServerAuthName(currProfile.AuthServer);
return currProfile;
} }
} }
}

View File

@@ -1,20 +1,14 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Nebula.Launcher.Services; using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Popup; using Nebula.Launcher.ViewModels.Popup;
using Nebula.Launcher.Views.Pages; using Nebula.Launcher.Views.Pages;
using Nebula.Shared; using Nebula.Shared;
using Nebula.Shared.Configurations;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.ViewHelper; using Nebula.Shared.ViewHelper;
@@ -95,7 +89,7 @@ public partial class ConfigurationViewModel : ViewModelBase
using var loader = ViewHelperService.GetViewModel<LoadingContextViewModel>(); using var loader = ViewHelperService.GetViewModel<LoadingContextViewModel>();
loader.LoadingName = "Removing content"; loader.LoadingName = "Removing content";
PopupService.Popup(loader); PopupService.Popup(loader);
ContentService.RemoveAllContent(loader, CancellationService.Token); ContentService.RemoveAllContent(loader.CreateLoadingContext(), CancellationService.Token);
}); });
} }
@@ -119,287 +113,3 @@ public partial class ConfigurationViewModel : ViewModelBase
InitConfiguration(); 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

@@ -33,6 +33,7 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase, IContentHol
[GenerateProperty] private FileService FileService { get; } = default!; [GenerateProperty] private FileService FileService { get; } = default!;
[GenerateProperty] private PopupMessageService PopupService { get; } = default!; [GenerateProperty] private PopupMessageService PopupService { get; } = default!;
[GenerateProperty] private IServiceProvider ServiceProvider { get; } [GenerateProperty] private IServiceProvider ServiceProvider { get; }
[GenerateProperty] private CancellationService CancellationService { get; set; } = default!;
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!; [GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
@@ -57,7 +58,11 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase, IContentHol
loading.LoadingName = "Unpacking entry"; loading.LoadingName = "Unpacking entry";
PopupService.Popup(loading); PopupService.Popup(loading);
Task.Run(() => ContentService.Unpack(serverEntry.FileApi, myTempDir, loading)); Task.Run(() =>
{
ContentService.Unpack(serverEntry.FileApi, myTempDir, loading.CreateLoadingContext());
loading.Dispose();
});
ExplorerHelper.OpenFolder(tmpDir); ExplorerHelper.OpenFolder(tmpDir);
} }
@@ -74,7 +79,7 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase, IContentHol
{ {
var cur = ServiceProvider.GetService<ServerFolderContentEntry>()!; var cur = ServiceProvider.GetService<ServerFolderContentEntry>()!;
cur.Init(this, ServerText.ToRobustUrl()); cur.Init(this, ServerText.ToRobustUrl());
var curContent = cur.Go(new ContentPath(SearchText)); var curContent = cur.Go(new ContentPath(SearchText), CancellationService.Token);
if(curContent == null) if(curContent == null)
throw new NullReferenceException($"{SearchText} not found in {ServerText}"); throw new NullReferenceException($"{SearchText} not found in {ServerText}");
@@ -144,11 +149,11 @@ public interface IContentEntry
public string IconPath { get; } public string IconPath { get; }
public ContentPath FullPath => Parent?.FullPath.With(Name) ?? new ContentPath(Name); public ContentPath FullPath => Parent?.FullPath.With(Name) ?? new ContentPath(Name);
public IContentEntry? Go(ContentPath path); public IContentEntry? Go(ContentPath path, CancellationToken cancellationToken);
public void GoCurrent() public void GoCurrent()
{ {
var entry = Go(ContentPath.Empty); var entry = Go(ContentPath.Empty, CancellationToken.None);
if(entry is not null) Holder.CurrentEntry = entry; if(entry is not null) Holder.CurrentEntry = entry;
} }
@@ -178,7 +183,7 @@ public sealed class LazyContentEntry : IContentEntry
_lazyEntry = entry; _lazyEntry = entry;
_lazyEntryInit = lazyEntryInit; _lazyEntryInit = lazyEntryInit;
} }
public IContentEntry? Go(ContentPath path) public IContentEntry? Go(ContentPath path, CancellationToken cancellationToken)
{ {
_lazyEntryInit?.Invoke(); _lazyEntryInit?.Invoke();
return _lazyEntry; return _lazyEntry;
@@ -196,13 +201,13 @@ public sealed class ExtContentExecutor
_decompilerService = decompilerService; _decompilerService = decompilerService;
} }
public bool TryExecute(RobustManifestItem manifestItem) public bool TryExecute(RobustManifestItem manifestItem, CancellationToken cancellationToken)
{ {
var ext = Path.GetExtension(manifestItem.Path); var ext = Path.GetExtension(manifestItem.Path);
if (ext == ".dll") if (ext == ".dll")
{ {
_decompilerService.OpenServerDecompiler(_root.ServerUrl); _decompilerService.OpenServerDecompiler(_root.ServerUrl, cancellationToken);
return true; return true;
} }
@@ -231,9 +236,9 @@ public sealed partial class ManifestContentEntry : IContentEntry
_extContentExecutor = executor; _extContentExecutor = executor;
} }
public IContentEntry? Go(ContentPath path) public IContentEntry? Go(ContentPath path, CancellationToken cancellationToken)
{ {
if (_extContentExecutor.TryExecute(_manifestItem)) if (_extContentExecutor.TryExecute(_manifestItem, cancellationToken))
return null; return null;
var ext = Path.GetExtension(_manifestItem.Path); var ext = Path.GetExtension(_manifestItem.Path);
@@ -416,15 +421,28 @@ public abstract class BaseFolderContentEntry : ViewModelBase, IContentEntry
private Dictionary<string, IContentEntry> _childs = []; private Dictionary<string, IContentEntry> _childs = [];
public string IconPath => "/Assets/svg/folder.svg"; public string IconPath => "/Assets/svg/folder.svg";
public IContentHolder Holder { get; private set; }
private IContentHolder? _holder = null;
public IContentHolder Holder
{
get
{
if(_holder == null)
throw new InvalidOperationException(
GetType().Name + " was not initialised! Call Init(IContentHolder holder, string? name = null) before using it.");
return _holder;
}
}
public IContentEntry? Parent { get; set; } public IContentEntry? Parent { get; set; }
public string? Name { get; private set; } public string? Name { get; private set; }
public IContentEntry? Go(ContentPath path) public IContentEntry? Go(ContentPath path, CancellationToken cancellationToken)
{ {
if (path.IsEmpty()) return this; if (path.IsEmpty()) return this;
if (_childs.TryGetValue(path.GetNext(), out var child)) if (_childs.TryGetValue(path.GetNext(), out var child))
return child.Go(path); return child.Go(path, cancellationToken);
return null; return null;
} }
@@ -432,7 +450,7 @@ public abstract class BaseFolderContentEntry : ViewModelBase, IContentEntry
public void Init(IContentHolder holder, string? name = null) public void Init(IContentHolder holder, string? name = null)
{ {
Name = name; Name = name;
Holder = holder; _holder = holder;
} }
public T AddChild<T>(T child) where T: IContentEntry public T AddChild<T>(T child) where T: IContentEntry

View File

@@ -66,7 +66,7 @@ public partial class ServerOverviewModel : ViewModelBase
tempItems.Add(new ServerListTabTemplate(ServiceProvider.GetService<HubServerListProvider>()!.With(record.MainUrl), record.Name)); tempItems.Add(new ServerListTabTemplate(ServiceProvider.GetService<HubServerListProvider>()!.With(record.MainUrl), record.Name));
} }
tempItems.Add(new ServerListTabTemplate(FavoriteServerListProvider, "Favorite")); tempItems.Add(new ServerListTabTemplate(FavoriteServerListProvider, LocalizationService.GetString("tab-favorite")));
Items = new ObservableCollection<ServerListTabTemplate>(tempItems); Items = new ObservableCollection<ServerListTabTemplate>(tempItems);

View File

@@ -32,7 +32,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
[GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; } [GenerateProperty] private ServerOverviewModel ServerOverviewModel { get; }
[GenerateProperty] private DebugService DebugService { get; } [GenerateProperty] private DebugService DebugService { get; }
[GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; } [GenerateProperty] private FavoriteServerListProvider FavoriteServerListProvider { get; }
public override string Title => LocalisationService.GetString("popup-add-favorite"); public override string Title => LocalizationService.GetString("popup-add-favorite");
public override bool IsClosable => true; public override bool IsClosable => true;
[ObservableProperty] private string _ipInput; [ObservableProperty] private string _ipInput;
@@ -43,7 +43,7 @@ public partial class AddFavoriteViewModel : PopupViewModelBase
try try
{ {
if(string.IsNullOrWhiteSpace(IpInput)) if(string.IsNullOrWhiteSpace(IpInput))
throw new Exception(LocalisationService.GetString("popup-add-favorite-invalid-ip")); throw new Exception(LocalizationService.GetString("popup-add-favorite-invalid-ip"));
var uri = IpInput.ToRobustUrl(); var uri = IpInput.ToRobustUrl();
FavoriteServerListProvider.AddFavorite(uri); FavoriteServerListProvider.AddFavorite(uri);

View File

@@ -12,7 +12,7 @@ public sealed partial class EditServerNameViewModel : PopupViewModelBase
{ {
[GenerateProperty] public override PopupMessageService PopupMessageService { get; } [GenerateProperty] public override PopupMessageService PopupMessageService { get; }
[GenerateProperty] public ConfigurationService ConfigurationService { get; } [GenerateProperty] public ConfigurationService ConfigurationService { get; }
public override string Title => LocalisationService.GetString("popup-edit-name"); public override string Title => LocalizationService.GetString("popup-edit-name");
public override bool IsClosable => true; public override bool IsClosable => true;
[ObservableProperty] private string _ipInput; [ObservableProperty] private string _ipInput;

View File

@@ -12,7 +12,7 @@ namespace Nebula.Launcher.ViewModels.Popup;
public sealed partial class ExceptionListViewModel : PopupViewModelBase public sealed partial class ExceptionListViewModel : PopupViewModelBase
{ {
[GenerateProperty] public override PopupMessageService PopupMessageService { get; } [GenerateProperty] public override PopupMessageService PopupMessageService { get; }
public override string Title => LocalisationService.GetString("popup-exception"); public override string Title => LocalizationService.GetString("popup-exception");
public override bool IsClosable => true; public override bool IsClosable => true;
public ObservableCollection<Exception> Errors { get; } = new(); public ObservableCollection<Exception> Errors { get; } = new();

View File

@@ -14,7 +14,7 @@ public partial class InfoPopupViewModel : PopupViewModelBase
[ObservableProperty] private string _infoText = "Test"; [ObservableProperty] private string _infoText = "Test";
public override string Title => LocalisationService.GetString("popup-information"); public override string Title => LocalizationService.GetString("popup-information");
public bool IsInfoClosable { get; set; } = true; public bool IsInfoClosable { get; set; } = true;
public override bool IsClosable => IsInfoClosable; public override bool IsClosable => IsInfoClosable;

View File

@@ -45,6 +45,6 @@ public partial class IsLoginCredentialsNullPopupViewModel : PopupViewModelBase
Dispose(); Dispose();
} }
public override string Title => LocalisationService.GetString("popup-login-credentials-warning"); public override string Title => LocalizationService.GetString("popup-login-credentials-warning");
public override bool IsClosable => true; public override bool IsClosable => true;
} }

View File

@@ -1,3 +1,5 @@
using System;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Services; using Nebula.Launcher.Services;
using Nebula.Launcher.Views.Popup; using Nebula.Launcher.Views.Popup;
@@ -9,82 +11,121 @@ namespace Nebula.Launcher.ViewModels.Popup;
[ViewModelRegister(typeof(LoadingContextView), false)] [ViewModelRegister(typeof(LoadingContextView), false)]
[ConstructGenerator] [ConstructGenerator]
public sealed partial class LoadingContextViewModel : PopupViewModelBase, ILoadingHandler public sealed partial class LoadingContextViewModel : PopupViewModelBase, ILoadingHandlerFactory, IConnectionSpeedHandler
{ {
public ObservableCollection<LoadingContext> LoadingContexts { get; } = [];
public ObservableCollection<double> Values { get; } = [];
[ObservableProperty] private string _speedText = "";
[ObservableProperty] private bool _showSpeed;
[ObservableProperty] private int _loadingColumnSize = 2;
[GenerateProperty] public override PopupMessageService PopupMessageService { get; } [GenerateProperty] public override PopupMessageService PopupMessageService { get; }
[GenerateProperty] public CancellationService CancellationService { get; } [GenerateProperty] public CancellationService CancellationService { get; }
[ObservableProperty] private int _currJobs; public string LoadingName { get; set; } = LocalizationService.GetString("popup-loading");
[ObservableProperty] private int _resolvedJobs;
[ObservableProperty] private string _message = string.Empty;
public string LoadingName { get; set; } = LocalisationService.GetString("popup-loading");
public bool IsCancellable { get; set; } = true; public bool IsCancellable { get; set; } = true;
public override bool IsClosable => false; public override bool IsClosable => false;
public override string Title => LoadingName; public override string Title => LocalizationService.GetString("popup-loading");
public void SetJobsCount(int count) public void Cancel()
{ {
CurrJobs = count;
}
public int GetJobsCount()
{
return CurrJobs;
}
public void SetResolvedJobsCount(int count)
{
ResolvedJobs = count;
}
public int GetResolvedJobsCount()
{
return ResolvedJobs;
}
public void SetLoadingMessage(string message)
{
Message = message + "\n" + Message;
}
public void Cancel(){
if (!IsCancellable) return; if (!IsCancellable) return;
CancellationService.Cancel(); CancellationService.Cancel();
Dispose(); Dispose();
} }
public void PasteSpeed(int speed)
{
if (Values.Count == 0)
{
ShowSpeed = true;
LoadingColumnSize = 1;
}
SpeedText = FileLoadingFormater.FormatBytes(speed) + " / s";
Values.Add(speed);
if(Values.Count > 10) Values.RemoveAt(0);
}
public ILoadingHandler CreateLoadingContext(ILoadingFormater? loadingFormater = null)
{
var instance = new LoadingContext(this, loadingFormater ?? DefaultLoadingFormater.Instance);
LoadingContexts.Add(instance);
return instance;
}
public void RemoveContextInstance(LoadingContext loadingContext)
{
LoadingContexts.Remove(loadingContext);
}
protected override void Initialise() protected override void Initialise()
{ {
} }
protected override void InitialiseInDesignMode() protected override void InitialiseInDesignMode()
{ {
SetJobsCount(5); var context = CreateLoadingContext();
SetResolvedJobsCount(2); context.SetJobsCount(5);
string[] debugMessages = { context.SetResolvedJobsCount(2);
"Debug: Starting phase 1...", context.SetLoadingMessage("message");
"Debug: Loading assets...",
"Debug: Connecting to server...",
"Debug: Fetching user data...",
"Debug: Applying configurations...",
"Debug: Starting phase 2...",
"Debug: Rendering UI...",
"Debug: Preparing scene...",
"Debug: Initializing components...",
"Debug: Running diagnostics...",
"Debug: Checking dependencies...",
"Debug: Verifying files...",
"Debug: Cleaning up cache...",
"Debug: Finalizing setup...",
"Debug: Setup complete.",
"Debug: Ready for launch."
};
foreach (string message in debugMessages) var ctx1 = CreateLoadingContext(new FileLoadingFormater());
ctx1.SetJobsCount(1020120);
ctx1.SetResolvedJobsCount(12331);
ctx1.SetLoadingMessage("File data");
for (var i = 0; i < 14; i++)
{ {
SetLoadingMessage(message); PasteSpeed(Random.Shared.Next(10000000));
} }
} }
} }
public sealed partial class LoadingContext : ObservableObject, ILoadingHandler
{
private readonly LoadingContextViewModel _master;
private readonly ILoadingFormater _loadingFormater;
public string LoadingText => _loadingFormater.Format(this);
[ObservableProperty] private string _message = string.Empty;
[ObservableProperty] private long _currJobs;
[ObservableProperty] private long _resolvedJobs;
public LoadingContext(LoadingContextViewModel master, ILoadingFormater loadingFormater)
{
_master = master;
_loadingFormater = loadingFormater;
}
public void SetJobsCount(long count)
{
CurrJobs = count;
OnPropertyChanged(nameof(LoadingText));
}
public long GetJobsCount()
{
return CurrJobs;
}
public void SetResolvedJobsCount(long count)
{
ResolvedJobs = count;
OnPropertyChanged(nameof(LoadingText));
}
public long GetResolvedJobsCount()
{
return ResolvedJobs;
}
public void SetLoadingMessage(string message)
{
Message = message;
}
public void Dispose()
{
_master.RemoveContextInstance(this);
}
}

View File

@@ -12,6 +12,9 @@ public abstract class PopupViewModelBase : ViewModelBase, IDisposable
public void Dispose() public void Dispose()
{ {
OnDispose();
PopupMessageService.ClosePopup(this); PopupMessageService.ClosePopup(this);
} }
protected virtual void OnDispose(){}
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using Nebula.Launcher.Services; using Nebula.Launcher.Services;
using Nebula.Launcher.ViewModels.Pages;
using Nebula.Launcher.Views.Popup; using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.ViewHelper; using Nebula.Shared.ViewHelper;
@@ -9,7 +10,10 @@ namespace Nebula.Launcher.ViewModels.Popup;
[ConstructGenerator, ViewModelRegister(typeof(TfaView))] [ConstructGenerator, ViewModelRegister(typeof(TfaView))]
public partial class TfaViewModel : PopupViewModelBase public partial class TfaViewModel : PopupViewModelBase
{ {
public Action<string>? OnTfaEntered; [GenerateProperty] public override PopupMessageService PopupMessageService { get; }
[GenerateProperty] public AccountInfoViewModel AccountInfo { get; }
public override string Title => LocalizationService.GetString("popup-twofa");
public override bool IsClosable => true;
protected override void InitialiseInDesignMode() protected override void InitialiseInDesignMode()
{ {
@@ -21,11 +25,7 @@ public partial class TfaViewModel : PopupViewModelBase
public void OnTfaEnter(string code) public void OnTfaEnter(string code)
{ {
OnTfaEntered?.Invoke(code); AccountInfo.DoAuth(code);
Dispose(); Dispose();
} }
[GenerateProperty] public override PopupMessageService PopupMessageService { get; }
public override string Title => LocalisationService.GetString("popup-twofa");
public override bool IsClosable => true;
} }

View File

@@ -174,7 +174,8 @@ public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, ILis
private async Task RunInstanceAsync(bool ignoreLoginCredentials = false) private async Task RunInstanceAsync(bool ignoreLoginCredentials = false)
{ {
if (!ignoreLoginCredentials && AccountInfoViewModel.Credentials is null) _logger.Log("Running instance..." + RealName);
if (!ignoreLoginCredentials && AccountInfoViewModel.Credentials.Value is null)
{ {
var warningContext = ViewHelperService.GetViewModel<IsLoginCredentialsNullPopupViewModel>() var warningContext = ViewHelperService.GetViewModel<IsLoginCredentialsNullPopupViewModel>()
.WithServerEntry(this); .WithServerEntry(this);
@@ -183,19 +184,29 @@ public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, ILis
return; return;
} }
using var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>(); try
loadingContext.LoadingName = "Loading instance..."; {
((ILoadingHandler)loadingContext).AppendJob(); using var viewModelLoading = ViewHelperService.GetViewModel<LoadingContextViewModel>();
viewModelLoading.LoadingName = "Loading instance...";
PopupMessageService.Popup(loadingContext); PopupMessageService.Popup(viewModelLoading);
_currentInstance = _currentInstance =
await GameRunnerPreparer.GetGameProcessStartInfoProvider(Address, loadingContext, CancellationService.Token); await GameRunnerPreparer.GetGameProcessStartInfoProvider(Address, viewModelLoading, CancellationService.Token);
_logger.Log("Preparing instance...");
_currentInstance.RegisterLogger(_currentContentLogConsumer); _currentInstance.RegisterLogger(_currentContentLogConsumer);
_currentInstance.RegisterLogger(new DebugLoggerBridge(DebugService.GetLogger($"PROCESS_{Random.Shared.Next(65535)}"))); _currentInstance.RegisterLogger(new DebugLoggerBridge(DebugService.GetLogger($"PROCESS_{Random.Shared.Next(65535)}")));
_currentInstance.OnProcessExited += OnProcessExited; _currentInstance.OnProcessExited += OnProcessExited;
RunVisible = false; RunVisible = false;
_currentInstance.Start(); _currentInstance.Start();
_logger.Log("Starting instance..." + RealName);
}
catch (Exception e)
{
var error = new Exception("Error while attempt run instance", e);
_logger.Error(error);
PopupMessageService.Popup(error);
RunVisible = true;
}
} }
private void OnProcessExited(ProcessRunHandler<GameProcessStartInfoProvider> obj) private void OnProcessExited(ProcessRunHandler<GameProcessStartInfoProvider> obj)

View File

@@ -0,0 +1,22 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Nebula.Launcher.Views;
using Nebula.Shared.ViewHelper;
namespace Nebula.Launcher.ViewModels;
[ViewModelRegister(typeof(VisualErrorView))]
public partial class VisualErrorViewModel : ViewModelBase
{
[ObservableProperty] private string _imgPath = "cinka";
[ObservableProperty] private string _title = "Error";
[ObservableProperty] private string _description = "This is an error.";
protected override void InitialiseInDesignMode()
{
}
protected override void Initialise()
{
}
}

View File

@@ -133,8 +133,9 @@
Path="/Assets/svg/user.svg" Path="/Assets/svg/user.svg"
Width="10" /> Width="10" />
<Panel> <Panel>
<TextBlock Foreground="#777777" IsVisible="{Binding IsLoggedIn}" Text="{Binding LoginText}"/> <TextBlock
<TextBlock Foreground="#777777" IsVisible="{Binding !IsLoggedIn}" Text="{services:LocaledText auth-current-login-no-name}"/> Foreground="#777777"
Text="{Binding LoginText}"/>
</Panel> </Panel>
</StackPanel> </StackPanel>
</Button> </Button>

View File

@@ -3,9 +3,9 @@
ExtendClientAreaChromeHints="NoChrome" ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1" ExtendClientAreaTitleBarHeightHint="-1"
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
Height="500" Height="550"
Icon="/Assets/nebula.ico" Icon="/Assets/nebula.ico"
MinHeight="500" MinHeight="550"
MinWidth="800" MinWidth="800"
SystemDecorations="BorderOnly" SystemDecorations="BorderOnly"
Title="Nebula.Launcher" Title="Nebula.Launcher"

View File

@@ -1,6 +1,6 @@
<UserControl <UserControl
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="1000"
mc:Ignorable="d" mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.Pages.AccountInfoView" x:Class="Nebula.Launcher.Views.Pages.AccountInfoView"
x:DataType="pages:AccountInfoViewModel" x:DataType="pages:AccountInfoViewModel"
@@ -10,7 +10,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages" 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:auth="clr-namespace:Nebula.Launcher.Models.Auth"> xmlns:auth="clr-namespace:Nebula.Launcher.Models.Auth"
xmlns:converters="clr-namespace:Nebula.Launcher.Converters">
<Design.DataContext> <Design.DataContext>
<pages:AccountInfoViewModel /> <pages:AccountInfoViewModel />
</Design.DataContext> </Design.DataContext>
@@ -38,40 +39,58 @@
ItemsSource="{Binding Accounts}" ItemsSource="{Binding Accounts}"
Padding="0"> Padding="0">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type auth:ProfileAuthCredentials}"> <DataTemplate DataType="{x:Type auth:ProfileEntry}">
<Grid ColumnDefinitions="4*,*">
<Border <Border
BoxShadow="0 1 15 -2 #121212" BoxShadow="0 1 15 -2 #121212"
CornerRadius="0,10,0,10" CornerRadius="0,10,0,10"
Margin="5,5,5,0" Margin="5,5,5,0">
VerticalAlignment="Center">
<Border.Background> <Border.Background>
<LinearGradientBrush EndPoint="50%,100%" StartPoint="50%,0%"> <LinearGradientBrush EndPoint="100%,50%" StartPoint="20%,50%">
<GradientStop Color="#292222" Offset="0.0" /> <GradientStop Color="{Binding Credentials.AuthServer,
Converter={x:Static converters:TypeConverters.NameColorRepresentation}}" Offset="0.0" />
<GradientStop Color="#222222" Offset="1.0" /> <GradientStop Color="#222222" Offset="1.0" />
</LinearGradientBrush> </LinearGradientBrush>
</Border.Background> </Border.Background>
<Panel>
<StackPanel Margin="10,5,5,5" Orientation="Horizontal">
<Label> <Label>
<TextBlock Text="{Binding Credentials.Login}" /> <TextBlock Text="{Binding AuthName}" Margin="5"/>
</Label> </Label>
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Command="{Binding OnSelect}"
CornerRadius="0,0,0,10"
Padding="5">
<customControls:LocalizedLabel LocalId="account-profile-select"/>
</Button>
<Button
Command="{Binding OnDelete}"
CornerRadius="0,10,0,0"
Padding="5">
<customControls:LocalizedLabel LocalId="account-profile-delete"/>
</Button>
</StackPanel>
</Panel>
</Border> </Border>
<Border Grid.Column="0"
CornerRadius="0,10,0,10"
Margin="5,5,5,0">
<Border.Background>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="20%,50%">
<GradientStop Color="#aa222222" Offset="0.0" />
<GradientStop Color="#222222" Offset="0.4" />
</LinearGradientBrush>
</Border.Background>
<Button
HorizontalAlignment="Stretch"
Command="{Binding OnSelect}">
<Label>
<TextBlock Text="{Binding Credentials.Login}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0"/>
</Label>
</Button>
</Border>
<Border
BoxShadow="0 1 15 -2 #121212"
CornerRadius="0,10,0,10"
Margin="0,5,5,0" Grid.Column="1" Padding="0">
<Border.Background>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="20%,50%">
<GradientStop Color="#292222" Offset="1.0" />
<GradientStop Color="#222222" Offset="1.0" />
</LinearGradientBrush>
</Border.Background>
<Button Command="{Binding OnDelete}" CornerRadius="0,10,0,10" HorizontalAlignment="Stretch">
<Svg
Height="15"
Path="/Assets/svg/delete.svg"
Width="15" />
</Button>
</Border>
</Grid>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
@@ -121,7 +140,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<customControls:LocalizedLabel VerticalAlignment="Center" LocalId="account-auth-server"/> <customControls:LocalizedLabel VerticalAlignment="Center" LocalId="account-auth-server"/>
<Button Command="{Binding ExpandAuthUrlCommand}" VerticalAlignment="Stretch"> <Button Command="{Binding OnExpandAuthUrl}" VerticalAlignment="Stretch">
<Label>+</Label> <Label>+</Label>
</Button> </Button>
</StackPanel> </StackPanel>
@@ -156,7 +175,7 @@
<customControls:LocalizedLabel LocalId="account-auth-button"/> <customControls:LocalizedLabel LocalId="account-auth-button"/>
</Button> </Button>
</Border> </Border>
<Button Command="{Binding ExpandAuthViewCommand}" HorizontalAlignment="Right"> <Button Command="{Binding OnExpandAuthView}" HorizontalAlignment="Right">
<Label> <Label>
> >
</Label> </Label>
@@ -169,9 +188,15 @@
Margin="0,0,0,20" Margin="0,0,0,20"
Path="/Assets/svg/user.svg" /> Path="/Assets/svg/user.svg" />
<Label> <Label>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel Spacing="15">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Spacing="5">
<customControls:LocalizedLabel LocalId="account-auth-hello"/> <customControls:LocalizedLabel LocalId="account-auth-hello"/>
<TextBlock Text="{Binding CurrentLogin}" /> <TextBlock Text="{Binding Credentials.Value.Login}" />
</StackPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Spacing="5">
<customControls:LocalizedLabel LocalId="account-auth-current-server"/>
<TextBlock Text="{Binding AuthServerName}" />
</StackPanel>
</StackPanel> </StackPanel>
</Label> </Label>
<StackPanel <StackPanel
@@ -184,8 +209,10 @@
<customControls:LocalizedLabel LocalId="account-auth-logout"/> <customControls:LocalizedLabel LocalId="account-auth-logout"/>
</Button> </Button>
</Border> </Border>
<Border BoxShadow="{StaticResource DefaultShadow}"> <Border BoxShadow="{StaticResource DefaultShadow}"
<Button Command="{Binding SaveProfileCommand}"> IsVisible="{Binding CurrentPassword,
Converter={x:Static converters:TypeConverters.StringIsNotEmpty}}">
<Button Command="{Binding OnSaveProfile}">
<customControls:LocalizedLabel LocalId="account-auth-save"/> <customControls:LocalizedLabel LocalId="account-auth-save"/>
</Button> </Button>
</Border> </Border>

View File

@@ -11,32 +11,70 @@
<popup:LoadingContextViewModel /> <popup:LoadingContextViewModel />
</Design.DataContext> </Design.DataContext>
<StackPanel Margin="25" Spacing="15" > <StackPanel Margin="25" Spacing="15" >
<ProgressBar Height="40" Maximum="{Binding CurrJobs}" Value="{Binding ResolvedJobs}" /> <Panel Margin="5">
<Panel> <Border Padding="15" Background="{StaticResource DefaultGrad}" BoxShadow="0 1 1 0 #121212">
<StackPanel Orientation="Horizontal" Spacing="5" HorizontalAlignment="Left" VerticalAlignment="Center"> <Label VerticalAlignment="Center">
<Label> <TextBlock Text="{Binding LoadingName}"/>
<TextBlock Text="{Binding ResolvedJobs}" />
</Label> </Label>
<Label> </Border>
/
</Label>
<Label>
<TextBlock Text="{Binding CurrJobs}" />
</Label>
</StackPanel>
<Button <Button
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" VerticalAlignment="Center"
Command="{Binding Cancel}" Command="{Binding Cancel}"
IsVisible="{Binding IsCancellable}"> IsVisible="{Binding IsCancellable}">
<Border Padding="15" Background="{StaticResource DefaultGrad}" BoxShadow="0 1 1 0 #121212">
<customControls:LocalizedLabel LocalId="task-cancel"/> <customControls:LocalizedLabel LocalId="task-cancel"/>
</Border>
</Button> </Button>
</Panel> </Panel>
<Panel> <Grid ColumnDefinitions="*,*">
<Border Background="{StaticResource DefaultForeground}" MinHeight="210"> <ScrollViewer Grid.Column="0" Grid.ColumnSpan="{Binding LoadingColumnSize}">
<TextBlock TextWrapping="Wrap" Text="{Binding Message}" MaxLines="10" Margin="15"/> <ItemsControl
</Border> Background="#00000000"
ItemsSource="{Binding LoadingContexts}"
Padding="0" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" Spacing="5" Margin="5" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type popup:LoadingContext}">
<Border Background="{StaticResource DefaultGrad}" BoxShadow="0 1 1 0 #121212">
<StackPanel Margin="15">
<ProgressBar Height="40" Maximum="{Binding CurrJobs}" Value="{Binding ResolvedJobs}" />
<Panel Margin="5 15 5 5">
<Label HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="{Binding LoadingText}" />
</Label>
<Label HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock Text="{Binding Message}" />
</Label>
</Panel> </Panel>
</StackPanel> </StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<StackPanel
Grid.Column="1"
Margin="10" Spacing="15"
IsVisible="{Binding ShowSpeed}">
<customControls:SimpleGraph Values="{Binding Values}"
Height="167"
GridBrush="{StaticResource DefaultForeground}"/>
<Border Background="{StaticResource DefaultGrad}" BoxShadow="0 1 1 0 #121212">
<Panel Margin="10">
<Label>Speed</Label>
<Label HorizontalAlignment="Right">
<TextBlock Text="{Binding SpeedText}" />
</Label>
</Panel>
</Border>
</StackPanel>
</Grid>
</StackPanel>
</UserControl> </UserControl>

View File

@@ -0,0 +1,39 @@
<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:converters="clr-namespace:Nebula.Launcher.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="viewModels:VisualErrorViewModel"
x:Class="Nebula.Launcher.Views.VisualErrorView">
<Design.DataContext>
<viewModels:VisualErrorViewModel />
</Design.DataContext>
<Grid RowDefinitions="30,*" ColumnDefinitions="200,*">
<Border Grid.Row="1" Grid.Column="0"
CornerRadius="10,0,0,10"
BorderThickness="0,0,2,0"
BorderBrush="{StaticResource DefaultForeground}">
<Image Source="{Binding ImgPath, Converter={x:Static converters:TypeConverters.ImageConverter}}" Width="200" Height="200"/>
</Border>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" CornerRadius="10,10,0,0">
<Border.Background>
<LinearGradientBrush EndPoint="100%,50%" StartPoint="10%,20%">
<GradientStop Color="#FF6B6B" Offset="0.0" />
<GradientStop Color="#FF8E53" Offset="0.3" />
<GradientStop Color="#FF5E3A" Offset="0.6" />
<GradientStop Color="#FF5e5e" Offset="1.0" />
</LinearGradientBrush>
</Border.Background>
<Label HorizontalAlignment="Center"><TextBlock Text="{Binding Title}"/></Label>
</Border>
<TextBlock
Grid.Row="1"
Grid.Column="1"
Margin="15"
HorizontalAlignment="Center"
TextWrapping="Wrap"
Text="{Binding Description}"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,11 @@
using Avalonia.Controls;
namespace Nebula.Launcher.Views;
public partial class VisualErrorView : UserControl
{
public VisualErrorView()
{
InitializeComponent();
}
}

View File

@@ -2,15 +2,18 @@ using Nebula.Runner.Services;
using Nebula.Shared; using Nebula.Shared;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils; using Nebula.Shared.Utils;
using Robust.LoaderApi; using Robust.LoaderApi;
namespace Nebula.Runner; namespace Nebula.Runner;
[ServiceRegister] [ServiceRegister]
public sealed class App(RunnerService runnerService, ContentService contentService) public sealed class App(RunnerService runnerService, ContentService contentService, DebugService debugService)
: IRedialApi : IRedialApi
{ {
public ILogger logger = debugService.GetLogger("Runner");
public void Redial(Uri uri, string text = "") public void Redial(Uri uri, string text = "")
{ {
} }
@@ -22,6 +25,8 @@ public sealed class App(RunnerService runnerService, ContentService contentServi
var url = urlraw.ToRobustUrl(); var url = urlraw.ToRobustUrl();
try
{
using var cancelTokenSource = new CancellationTokenSource(); using var cancelTokenSource = new CancellationTokenSource();
var buildInfo = await contentService.GetBuildInfo(url, cancelTokenSource.Token); var buildInfo = await contentService.GetBuildInfo(url, cancelTokenSource.Token);
@@ -44,6 +49,12 @@ public sealed class App(RunnerService runnerService, ContentService contentServi
args.Add("--ss14-address"); args.Add("--ss14-address");
args.Add(url.ToString()); args.Add(url.ToString());
await runnerService.Run(args.ToArray(), buildInfo, this, new ConsoleLoadingHandler(), cancelTokenSource.Token); await runnerService.Run(args.ToArray(), buildInfo, this, new ConsoleLoadingHandlerFactory(), cancelTokenSource.Token);
}
catch (Exception e)
{
logger.Error(e);
throw;
}
} }
} }

View File

@@ -6,6 +6,7 @@ using Nebula.Shared;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging; using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils;
using Robust.LoaderApi; using Robust.LoaderApi;
namespace Nebula.Runner.Services; namespace Nebula.Runner.Services;
@@ -24,12 +25,12 @@ public sealed class RunnerService(
private bool MetricEnabled = false; //TODO: ADD METRIC THINKS LATER private bool MetricEnabled = false; //TODO: ADD METRIC THINKS LATER
public async Task Run(string[] runArgs, RobustBuildInfo buildInfo, IRedialApi redialApi, public async Task Run(string[] runArgs, RobustBuildInfo buildInfo, IRedialApi redialApi,
ILoadingHandler loadingHandler, ILoadingHandlerFactory loadingHandler,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
_logger.Log("Start Content!"); _logger.Log("Start Content!");
var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion); var engine = await engineService.EnsureEngine(buildInfo.BuildInfo.Build.EngineVersion, loadingHandler, cancellationToken);
if (engine is null) if (engine is null)
throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion); throw new Exception("Engine version not found: " + buildInfo.BuildInfo.Build.EngineVersion);
@@ -48,7 +49,7 @@ public sealed class RunnerService(
foreach (var moduleStr in modules) foreach (var moduleStr in modules)
{ {
var module = var module =
await engineService.EnsureEngineModules(moduleStr, buildInfo.BuildInfo.Build.EngineVersion); await engineService.EnsureEngineModules(moduleStr, loadingHandler, buildInfo.BuildInfo.Build.EngineVersion);
if (module is not null) if (module is not null)
extraMounts.Add(new ApiMount(module, "/")); extraMounts.Add(new ApiMount(module, "/"));
} }
@@ -79,7 +80,7 @@ public sealed class RunnerService(
metricServer = RunHelper.RunMetric(prometheusAssembly); metricServer = RunHelper.RunMetric(prometheusAssembly);
} }
loadingHandler.Dispose();
await Task.Run(() => loader.Main(args), cancellationToken); await Task.Run(() => loader.Main(args), cancellationToken);
metricServer?.Dispose(); metricServer?.Dispose();
@@ -93,7 +94,8 @@ public static class MetricsEnabledPatcher
var harmony = harmonyService.Instance.Harmony; var harmony = harmonyService.Instance.Harmony;
var targetType = reflectionService.GetType("Robust.Shared.GameObjects.EntitySystemManager"); var targetType = reflectionService.GetType("Robust.Shared.GameObjects.EntitySystemManager");
var targetMethod = targetType.GetProperty("MetricsEnabled").GetGetMethod(); var targetMethod = targetType.GetProperty("MetricsEnabled")?.GetGetMethod() ??
throw new Exception("target method is null.. huh.. do we have patch a right think?");
var prefix = typeof(MetricsEnabledPatcher).GetMethod(nameof(MetricsEnabledGetterPrefix), var prefix = typeof(MetricsEnabledPatcher).GetMethod(nameof(MetricsEnabledGetterPrefix),
BindingFlags.Static | BindingFlags.NonPublic); BindingFlags.Static | BindingFlags.NonPublic);
@@ -139,44 +141,3 @@ public static class RunHelper
} }
} }
public static class ContentManifestParser
{
public static List<string> ExtractModules(Stream manifestStream)
{
using var reader = new StreamReader(manifestStream);
return ExtractModules(reader.ReadToEnd());
}
public static List<string> ExtractModules(string manifestContent)
{
var modules = new List<string>();
var lines = manifestContent.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
bool inModulesSection = false;
foreach (var rawLine in lines)
{
var line = rawLine.Trim();
if (line.StartsWith("modules:"))
{
inModulesSection = true;
continue;
}
if (inModulesSection)
{
if (line.StartsWith("- "))
{
modules.Add(line.Substring(2).Trim());
}
else if (!line.StartsWith(" "))
{
break;
}
}
}
return modules;
}
}

View File

@@ -1,16 +1,18 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Nebula.Shared.Configurations.Migrations;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;
using Nebula.Shared.Utils;
namespace Nebula.Shared.ConfigMigrations; namespace Nebula.Shared.ConfigMigrations;
public class ProfileMigrationV2(string oldName, string newName) public class ProfileMigrationV2(string oldName, string newName)
: BaseConfigurationMigration<ProfileAuthCredentialsV2[], AuthTokenCredentials[]>(oldName, newName) : BaseConfigurationMigration<ProfileAuthCredentials[], string[]>(oldName, newName)
{ {
protected override async Task<AuthTokenCredentials[]> Migrate(IServiceProvider serviceProvider, ProfileAuthCredentialsV2[] oldValue, ILoadingHandler loadingHandler) protected override async Task<string[]> Migrate(IServiceProvider serviceProvider, ProfileAuthCredentials[] oldValue, ILoadingHandler loadingHandler)
{ {
loadingHandler.SetLoadingMessage("Migrating Profile V2 -> V3"); loadingHandler.SetLoadingMessage("Migrating Profile V2 -> V4");
var list = new List<AuthTokenCredentials>(); var list = new List<string>();
var authService = serviceProvider.GetRequiredService<AuthService>(); var authService = serviceProvider.GetRequiredService<AuthService>();
var logger = serviceProvider.GetRequiredService<DebugService>().GetLogger("ProfileMigrationV2"); var logger = serviceProvider.GetRequiredService<DebugService>().GetLogger("ProfileMigrationV2");
foreach (var oldCredentials in oldValue) foreach (var oldCredentials in oldValue)
@@ -18,8 +20,8 @@ public class ProfileMigrationV2(string oldName, string newName)
try try
{ {
loadingHandler.SetLoadingMessage($"Migrating {oldCredentials.Login}"); loadingHandler.SetLoadingMessage($"Migrating {oldCredentials.Login}");
var newCred = await authService.Auth(oldCredentials.Login, oldCredentials.Password, oldCredentials.AuthServer); await authService.Auth(oldCredentials.Login, oldCredentials.Password, oldCredentials.AuthServer);
list.Add(newCred); list.Add(CryptographicStore.Encrypt(oldCredentials, CryptographicStore.GetComputerKey()));
} }
catch (Exception e) catch (Exception e)
{ {
@@ -33,7 +35,13 @@ public class ProfileMigrationV2(string oldName, string newName)
} }
} }
public sealed record ProfileAuthCredentialsV2( public class ProfileMigrationV3V4(string oldName, string newName)
string Login, : BaseConfigurationMigration<AuthTokenCredentials[], string[]>(oldName, newName)
string Password, {
string AuthServer); protected override Task<string[]> Migrate(IServiceProvider serviceProvider, AuthTokenCredentials[] oldValue, ILoadingHandler loadingHandler)
{
Console.WriteLine("Removing profile v3 because no password is provided");
return Task.FromResult(Array.Empty<string>());
}
}

View File

@@ -0,0 +1,18 @@
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations;
public class ConVar<T>
{
internal ConfigurationService.OnConfigurationChangedDelegate<T?>? OnValueChanged;
public ConVar(string name, T? defaultValue = default)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
DefaultValue = defaultValue;
}
public string Name { get; }
public Type Type => typeof(T);
public T? DefaultValue { get; }
}

View File

@@ -0,0 +1,25 @@
using Nebula.Shared.Configurations.Migrations;
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations;
public static class ConVarBuilder
{
public static ConVar<T> Build<T>(string name, T? defaultValue = default)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("ConVar name cannot be null or whitespace.", nameof(name));
return new ConVar<T>(name, defaultValue);
}
public static ConVar<T> BuildWithMigration<T>(string name, IConfigurationMigration migration, T? defaultValue = default)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("ConVar name cannot be null or whitespace.", nameof(name));
ConfigurationService.AddConfigurationMigration(migration);
return new ConVar<T>(name, defaultValue);
}
}

View File

@@ -0,0 +1,67 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations;
public sealed class ConVarObserver<T> : IDisposable, INotifyPropertyChanged, INotifyPropertyChanging
{
private readonly ConVar<T> _convar;
private readonly ConfigurationService _configurationService;
private T? _value;
private ConfigurationService.OnConfigurationChangedDelegate<T> _delegate;
public bool HasValue => Value != null;
public T? Value
{
get => _value;
set => _configurationService.SetConfigValue(_convar, value);
}
public ConVarObserver(ConVar<T> convar, ConfigurationService configurationService)
{
_convar = convar;
_convar.OnValueChanged += OnValueChanged;
_configurationService = configurationService;
_delegate += OnValueChanged;
OnValueChanged(configurationService.GetConfigValue(_convar));
}
private void OnValueChanged(T? value)
{
OnPropertyChanging(nameof(Value));
OnPropertyChanging(nameof(HasValue));
if(value is null && _value is null)
return;
if (_value is not null && _value.Equals(value))
return;
_value = value;
OnPropertyChanged(nameof(Value));
OnPropertyChanged(nameof(HasValue));
}
public void Dispose()
{
_convar.OnValueChanged -= OnValueChanged;
}
public static implicit operator T? (ConVarObserver<T> convar) => convar.Value;
public event PropertyChangingEventHandler? PropertyChanging;
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void OnPropertyChanging([CallerMemberName] string? propertyName = null)
{
PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
}
}

View File

@@ -0,0 +1,28 @@
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations.Migrations;
public abstract class BaseConfigurationMigration<T1,T2> : IConfigurationMigration
{
protected ConVar<T1> OldConVar;
protected ConVar<T2> NewConVar;
public BaseConfigurationMigration(string oldName, string newName)
{
OldConVar = ConVarBuilder.Build<T1>(oldName);
NewConVar = ConVarBuilder.Build<T2>(newName);
}
public async Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider, ILoadingHandler loadingHandler)
{
var oldValue = configurationService.GetConfigValue(OldConVar);
if(oldValue == null) return;
var newValue = await Migrate(serviceProvider, oldValue, loadingHandler);
configurationService.SetConfigValue(NewConVar, newValue);
configurationService.ClearConfigValue(OldConVar);
}
protected abstract Task<T2> Migrate(IServiceProvider serviceProvider, T1 oldValue, ILoadingHandler loadingHandler);
}

View File

@@ -0,0 +1,9 @@
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations.Migrations;
public interface IConfigurationMigration
{
public Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider, ILoadingHandler loadingHandler);
}

View File

@@ -0,0 +1,15 @@
using Nebula.Shared.Models;
using Nebula.Shared.Services;
namespace Nebula.Shared.Configurations.Migrations;
public class MigrationQueue(List<IConfigurationMigration> migrations) : IConfigurationMigration
{
public async Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider , ILoadingHandler loadingHandler)
{
foreach (var migration in migrations)
{
await migration.DoMigrate(configurationService, serviceProvider, loadingHandler);
}
}
}

View File

@@ -0,0 +1,19 @@
namespace Nebula.Shared.Configurations.Migrations;
public class MigrationQueueBuilder
{
public static MigrationQueueBuilder Instance => new();
private readonly List<IConfigurationMigration> _migrations = [];
public MigrationQueueBuilder With(IConfigurationMigration migration)
{
_migrations.Add(migration);
return this;
}
public MigrationQueue Build()
{
return new MigrationQueue(_migrations);
}
}

View File

@@ -1,3 +1,4 @@
using Nebula.Shared.Configurations;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services; using Nebula.Shared.Services;

View File

@@ -1,5 +1,7 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Nebula.Shared.FileApis.Interfaces; using Nebula.Shared.FileApis.Interfaces;
using Nebula.Shared.Models;
using Nebula.Shared.Utils;
namespace Nebula.Shared.FileApis; namespace Nebula.Shared.FileApis;
@@ -31,7 +33,7 @@ public sealed class FileApi : IReadWriteFileApi
return false; return false;
} }
public bool Save(string path, Stream input) public bool Save(string path, Stream input, ILoadingHandler? loadingHandler = null)
{ {
var currPath = Path.Join(RootPath, path); var currPath = Path.Join(RootPath, path);
@@ -41,6 +43,13 @@ public sealed class FileApi : IReadWriteFileApi
if (!dirInfo.Exists) dirInfo.Create(); if (!dirInfo.Exists) dirInfo.Create();
using var stream = new FileStream(currPath, FileMode.Create, FileAccess.Write, FileShare.None); using var stream = new FileStream(currPath, FileMode.Create, FileAccess.Write, FileShare.None);
if (loadingHandler != null)
{
input.CopyTo(stream, loadingHandler);
return true;
}
input.CopyTo(stream); input.CopyTo(stream);
return true; return true;
} }

View File

@@ -47,8 +47,8 @@ public class HashApi : IFileApi
return false; return false;
} }
public bool Save(RobustManifestItem item, Stream stream){ public bool Save(RobustManifestItem item, Stream stream, ILoadingHandler? loadingHandler){
return _fileApi.Save(GetManifestPath(item), stream); return _fileApi.Save(GetManifestPath(item), stream, loadingHandler);
} }
public bool Has(RobustManifestItem item){ public bool Has(RobustManifestItem item){

View File

@@ -1,8 +1,10 @@
namespace Nebula.Shared.FileApis.Interfaces; using Nebula.Shared.Models;
namespace Nebula.Shared.FileApis.Interfaces;
public interface IWriteFileApi public interface IWriteFileApi
{ {
public bool Save(string path, Stream input); public bool Save(string path, Stream input, ILoadingHandler? loadingHandler = null);
public bool Remove(string path); public bool Remove(string path);
public bool Has(string path); public bool Has(string path);
} }

View File

@@ -1,20 +1,20 @@
namespace Nebula.Shared.Models; namespace Nebula.Shared.Models;
public interface ILoadingHandler public interface ILoadingHandler : IDisposable
{ {
public void SetJobsCount(int count); public void SetJobsCount(long count);
public int GetJobsCount(); public long GetJobsCount();
public void SetResolvedJobsCount(int count); public void SetResolvedJobsCount(long count);
public int GetResolvedJobsCount(); public long GetResolvedJobsCount();
public void SetLoadingMessage(string message); public void SetLoadingMessage(string message);
public void AppendJob(int count = 1) public void AppendJob(long count = 1)
{ {
SetJobsCount(GetJobsCount() + count); SetJobsCount(GetJobsCount() + count);
} }
public void AppendResolvedJob(int count = 1) public void AppendResolvedJob(long count = 1)
{ {
SetResolvedJobsCount(GetResolvedJobsCount() + count); SetResolvedJobsCount(GetResolvedJobsCount() + count);
} }
@@ -31,6 +31,57 @@ public interface ILoadingHandler
} }
} }
public interface ILoadingFormater
{
public string Format(ILoadingHandler loadingHandler);
}
public interface ILoadingHandlerFactory: IDisposable
{
public ILoadingHandler CreateLoadingContext(ILoadingFormater? loadingFormater = null);
}
public interface IConnectionSpeedHandler
{
public void PasteSpeed(int speed);
}
public sealed class DefaultLoadingFormater : ILoadingFormater
{
public static DefaultLoadingFormater Instance = new DefaultLoadingFormater();
public string Format(ILoadingHandler loadingHandler)
{
return loadingHandler.GetResolvedJobsCount() + "/" + loadingHandler.GetJobsCount();
}
}
public sealed class FileLoadingFormater : ILoadingFormater
{
public string Format(ILoadingHandler loadingHandler)
{
return FormatBytes(loadingHandler.GetResolvedJobsCount()) + " / " + FormatBytes(loadingHandler.GetJobsCount());
}
public static string FormatBytes(long bytes)
{
const long KB = 1024;
const long MB = KB * 1024;
const long GB = MB * 1024;
const long TB = GB * 1024;
if (bytes >= TB)
return $"{bytes / (double)TB:0.##} TB";
if (bytes >= GB)
return $"{bytes / (double)GB:0.##} GB";
if (bytes >= MB)
return $"{bytes / (double)MB:0.##} MB";
if (bytes >= KB)
return $"{bytes / (double)KB:0.##} KB";
return $"{bytes} B";
}
}
public sealed class QueryJob : IDisposable public sealed class QueryJob : IDisposable
{ {
private readonly ILoadingHandler _handler; private readonly ILoadingHandler _handler;

View File

@@ -12,7 +12,7 @@
<LogicalName>Utility.runtime.json</LogicalName> <LogicalName>Utility.runtime.json</LogicalName>
</EmbeddedResource> </EmbeddedResource>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageReference Include="Robust.Natives" Version="0.1.1" /> <PackageReference Include="Robust.Natives" Version="0.2.3" />
<PackageReference Include="SharpZstd.Interop" Version="1.5.6" /> <PackageReference Include="SharpZstd.Interop" Version="1.5.6" />
</ItemGroup> </ItemGroup>

View File

@@ -38,6 +38,7 @@ public class AuthService(
var err = await e.Content.AsJson<AuthDenyError>(); var err = await e.Content.AsJson<AuthDenyError>();
if (err is null) throw; if (err is null) throw;
e.Dispose();
throw new AuthException(err); throw new AuthException(err);
} }
} }
@@ -50,15 +51,65 @@ public class AuthService(
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("SS14Auth", tokenCredentials.Token.Token); requestMessage.Headers.Authorization = new AuthenticationHeaderValue("SS14Auth", tokenCredentials.Token.Token);
using var resp = await _httpClient.SendAsync(requestMessage, cancellationService.Token); using var resp = await _httpClient.SendAsync(requestMessage, cancellationService.Token);
} }
public async Task Logout(AuthTokenCredentials tokenCredentials)
{
var authUrl = new Uri($"{tokenCredentials.AuthServer}api/auth/logout");
await restService.PostAsync<NullResponse, TokenRequest>(TokenRequest.From(tokenCredentials), authUrl, cancellationService.Token);
}
public async Task<AuthTokenCredentials> Refresh(AuthTokenCredentials tokenCredentials)
{
var authUrl = new Uri($"{tokenCredentials.AuthServer}api/auth/refresh");
try
{
var newToken = await restService.PostAsync<LoginToken, TokenRequest>(
TokenRequest.From(tokenCredentials), authUrl, cancellationService.Token);
return tokenCredentials with { Token = newToken };
}
catch (RestRequestException e)
{
if (e.StatusCode == HttpStatusCode.Unauthorized)
throw new AuthTokenExpiredException(tokenCredentials);
e.Dispose();
throw;
}
}
}
public sealed class AuthTokenExpiredException : Exception
{
public AuthTokenExpiredException(AuthTokenCredentials credentials): base("Taken token is expired. Login: " + credentials.Login)
{
}
} }
public sealed record AuthTokenCredentials(Guid UserId, LoginToken Token, string Login, string AuthServer); public sealed record AuthTokenCredentials(Guid UserId, LoginToken Token, string Login, string AuthServer);
public sealed record ProfileAuthCredentials(
string Login,
string Password,
string AuthServer);
public sealed record AuthDenyError(string[] Errors, AuthenticateDenyCode Code); public sealed record AuthDenyError(string[] Errors, AuthenticateDenyCode Code);
public sealed class AuthException(AuthDenyError error) : Exception public sealed class AuthException(AuthDenyError error) : Exception
{ {
public AuthDenyError Error { get; } = error; public AuthDenyError Error { get; } = error;
public override string Message
{
get
{
var str = "Error while logging in. Please try again. " + Error.Code;
foreach (var error in Error.Errors)
{
str += "\n" + error;
}
return str;
}
}
} }
[JsonConverter(typeof(JsonStringEnumConverter))] [JsonConverter(typeof(JsonStringEnumConverter))]
@@ -71,3 +122,13 @@ public enum AuthenticateDenyCode
TfaInvalid = 4, TfaInvalid = 4,
AccountLocked = 5, AccountLocked = 5,
} }
public sealed record TokenRequest(string Token)
{
public static TokenRequest From(AuthTokenCredentials authTokenCredentials)
{
return new TokenRequest(authTokenCredentials.Token.Token);
}
public static TokenRequest Empty { get; } = new TokenRequest("");
}

View File

@@ -1,107 +1,13 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Text.Json; using System.Text.Json;
using Microsoft.Extensions.DependencyInjection; using Nebula.Shared.Configurations;
using Nebula.Shared.Configurations.Migrations;
using Nebula.Shared.FileApis.Interfaces; using Nebula.Shared.FileApis.Interfaces;
using Nebula.Shared.Models; using Nebula.Shared.Models;
using Nebula.Shared.Services.Logging; using Nebula.Shared.Services.Logging;
using Robust.LoaderApi;
namespace Nebula.Shared.Services; 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));
DefaultValue = defaultValue;
}
public string Name { get; }
public Type Type => typeof(T);
public T? DefaultValue { get; }
}
public static class ConVarBuilder
{
public static ConVar<T> Build<T>(string name, T? defaultValue = default)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("ConVar name cannot be null or whitespace.", nameof(name));
return new ConVar<T>(name, defaultValue);
}
public static ConVar<T> BuildWithMigration<T>(string name, IConfigurationMigration migration, T? defaultValue = default)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("ConVar name cannot be null or whitespace.", nameof(name));
ConfigurationService.AddConfigurationMigration(migration);
return new ConVar<T>(name, defaultValue);
}
}
public interface IConfigurationMigration
{
public Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider, ILoadingHandler loadingHandler);
}
public abstract class BaseConfigurationMigration<T1,T2> : IConfigurationMigration
{
protected ConVar<T1> OldConVar;
protected ConVar<T2> NewConVar;
public BaseConfigurationMigration(string oldName, string newName)
{
OldConVar = ConVarBuilder.Build<T1>(oldName);
NewConVar = ConVarBuilder.Build<T2>(newName);
}
public async Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider, ILoadingHandler loadingHandler)
{
var oldValue = configurationService.GetConfigValue(OldConVar);
if(oldValue == null) return;
var newValue = await Migrate(serviceProvider, oldValue, loadingHandler);
configurationService.SetConfigValue(NewConVar, newValue);
configurationService.ClearConfigValue(OldConVar);
}
protected abstract Task<T2> Migrate(IServiceProvider serviceProvider, T1 oldValue, ILoadingHandler loadingHandler);
}
public class MigrationQueue(List<IConfigurationMigration> migrations) : IConfigurationMigration
{
public async Task DoMigrate(ConfigurationService configurationService, IServiceProvider serviceProvider , ILoadingHandler loadingHandler)
{
foreach (var migration in migrations)
{
await migration.DoMigrate(configurationService, serviceProvider, loadingHandler);
}
}
}
public class MigrationQueueBuilder
{
public static MigrationQueueBuilder Instance => new();
private readonly List<IConfigurationMigration> _migrations = [];
public MigrationQueueBuilder With(IConfigurationMigration migration)
{
_migrations.Add(migration);
return this;
}
public MigrationQueue Build()
{
return new MigrationQueue(_migrations);
}
}
[ServiceRegister] [ServiceRegister]
public class ConfigurationService public class ConfigurationService
{ {
@@ -126,23 +32,22 @@ public class ConfigurationService
ConfigurationApi = fileService.CreateFileApi("config"); ConfigurationApi = fileService.CreateFileApi("config");
} }
public void MigrateConfigs(ILoadingHandler loadingHandler) public void MigrateConfigs(ILoadingHandlerFactory loadingHandlerFactory)
{ {
Task.Run(async () => Task.Run(async () =>
{ {
var loadingHandler = loadingHandlerFactory.CreateLoadingContext();
foreach (var migration in _migrations) foreach (var migration in _migrations)
{ {
await migration.DoMigrate(this, _serviceProvider, loadingHandler); await migration.DoMigrate(this, _serviceProvider, loadingHandler);
} }
if (loadingHandler is IDisposable disposable) loadingHandler.Dispose();
{ loadingHandlerFactory.Dispose();
disposable.Dispose();
}
}); });
} }
public ConfigChangeSubscriberDisposable<T> SubscribeVarChanged<T>(ConVar<T> convar, OnConfigurationChangedDelegate<T?> @delegate, bool invokeNow = false) public ConVarObserver<T> SubscribeVarChanged<T>(ConVar<T> convar, OnConfigurationChangedDelegate<T?> @delegate, bool invokeNow = false)
{ {
convar.OnValueChanged += @delegate; convar.OnValueChanged += @delegate;
if (invokeNow) if (invokeNow)
@@ -150,7 +55,14 @@ public class ConfigurationService
@delegate(GetConfigValue(convar)); @delegate(GetConfigValue(convar));
} }
return new ConfigChangeSubscriberDisposable<T>(convar, @delegate); var delegation = SubscribeVarChanged<T>(convar);
delegation.PropertyChanged += (_, _) => @delegate(delegation.Value);
return delegation;
}
public ConVarObserver<T> SubscribeVarChanged<T>(ConVar<T> convar)
{
return new ConVarObserver<T>(convar, this);
} }
public T? GetConfigValue<T>(ConVar<T> conVar) public T? GetConfigValue<T>(ConVar<T> conVar)
@@ -253,19 +165,3 @@ public class ConfigurationService
return $"{conVar.Name}.json"; 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

@@ -1,4 +1,5 @@
using System.Buffers.Binary; using System.Buffers.Binary;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Numerics; using System.Numerics;
@@ -34,11 +35,10 @@ public partial class ContentService
} }
public async Task<HashApi> EnsureItems(ManifestReader manifestReader, Uri downloadUri, public async Task<HashApi> EnsureItems(ManifestReader manifestReader, Uri downloadUri,
ILoadingHandler loadingHandler, ILoadingHandlerFactory loadingFactory,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
List<RobustManifestItem> allItems = []; List<RobustManifestItem> allItems = [];
List<RobustManifestItem> items = [];
while (manifestReader.TryReadItem(out var item)) while (manifestReader.TryReadItem(out var item))
{ {
@@ -50,40 +50,44 @@ public partial class ContentService
var hashApi = CreateHashApi(allItems); var hashApi = CreateHashApi(allItems);
items = allItems.Where(a=> !hashApi.Has(a)).ToList(); var items = allItems.Where(a=> !hashApi.Has(a)).ToList();
loadingHandler.SetLoadingMessage("Download Count:" + items.Count);
_logger.Log("Download Count:" + items.Count); _logger.Log("Download Count:" + items.Count);
await Download(downloadUri, items, hashApi, loadingHandler, cancellationToken); await Download(downloadUri, items, hashApi, loadingFactory, cancellationToken);
return hashApi; return hashApi;
} }
public async Task<HashApi> EnsureItems(RobustManifestInfo info, ILoadingHandler loadingHandler, public async Task<HashApi> EnsureItems(RobustManifestInfo info, ILoadingHandlerFactory loadingFactory,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
_logger.Log("Getting manifest: " + info.Hash); _logger.Log("Getting manifest: " + info.Hash);
loadingHandler.SetLoadingMessage("Getting manifest: " + info.Hash); var loadingHandler = loadingFactory.CreateLoadingContext(new FileLoadingFormater());
loadingHandler.SetLoadingMessage("Loading manifest");
if (ManifestFileApi.TryOpen(info.Hash, out var stream)) if (ManifestFileApi.TryOpen(info.Hash, out var stream))
{ {
_logger.Log("Loading manifest from: " + info.Hash); _logger.Log("Loading manifest from disk");
return await EnsureItems(new ManifestReader(stream), info.DownloadUri, loadingHandler, cancellationToken); loadingHandler.Dispose();
return await EnsureItems(new ManifestReader(stream), info.DownloadUri, loadingFactory, cancellationToken);
} }
SetServerHash(info.ManifestUri.ToString(), info.Hash); SetServerHash(info.ManifestUri.ToString(), info.Hash);
_logger.Log("Fetching manifest from: " + info.ManifestUri); _logger.Log("Fetching manifest from: " + info.ManifestUri);
loadingHandler.SetLoadingMessage("Fetching manifest from: " + info.ManifestUri); loadingHandler.SetLoadingMessage("Fetching manifest from: " + info.ManifestUri.Host);
var response = await _http.GetAsync(info.ManifestUri, cancellationToken); var response = await _http.GetAsync(info.ManifestUri, cancellationToken);
if (!response.IsSuccessStatusCode) throw new Exception(); response.EnsureSuccessStatusCode();
loadingHandler.SetJobsCount(response.Content.Headers.ContentLength ?? 0);
await using var streamContent = await response.Content.ReadAsStreamAsync(cancellationToken); await using var streamContent = await response.Content.ReadAsStreamAsync(cancellationToken);
ManifestFileApi.Save(info.Hash, streamContent); ManifestFileApi.Save(info.Hash, streamContent, loadingHandler);
loadingHandler.Dispose();
streamContent.Seek(0, SeekOrigin.Begin); streamContent.Seek(0, SeekOrigin.Begin);
using var manifestReader = new ManifestReader(streamContent); using var manifestReader = new ManifestReader(streamContent);
return await EnsureItems(manifestReader, info.DownloadUri, loadingHandler, cancellationToken); return await EnsureItems(manifestReader, info.DownloadUri, loadingFactory, cancellationToken);
} }
public void Unpack(HashApi hashApi, IWriteFileApi otherApi, ILoadingHandler loadingHandler) public void Unpack(HashApi hashApi, IWriteFileApi otherApi, ILoadingHandler loadingHandler)
@@ -107,30 +111,22 @@ public partial class ContentService
} }
else else
{ {
_logger.Error("OH FUCK!! " + item.Path); _logger.Error("Error while unpacking thinks " + item.Path);
} }
loadingHandler.AppendResolvedJob(); loadingHandler.AppendResolvedJob();
}); });
if (loadingHandler is IDisposable disposable)
{
disposable.Dispose();
}
} }
public async Task Download(Uri contentCdn, List<RobustManifestItem> toDownload, HashApi hashApi, ILoadingHandler loadingHandler, private async Task Download(Uri contentCdn, List<RobustManifestItem> toDownload, HashApi hashApi, ILoadingHandlerFactory loadingHandlerFactory,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (toDownload.Count == 0 || cancellationToken.IsCancellationRequested) if (toDownload.Count == 0 || cancellationToken.IsCancellationRequested)
{ {
_logger.Log("Nothing to download! Fuck this!"); _logger.Log("Nothing to download! Skip!");
return; return;
} }
var downloadJobWatch = loadingHandler.GetQueryJob();
loadingHandler.SetLoadingMessage("Downloading from: " + contentCdn);
_logger.Log("Downloading from: " + contentCdn); _logger.Log("Downloading from: " + contentCdn);
var requestBody = new byte[toDownload.Count * 4]; var requestBody = new byte[toDownload.Count * 4];
@@ -152,70 +148,56 @@ public partial class ContentService
request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("zstd")); request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("zstd"));
var response = await _http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken); var response = await _http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
if (cancellationToken.IsCancellationRequested)
{
_logger.Log("Downloading cancelled!");
return;
}
downloadJobWatch.Dispose();
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var stream = await response.Content.ReadAsStreamAsync(); var stream = await response.Content.ReadAsStreamAsync(cancellationToken);
var bandwidthStream = new BandwidthStream(stream);
stream = bandwidthStream;
if (response.Content.Headers.ContentEncoding.Contains("zstd")) if (response.Content.Headers.ContentEncoding.Contains("zstd"))
stream = new ZStdDecompressStream(stream); stream = new ZStdDecompressStream(stream);
await using var streamDispose = stream; await using var streamDispose = stream;
// Read flags header var streamHeader = await stream.ReadExactAsync(4, cancellationToken);
var streamHeader = await stream.ReadExactAsync(4, null);
var streamFlags = (DownloadStreamHeaderFlags)BinaryPrimitives.ReadInt32LittleEndian(streamHeader); var streamFlags = (DownloadStreamHeaderFlags)BinaryPrimitives.ReadInt32LittleEndian(streamHeader);
var preCompressed = (streamFlags & DownloadStreamHeaderFlags.PreCompressed) != 0; var preCompressed = (streamFlags & DownloadStreamHeaderFlags.PreCompressed) != 0;
// compressContext.SetParameter(ZSTD_cParameter.ZSTD_c_nbWorkers, 4);
// If the stream is pre-compressed we need to decompress the blobs to verify BLAKE2B hash.
// If it isn't, we need to manually try re-compressing individual files to store them.
var compressContext = preCompressed ? null : new ZStdCCtx(); var compressContext = preCompressed ? null : new ZStdCCtx();
var decompressContext = preCompressed ? new ZStdDCtx() : null; var decompressContext = preCompressed ? new ZStdDCtx() : null;
// Normal file header:
// <int32> uncompressed length
// When preCompressed is set, we add:
// <int32> compressed length
var fileHeader = new byte[preCompressed ? 8 : 4]; var fileHeader = new byte[preCompressed ? 8 : 4];
var downloadLoadHandler = loadingHandlerFactory.CreateLoadingContext();
downloadLoadHandler.SetJobsCount(toDownload.Count);
downloadLoadHandler.SetLoadingMessage("Fetching files...");
if (loadingHandlerFactory is IConnectionSpeedHandler speedHandlerStart)
speedHandlerStart.PasteSpeed(0);
try try
{ {
// Buffer for storing compressed ZStd data.
var compressBuffer = new byte[1024]; var compressBuffer = new byte[1024];
// Buffer for storing uncompressed data.
var readBuffer = new byte[1024]; var readBuffer = new byte[1024];
var i = 0; var i = 0;
var downloadWatchdog = new Stopwatch();
loadingHandler.AppendJob(toDownload.Count); var lengthAcc = 0;
var timeAcc = 0L;
foreach (var item in toDownload) foreach (var item in toDownload)
{ {
if (cancellationToken.IsCancellationRequested) cancellationToken.ThrowIfCancellationRequested();
{
_logger.Log("Downloading cancelled!"); downloadWatchdog.Restart();
decompressContext?.Dispose();
compressContext?.Dispose();
return;
}
// Read file header. // Read file header.
await stream.ReadExactAsync(fileHeader, null); await stream.ReadExactAsync(fileHeader, cancellationToken);
var length = BinaryPrimitives.ReadInt32LittleEndian(fileHeader.AsSpan(0, 4)); var length = BinaryPrimitives.ReadInt32LittleEndian(fileHeader.AsSpan(0, 4));
var fileLoadingHandler = loadingHandlerFactory.CreateLoadingContext(new FileLoadingFormater());
fileLoadingHandler.SetLoadingMessage(item.Path.Split("/").Last());
var blockFileLoadHandle = length <= 100000;
EnsureBuffer(ref readBuffer, length); EnsureBuffer(ref readBuffer, length);
var data = readBuffer.AsMemory(0, length); var data = readBuffer.AsMemory(0, length);
@@ -226,9 +208,10 @@ public partial class ContentService
if (compressedLength > 0) if (compressedLength > 0)
{ {
fileLoadingHandler.AppendJob(compressedLength);
EnsureBuffer(ref compressBuffer, compressedLength); EnsureBuffer(ref compressBuffer, compressedLength);
var compressedData = compressBuffer.AsMemory(0, compressedLength); var compressedData = compressBuffer.AsMemory(0, compressedLength);
await stream.ReadExactAsync(compressedData, null); await stream.ReadExactAsync(compressedData, cancellationToken, blockFileLoadHandle ? null : fileLoadingHandler);
// Decompress so that we can verify hash down below. // Decompress so that we can verify hash down below.
@@ -239,24 +222,53 @@ public partial class ContentService
} }
else else
{ {
await stream.ReadExactAsync(data, null); fileLoadingHandler.AppendJob(length);
await stream.ReadExactAsync(data, cancellationToken, blockFileLoadHandle ? null : fileLoadingHandler);
} }
} }
else else
{ {
await stream.ReadExactAsync(data, null); fileLoadingHandler.AppendJob(length);
await stream.ReadExactAsync(data, cancellationToken, blockFileLoadHandle ? null : fileLoadingHandler);
} }
using var fileStream = new MemoryStream(data.ToArray()); using var fileStream = new MemoryStream(data.ToArray());
hashApi.Save(item, fileStream); hashApi.Save(item, fileStream, null);
_logger.Log("file saved:" + item.Path); _logger.Log("file saved:" + item.Path);
loadingHandler.AppendResolvedJob(); fileLoadingHandler.Dispose();
downloadLoadHandler.AppendResolvedJob();
i += 1; i += 1;
if (loadingHandlerFactory is not IConnectionSpeedHandler speedHandler)
continue;
if (downloadWatchdog.ElapsedMilliseconds + timeAcc < 1000)
{
timeAcc += downloadWatchdog.ElapsedMilliseconds;
lengthAcc += length;
continue;
}
if (timeAcc != 0)
{
timeAcc += downloadWatchdog.ElapsedMilliseconds;
lengthAcc += length;
speedHandler.PasteSpeed((int)(lengthAcc / (timeAcc / 1000)));
timeAcc = 0;
lengthAcc = 0;
continue;
}
speedHandler.PasteSpeed((int)(length / (downloadWatchdog.ElapsedMilliseconds / 1000)));
} }
} }
finally finally
{ {
downloadLoadHandler.Dispose();
decompressContext?.Dispose(); decompressContext?.Dispose();
compressContext?.Dispose(); compressContext?.Dispose();
} }

View File

@@ -5,7 +5,7 @@ namespace Nebula.Shared.Services;
public partial class ContentService public partial class ContentService
{ {
public bool CheckMigration(ILoadingHandler loadingHandler) public bool CheckMigration(ILoadingHandlerFactory loadingHandler)
{ {
_logger.Log("Checking migration..."); _logger.Log("Checking migration...");
@@ -17,16 +17,13 @@ public partial class ContentService
return true; return true;
} }
private void DoMigration(ILoadingHandler loadingHandler, List<string> migrationList) private void DoMigration(ILoadingHandlerFactory loadingHandler, List<string> migrationList)
{ {
loadingHandler.SetJobsCount(migrationList.Count); var mainLoadingHandler = loadingHandler.CreateLoadingContext();
mainLoadingHandler.SetJobsCount(migrationList.Count);
Parallel.ForEach(migrationList, (f,_)=>MigrateFile(f,loadingHandler)); Parallel.ForEach(migrationList, (f,_)=>MigrateFile(f, mainLoadingHandler) );
loadingHandler.Dispose();
if (loadingHandler is IDisposable disposable)
{
disposable.Dispose();
}
} }
private void MigrateFile(string file, ILoadingHandler loadingHandler) private void MigrateFile(string file, ILoadingHandler loadingHandler)

View File

@@ -1,7 +1,6 @@
using System.Collections.Concurrent;
using System.Reflection; using System.Reflection;
using Nebula.Shared.FileApis;
using Nebula.Shared.Services.Logging; using Nebula.Shared.Services.Logging;
using Robust.LoaderApi;
namespace Nebula.Shared.Services; namespace Nebula.Shared.Services;
@@ -9,7 +8,6 @@ namespace Nebula.Shared.Services;
public class DebugService : IDisposable public class DebugService : IDisposable
{ {
public static bool DoFileLog; public static bool DoFileLog;
private ServiceLogger Root {get; set;}
private readonly string _path = private readonly string _path =
Path.Combine(FileService.RootPath, "log", Assembly.GetEntryAssembly()?.GetName().Name ?? "App"); Path.Combine(FileService.RootPath, "log", Assembly.GetEntryAssembly()?.GetName().Name ?? "App");
@@ -18,7 +16,15 @@ public class DebugService : IDisposable
{ {
ClearLog(); ClearLog();
Root = new ServiceLogger("Root", _path); Root = new ServiceLogger("Root", _path);
Root.GetLogger("DebugService").Log("Initializing debug service " + (DoFileLog ? "with file logging" : "without file logging")); Root.GetLogger("DebugService")
.Log("Initializing debug service " + (DoFileLog ? "with file logging" : "without file logging"));
}
private ServiceLogger Root { get; }
public void Dispose()
{
Root.Dispose();
} }
public ILogger GetLogger(string loggerName) public ILogger GetLogger(string loggerName)
@@ -31,25 +37,14 @@ public class DebugService : IDisposable
return Root.GetLogger(objectToLog.GetType().Name); return Root.GetLogger(objectToLog.GetType().Name);
} }
public void Dispose()
{
Root.Dispose();
}
private void ClearLog() private void ClearLog()
{ {
if (!Directory.Exists(_path)) if (!Directory.Exists(_path))
return; return;
var di = new DirectoryInfo(_path); var di = new DirectoryInfo(_path);
foreach (var file in di.GetFiles()) foreach (var file in di.GetFiles()) file.Delete();
{ foreach (var dir in di.GetDirectories()) dir.Delete(true);
file.Delete();
}
foreach (var dir in di.GetDirectories())
{
dir.Delete(true);
}
} }
} }
@@ -63,7 +58,8 @@ public enum LoggerCategory
internal class ServiceLogger : ILogger internal class ServiceLogger : ILogger
{ {
private readonly string _directory; private readonly string _directory;
public ServiceLogger? Root { get; private set; } private readonly string _path;
public ServiceLogger(string category, string directory) public ServiceLogger(string category, string directory)
{ {
_directory = directory; _directory = directory;
@@ -78,24 +74,10 @@ internal class ServiceLogger : ILogger
File.Create(_path).Dispose(); File.Create(_path).Dispose();
} }
public ServiceLogger? Root { get; private set; }
public string Category { get; init; } public string Category { get; init; }
private ConcurrentDictionary<string, ServiceLogger> Childs { get; } = new();
private Dictionary<string, ServiceLogger> Childs { get; init; } = new();
private FileStream? _fileStream;
private StreamWriter? _streamWriter;
private readonly string _path;
public ServiceLogger GetLogger(string category)
{
if (Childs.TryGetValue(category, out var logger))
return logger;
logger = new ServiceLogger(category, _directory);
logger.Root = this;
Childs.Add(category, logger);
return logger;
}
public void Log(LoggerCategory loggerCategory, string message) public void Log(LoggerCategory loggerCategory, string message)
{ {
@@ -108,33 +90,46 @@ internal class ServiceLogger : ILogger
LogToFile(output); LogToFile(output);
} }
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() public void Dispose()
{ {
if (!DebugService.DoFileLog) return; if (!DebugService.DoFileLog) return;
_streamWriter?.Dispose();
_fileStream?.Dispose();
foreach (var (_, child) in Childs) foreach (var (_, child) in Childs)
{ {
child.Dispose(); child.Dispose();
} }
Childs.Clear();
Childs.Clear(); // Not strictly necessary, but keeps intent clear
}
public ServiceLogger GetLogger(string category)
{
return Childs.GetOrAdd(category, key =>
{
var logger = new ServiceLogger(key, _directory)
{
Root = this
};
return logger;
});
}
private void LogToFile(string output)
{
if (!DebugService.DoFileLog) return;
try
{
Root?.LogToFile(output); // Log to parent first
using var fileStream = File.Open(_path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
using var streamWriter = new StreamWriter(fileStream);
streamWriter.WriteLine(output);
}
catch (IOException ex)
{
Console.WriteLine($"[Logging Error] Failed to write log: {ex.Message}");
}
} }
} }

View File

@@ -1,40 +1,66 @@
using System.Diagnostics;
using System.IO.Compression; using System.IO.Compression;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using Nebula.Shared.Utils;
namespace Nebula.Shared.Services; namespace Nebula.Shared.Services;
[ServiceRegister] [ServiceRegister]
public class DotnetResolverService(DebugService debugService, ConfigurationService configurationService) 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 FullPath = Path.Join(FileService.RootPath, "dotnet", DotnetUrlHelper.GetRuntimeIdentifier());
private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension()); private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension());
private readonly HttpClient _httpClient = new();
public async Task<string> EnsureDotnet(){ public async Task<string> EnsureDotnet()
{
if (!Directory.Exists(FullPath)) if (!Directory.Exists(FullPath))
await Download(); await Download();
return ExecutePath; return ExecutePath;
} }
private async Task Download(){ private async Task Download()
{
var debugLogger = debugService.GetLogger(this);
debugLogger.Log($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}...");
var url = DotnetUrlHelper.GetCurrentPlatformDotnetUrl(
configurationService.GetConfigValue(CurrentConVar.DotnetUrl)!
);
using var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
await using var stream = await response.Content.ReadAsStreamAsync();
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); Directory.CreateDirectory(FullPath);
zipArchive.ExtractToDirectory(FullPath);
debugService.GetLogger("DotnetResolver").Log($"Downloading dotnet complete."); if (url.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))
{
using var zipArchive = new ZipArchive(stream);
zipArchive.ExtractToDirectory(FullPath, true);
}
else if (url.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase)
|| url.EndsWith(".tgz", StringComparison.OrdinalIgnoreCase))
{
TarUtils.ExtractTarGz(stream, FullPath);
}
else
{
throw new NotSupportedException("Unsupported archive format.");
}
debugLogger.Log("Downloading dotnet complete.");
} }
} }
public static class DotnetUrlHelper public static class DotnetUrlHelper
{ {
[Obsolete("FOR TEST USING ONLY!")]
public static string? RidOverrideTest = null; // FOR TEST PURPOSES ONLY!!!
public static string GetExtension() public static string GetExtension()
{ {
if (OperatingSystem.IsWindows()) return ".exe"; if (OperatingSystem.IsWindows()) return ".exe";
@@ -43,27 +69,21 @@ public static class DotnetUrlHelper
public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl) public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl)
{ {
string? rid = GetRuntimeIdentifier(); var rid = GetRuntimeIdentifier();
if (dotnetUrl.TryGetValue(rid, out var url)) if (dotnetUrl.TryGetValue(rid, out var url)) return url;
{
return url;
}
throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}"); throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}");
} }
public static string GetRuntimeIdentifier() public static string GetRuntimeIdentifier()
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if(RidOverrideTest != null) return RidOverrideTest;
{
return Environment.Is64BitProcess ? "win-x64" : "win-x86";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ return Environment.Is64BitProcess ? "win-x64" : "win-x86";
return "linux-x64";
} if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return "linux-x64";
throw new PlatformNotSupportedException("Unsupported operating system"); throw new PlatformNotSupportedException("Unsupported operating system");
} }

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Nebula.Shared.Configurations;
using Nebula.Shared.FileApis; using Nebula.Shared.FileApis;
using Nebula.Shared.FileApis.Interfaces; using Nebula.Shared.FileApis.Interfaces;
using Nebula.Shared.Models; using Nebula.Shared.Models;
@@ -107,11 +108,13 @@ public sealed class EngineService
return info != null; return info != null;
} }
public async Task<AssemblyApi?> EnsureEngine(string version) public async Task<AssemblyApi?> EnsureEngine(string version, ILoadingHandlerFactory loadingHandlerFactory, CancellationToken cancellationToken = default)
{ {
_logger.Log("Ensure engine " + version); _logger.Log("Ensure engine " + version);
using var loadingHandler = loadingHandlerFactory.CreateLoadingContext(new FileLoadingFormater());
loadingHandler.SetLoadingMessage("Ensuring engine " + version);
if (!TryOpen(version)) await DownloadEngine(version); if (!TryOpen(version)) await DownloadEngine(version, loadingHandler, cancellationToken);
try try
{ {
@@ -127,15 +130,24 @@ public sealed class EngineService
return null; return null;
} }
public async Task DownloadEngine(string version) public async Task DownloadEngine(string version, ILoadingHandler loadingHandler, CancellationToken cancellationToken = default)
{ {
if (!TryGetVersionInfo(version, out var info)) if (!TryGetVersionInfo(version, out var info))
return; return;
_logger.Log("Downloading engine version " + version); _logger.Log("Downloading engine version " + version);
loadingHandler.SetLoadingMessage("Downloading engine version " + version);
loadingHandler.Clear();
using var client = new HttpClient(); using var client = new HttpClient();
var s = await client.GetStreamAsync(info.Url);
_engineFileApi.Save(version, s); var response = await client.GetAsync(info.Url, cancellationToken);
response.EnsureSuccessStatusCode();
loadingHandler.SetJobsCount(response.Content.Headers.ContentLength ?? 0);
await using var streamContent = await response.Content.ReadAsStreamAsync(cancellationToken);
var s = await client.GetStreamAsync(info.Url, cancellationToken);
_engineFileApi.Save(version, s, loadingHandler);
await s.DisposeAsync(); await s.DisposeAsync();
} }
@@ -175,7 +187,7 @@ public sealed class EngineService
{ {
GetEngineInfo(out var modulesInfo, out var engineVersionInfo); GetEngineInfo(out var modulesInfo, out var engineVersionInfo);
var engineVersionObj = Version.Parse(engineVersion); var engineVersionObj = Version.Parse(engineVersion.Split("-")[0]);
var module = modulesInfo.Modules[moduleName]; var module = modulesInfo.Modules[moduleName];
var selectedVersion = module.Versions.Select(kv => new { Version = Version.Parse(kv.Key), kv.Key, kv }) var selectedVersion = module.Versions.Select(kv => new { Version = Version.Parse(kv.Key), kv.Key, kv })
.Where(kv => engineVersionObj >= kv.Version) .Where(kv => engineVersionObj >= kv.Version)
@@ -186,7 +198,7 @@ public sealed class EngineService
return selectedVersion.Key; return selectedVersion.Key;
} }
public async Task<AssemblyApi?> EnsureEngineModules(string moduleName, string engineVersion) public async Task<AssemblyApi?> EnsureEngineModules(string moduleName, ILoadingHandlerFactory loadingHandlerFactory, string engineVersion)
{ {
var moduleVersion = ResolveModuleVersion(moduleName, engineVersion); var moduleVersion = ResolveModuleVersion(moduleName, engineVersion);
if (!TryGetModuleBuildInfo(moduleName, moduleVersion, out var buildInfo)) if (!TryGetModuleBuildInfo(moduleName, moduleVersion, out var buildInfo))
@@ -194,7 +206,10 @@ public sealed class EngineService
var fileName = ConcatName(moduleName, moduleVersion); var fileName = ConcatName(moduleName, moduleVersion);
if (!TryOpen(fileName)) await DownloadEngineModule(moduleName, moduleVersion); using var loadingHandler = loadingHandlerFactory.CreateLoadingContext(new FileLoadingFormater());
loadingHandler.SetLoadingMessage("Ensuring engine module " + fileName);
if (!TryOpen(fileName)) await DownloadEngineModule(moduleName, loadingHandler, moduleVersion);
try try
{ {
@@ -209,19 +224,20 @@ public sealed class EngineService
} }
} }
public async Task DownloadEngineModule(string moduleName, string moduleVersion) public async Task DownloadEngineModule(string moduleName, ILoadingHandler loadingHandler, string moduleVersion)
{ {
if (!TryGetModuleBuildInfo(moduleName, moduleVersion, out var info)) if (!TryGetModuleBuildInfo(moduleName, moduleVersion, out var info))
return; return;
_logger.Log("Downloading engine module version " + moduleVersion); _logger.Log("Downloading engine module version " + moduleVersion);
loadingHandler.SetLoadingMessage("Downloading engine module version " + moduleVersion);
using var client = new HttpClient(); using var client = new HttpClient();
var s = await client.GetStreamAsync(info.Url); var s = await client.GetStreamAsync(info.Url);
_engineFileApi.Save(ConcatName(moduleName, moduleVersion), s); _engineFileApi.Save(ConcatName(moduleName, moduleVersion), s, loadingHandler);
await s.DisposeAsync(); await s.DisposeAsync();
} }
public string ConcatName(string moduleName, string moduleVersion) private string ConcatName(string moduleName, string moduleVersion)
{ {
return moduleName + "" + moduleVersion; return moduleName + "" + moduleVersion;
} }

View File

@@ -89,14 +89,26 @@ public class FileService
} }
} }
public sealed class ConsoleLoadingHandlerFactory : ILoadingHandlerFactory
{
public ILoadingHandler CreateLoadingContext(ILoadingFormater? loadingFormater = null)
{
return new ConsoleLoadingHandler();
}
public void Dispose()
{
}
}
public sealed class ConsoleLoadingHandler : ILoadingHandler public sealed class ConsoleLoadingHandler : ILoadingHandler
{ {
private int _currJobs; private long _currJobs;
private float _percent; private float _percent;
private int _resolvedJobs; private long _resolvedJobs;
public void SetJobsCount(int count) public void SetJobsCount(long count)
{ {
_currJobs = count; _currJobs = count;
@@ -104,12 +116,12 @@ public sealed class ConsoleLoadingHandler : ILoadingHandler
Draw(); Draw();
} }
public int GetJobsCount() public long GetJobsCount()
{ {
return _currJobs; return _currJobs;
} }
public void SetResolvedJobsCount(int count) public void SetResolvedJobsCount(long count)
{ {
_resolvedJobs = count; _resolvedJobs = count;
@@ -117,7 +129,7 @@ public sealed class ConsoleLoadingHandler : ILoadingHandler
Draw(); Draw();
} }
public int GetResolvedJobsCount() public long GetResolvedJobsCount()
{ {
return _resolvedJobs; return _resolvedJobs;
} }
@@ -154,4 +166,9 @@ public sealed class ConsoleLoadingHandler : ILoadingHandler
Console.Write($"\t {_resolvedJobs}/{_currJobs}"); Console.Write($"\t {_resolvedJobs}/{_currJobs}");
} }
public void Dispose()
{
}
} }

View File

@@ -29,7 +29,34 @@ public class RestService
[Pure] [Pure]
public async Task<T> GetAsync<T>(Uri uri, CancellationToken cancellationToken) where T : notnull public async Task<T> GetAsync<T>(Uri uri, CancellationToken cancellationToken) where T : notnull
{ {
var response = await _client.GetAsync(uri, cancellationToken); var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
var response = await _client.SendAsync(httpRequestMessage, cancellationToken).ConfigureAwait(false);
return await ReadResult<T>(response, cancellationToken, uri);
}
public async Task<K> PostAsync<K, T>(T information, Uri uri, CancellationToken cancellationToken) where K : notnull
{
var json = JsonSerializer.Serialize(information, _serializerOptions);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _client.PostAsync(uri, content, cancellationToken);
return await ReadResult<K>(response, cancellationToken, uri);
}
[Pure]
public async Task<T> PostAsync<T>(Stream stream, string fileName, Uri uri, CancellationToken cancellationToken) where T : notnull
{
using var multipartFormContent =
new MultipartFormDataContent("Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture));
multipartFormContent.Add(new StreamContent(stream), "formFile", fileName);
var response = await _client.PostAsync(uri, multipartFormContent, cancellationToken);
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); return await ReadResult<T>(response, cancellationToken, uri);
} }
@@ -47,51 +74,42 @@ 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);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _client.PostAsync(uri, content, cancellationToken);
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 =
new MultipartFormDataContent("Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture));
multipartFormContent.Add(new StreamContent(stream), "formFile", "image.png");
var response = await _client.PostAsync(uri, multipartFormContent, cancellationToken);
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] [Pure]
private async Task<T> ReadResult<T>(HttpResponseMessage response, CancellationToken cancellationToken, Uri uri) where T : notnull private async Task<T> ReadResult<T>(HttpResponseMessage response, CancellationToken cancellationToken, Uri uri) where T : notnull
{ {
var content = await response.Content.ReadAsStringAsync(cancellationToken); if (typeof(T) == typeof(NullResponse) && new NullResponse() is T nullResponse)
{
return nullResponse;
}
if (typeof(T) == typeof(string) && content is T t) if (typeof(T) == typeof(string) && await response.Content.ReadAsStringAsync(cancellationToken) is T t)
return t; return t;
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
return await response.Content.AsJson<T>(); var data = await response.Content.AsJson<T>();
response.Dispose();
return data;
} }
throw new RestRequestException(response.Content, response.StatusCode, $"Error while processing {uri.ToString()}: {response.ReasonPhrase}"); var ex = new RestRequestException(response.Content, response.StatusCode,
$"Error while processing {uri.ToString()}: {response.ReasonPhrase}");
throw ex;
} }
} }
public sealed class RestRequestException(HttpContent content, HttpStatusCode statusCode, string message) : Exception(message) public sealed class NullResponse
{
}
public sealed class RestRequestException(HttpContent content, HttpStatusCode statusCode, string message) : Exception(message), IDisposable
{ {
public HttpStatusCode StatusCode { get; } = statusCode; public HttpStatusCode StatusCode { get; } = statusCode;
public HttpContent Content { get; } = content; public HttpContent Content { get; } = content;
public void Dispose()
{
Content.Dispose();
}
} }

View File

@@ -1,138 +0,0 @@
using System.Diagnostics;
namespace Nebula.Shared.Utils;
public sealed class BandwidthStream : Stream
{
private const int NumSeconds = 8;
private const int BucketDivisor = 2;
private const int BucketsPerSecond = 2 << BucketDivisor;
// TotalBuckets MUST be power of two!
private const int TotalBuckets = NumSeconds * BucketsPerSecond;
private readonly Stream _baseStream;
private readonly long[] _buckets;
private readonly Stopwatch _stopwatch;
private long _bucketIndex;
public BandwidthStream(Stream baseStream)
{
_stopwatch = Stopwatch.StartNew();
_baseStream = baseStream;
_buckets = new long[TotalBuckets];
}
public override bool CanRead => _baseStream.CanRead;
public override bool CanSeek => _baseStream.CanSeek;
public override bool CanWrite => _baseStream.CanWrite;
public override long Length => _baseStream.Length;
public override long Position
{
get => _baseStream.Position;
set => _baseStream.Position = value;
}
private void TrackBandwidth(long value)
{
const int bucketMask = TotalBuckets - 1;
var bucketIdx = CurBucketIdx();
// Increment to bucket idx, clearing along the way.
if (bucketIdx != _bucketIndex)
{
var diff = bucketIdx - _bucketIndex;
if (diff > TotalBuckets)
for (var i = _bucketIndex; i < bucketIdx; i++)
_buckets[i & bucketMask] = 0;
else
// We managed to skip so much time the whole buffer is empty.
Array.Clear(_buckets);
_bucketIndex = bucketIdx;
}
// Write value.
_buckets[bucketIdx & bucketMask] += value;
}
private long CurBucketIdx()
{
var elapsed = _stopwatch.Elapsed.TotalSeconds;
return (long)(elapsed / BucketsPerSecond);
}
public long CalcCurrentAvg()
{
var sum = 0L;
for (var i = 0; i < TotalBuckets; i++) sum += _buckets[i];
return sum >> BucketDivisor;
}
public override void Flush()
{
_baseStream.Flush();
}
public override Task FlushAsync(CancellationToken cancellationToken)
{
return _baseStream.FlushAsync(cancellationToken);
}
protected override void Dispose(bool disposing)
{
if (disposing)
_baseStream.Dispose();
}
public override ValueTask DisposeAsync()
{
return _baseStream.DisposeAsync();
}
public override int Read(byte[] buffer, int offset, int count)
{
var read = _baseStream.Read(buffer, offset, count);
TrackBandwidth(read);
return read;
}
public override async ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
{
var read = await base.ReadAsync(buffer, cancellationToken);
TrackBandwidth(read);
return read;
}
public override long Seek(long offset, SeekOrigin origin)
{
return _baseStream.Seek(offset, origin);
}
public override void SetLength(long value)
{
_baseStream.SetLength(value);
}
public override void Write(byte[] buffer, int offset, int count)
{
_baseStream.Write(buffer, offset, count);
TrackBandwidth(count);
}
public override async ValueTask WriteAsync(
ReadOnlyMemory<byte> buffer,
CancellationToken cancellationToken = default)
{
await _baseStream.WriteAsync(buffer, cancellationToken);
TrackBandwidth(buffer.Length);
}
}

View File

@@ -0,0 +1,43 @@
namespace Nebula.Shared.Utils;
public static class ContentManifestParser
{
public static List<string> ExtractModules(Stream manifestStream)
{
using var reader = new StreamReader(manifestStream);
return ExtractModules(reader.ReadToEnd());
}
public static List<string> ExtractModules(string manifestContent)
{
var modules = new List<string>();
var lines = manifestContent.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
bool inModulesSection = false;
foreach (var rawLine in lines)
{
var line = rawLine.Trim();
if (line.StartsWith("modules:"))
{
inModulesSection = true;
continue;
}
if (inModulesSection)
{
if (line.StartsWith("- "))
{
modules.Add(line.Substring(2).Trim());
}
else if (!line.StartsWith(" "))
{
break;
}
}
}
return modules;
}
}

View File

@@ -0,0 +1,82 @@
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Unicode;
namespace Nebula.Shared.Utils;
public static class CryptographicStore
{
public static string Encrypt(object value, byte[] key)
{
using var memoryStream = new MemoryStream();
using var aes = Aes.Create();
aes.Key = key;
var iv = aes.IV;
memoryStream.Write(iv, 0, iv.Length);
var serializedData = JsonSerializer.Serialize(value);
using CryptoStream cryptoStream = new(
memoryStream,
aes.CreateEncryptor(),
CryptoStreamMode.Write);
using(StreamWriter encryptWriter = new(cryptoStream))
{
encryptWriter.WriteLine(serializedData);
}
return Convert.ToBase64String(memoryStream.ToArray());
}
public static async Task<T> Decrypt<T>(string base64EncryptedValue, byte[] key)
{
using var memoryStream = new MemoryStream(Convert.FromBase64String(base64EncryptedValue));
using var aes = Aes.Create();
var iv = new byte[aes.IV.Length];
var numBytesToRead = aes.IV.Length;
var numBytesRead = 0;
while (numBytesToRead > 0)
{
var n = memoryStream.Read(iv, numBytesRead, numBytesToRead);
if (n == 0) break;
numBytesRead += n;
numBytesToRead -= n;
}
await using CryptoStream cryptoStream = new(
memoryStream,
aes.CreateDecryptor(key, iv),
CryptoStreamMode.Read);
using StreamReader decryptReader = new(cryptoStream);
var decryptedMessage = await decryptReader.ReadToEndAsync();
return JsonSerializer.Deserialize<T>(decryptedMessage) ?? throw new InvalidOperationException();
}
public static byte[] GetKey(string input, int keySize = 256)
{
if (string.IsNullOrEmpty(input))
throw new ArgumentException("Input string cannot be null or empty.", nameof(input));
var salt = Encoding.UTF8.GetBytes(input);
using (var deriveBytes = new Rfc2898DeriveBytes(input, salt, 100_000, HashAlgorithmName.SHA256))
{
return deriveBytes.GetBytes(keySize / 8);
}
}
public static byte[] GetComputerKey(int keySize = 256)
{
var name = Environment.UserName;
if (string.IsNullOrEmpty(name))
name = "LinuxUser";
return GetKey(name, keySize);
}
}

View File

@@ -0,0 +1,19 @@
namespace Nebula.Shared.Utils;
public static class ExceptionHelper
{
public static Task<T> TryRun<T>(Func<Task<T>> func, int attempts = 3, Action<int, Exception>? attemptsCallback = null)
{
try
{
return func.Invoke();
}
catch (Exception e)
{
if (attempts <= 0) throw new("Attempts was expired! ", e);
attempts--;
attemptsCallback?.Invoke(attempts, e);
return TryRun(func, attempts);
}
}
}

View File

@@ -1,21 +1,37 @@
using System.Buffers; using System.Buffers;
using Nebula.Shared.Models;
namespace Nebula.Shared.Utils; namespace Nebula.Shared.Utils;
public static class StreamHelper public static class StreamHelper
{ {
public static async ValueTask<byte[]> ReadExactAsync(this Stream stream, int amount, CancellationToken? cancel) public static void CopyTo(this Stream input, Stream output, ILoadingHandler loadingHandler)
{
const int bufferSize = 81920;
var buffer = new byte[bufferSize];
int bytesRead;
while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, bytesRead);
loadingHandler.AppendResolvedJob(bytesRead);
}
}
public static async ValueTask<byte[]> ReadExactAsync(this Stream stream, int amount, CancellationToken cancel = default)
{ {
var data = new byte[amount]; var data = new byte[amount];
await ReadExactAsync(stream, data, cancel); await ReadExactAsync(stream, data, cancel);
return data; return data;
} }
public static async ValueTask ReadExactAsync(this Stream stream, Memory<byte> into, CancellationToken? cancel) public static async ValueTask ReadExactAsync(this Stream stream, Memory<byte> into, CancellationToken cancel = default, ILoadingHandler? loadingHandler = null)
{ {
while (into.Length > 0) while (into.Length > 0)
{ {
var read = await stream.ReadAsync(into); var read = await stream.ReadAsync(into, cancel);
loadingHandler?.AppendResolvedJob(read);
// Check EOF. // Check EOF.
if (read == 0) if (read == 0)
@@ -24,31 +40,4 @@ public static class StreamHelper
into = into[read..]; into = into[read..];
} }
} }
public static async Task CopyAmountToAsync(
this Stream stream,
Stream to,
int amount,
int bufferSize,
CancellationToken cancel)
{
var buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
while (amount > 0)
{
Memory<byte> readInto = buffer;
if (amount < readInto.Length)
readInto = readInto[..amount];
var read = await stream.ReadAsync(readInto, cancel);
if (read == 0)
throw new EndOfStreamException();
amount -= read;
readInto = readInto[..read];
await to.WriteAsync(readInto, cancel);
}
}
} }

View File

@@ -0,0 +1,393 @@
using System.IO.Compression;
using System.Text;
namespace Nebula.Shared.Utils;
public static class TarUtils
{
public static void ExtractTarGz(Stream stream, string destinationDirectory)
{
if (destinationDirectory == null) throw new ArgumentNullException(nameof(destinationDirectory));
using (var gzs = new GZipStream(stream, CompressionMode.Decompress, leaveOpen: false))
{
// GZipStream does not expose length, so just pass as streaming source
TarExtractor.ExtractTar(gzs, destinationDirectory);
}
}
}
public static class TarExtractor
{
private const int BlockSize = 512;
public static void ExtractTar(Stream tarStream, string destinationDirectory)
{
if (tarStream == null) throw new ArgumentNullException(nameof(tarStream));
if (destinationDirectory == null) throw new ArgumentNullException(nameof(destinationDirectory));
Directory.CreateDirectory(destinationDirectory);
string pendingLongName = null;
string pendingLongLink = null;
var block = new byte[BlockSize];
var zeroBlockCount = 0;
while (true)
{
var read = ReadExactly(tarStream, block, 0, BlockSize);
if (read == 0)
break;
if (IsAllZero(block))
{
zeroBlockCount++;
if (zeroBlockCount >= 2) break; // two consecutive zero blocks -> end of archive
continue;
}
zeroBlockCount = 0;
var header = TarHeader.FromBlock(block);
// validate header checksum (best-effort)
if (!header.IsValidChecksum(block))
{
// Not fatal, but warn (we're not writing warnings to console by default).
}
// Some tar implementations supply the long filename in a preceding entry whose typeflag is 'L'.
// If present, use that name for the following file.
if (header.TypeFlag == 'L') // GNU long name
{
// read content blocks with size header.Size
var size = header.Size;
var nameBytes = new byte[size];
ReadExactly(tarStream, nameBytes, 0, (int)size);
// skip padding to full 512 block
SkipPadding(tarStream, size);
pendingLongName = ReadNullTerminatedString(nameBytes);
continue;
}
if (header.TypeFlag == 'K') // GNU long linkname
{
var size = header.Size;
var linkBytes = new byte[size];
ReadExactly(tarStream, linkBytes, 0, (int)size);
SkipPadding(tarStream, size);
pendingLongLink = ReadNullTerminatedString(linkBytes);
continue;
}
// Determine final name
var entryName = !string.IsNullOrEmpty(pendingLongName) ? pendingLongName : header.GetName();
var entryLinkName = !string.IsNullOrEmpty(pendingLongLink) ? pendingLongLink : header.LinkName;
// reset pending longs after use
pendingLongName = null;
pendingLongLink = null;
// sanitize path separators and avoid absolute paths
entryName = entryName.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar)
.TrimStart(Path.DirectorySeparatorChar);
var targetPath = Path.Combine(destinationDirectory, entryName);
switch (header.TypeFlag)
{
case '0':
case '\0': // normal file
case '7': // regular file (SUSv4)
EnsureParentDirectoryExists(targetPath);
using (var outFile = File.Open(targetPath, FileMode.Create, FileAccess.Write))
{
CopyExact(tarStream, outFile, header.Size);
}
SkipPadding(tarStream, header.Size);
TrySetTimes(targetPath, header.ModTime);
break;
case '5': // directory
Directory.CreateDirectory(targetPath);
TrySetTimes(targetPath, header.ModTime);
break;
case '2': // symlink
// Creating symlinks require privileges on Windows and may fail.
// To keep things robust across platforms, write a small .symlink-info file for Windows fallback,
// and attempt real symlink creation on Unix-like platforms.
EnsureParentDirectoryExists(targetPath);
TryCreateSymlink(entryLinkName, targetPath);
break;
case '1': // hard link - we will try to create by copying if target exists; otherwise skip
var linkTargetPath = Path.Combine(destinationDirectory,
entryLinkName.Replace('/', Path.DirectorySeparatorChar));
if (File.Exists(linkTargetPath))
{
EnsureParentDirectoryExists(targetPath);
File.Copy(linkTargetPath, targetPath, true);
}
break;
case '3': // character device - skip
case '4': // block device - skip
case '6': // contiguous file - treat as regular
// To be safe, treat as file if size > 0
if (header.Size > 0)
{
EnsureParentDirectoryExists(targetPath);
using (var outFile = File.Open(targetPath, FileMode.Create, FileAccess.Write))
{
CopyExact(tarStream, outFile, header.Size);
}
SkipPadding(tarStream, header.Size);
TrySetTimes(targetPath, header.ModTime);
}
break;
default:
// Unknown type - skip the file data
if (header.Size > 0)
{
Skip(tarStream, header.Size);
SkipPadding(tarStream, header.Size);
}
break;
}
}
}
private static void TryCreateSymlink(string linkTarget, string symlinkPath)
{
try
{
// On Unix-like systems we can try to create a symlink
if (IsWindows())
{
// don't try symlinks on Windows by default - write a .symlink-info file instead
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
}
else
{
// Unix: use symlink
var dir = Path.GetDirectoryName(symlinkPath);
if (!string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir);
// Use native syscall via Mono.Posix? Not allowed. Fall back to invoking 'ln -s' is not allowed.
// Instead use System.IO.File.CreateSymbolicLink if available (net core 2.1+)
#if NETCOREAPP2_1_OR_GREATER || NET5_0_OR_GREATER
var sym = new FileInfo(symlinkPath);
sym.CreateAsSymbolicLink(linkTarget);
#else
// If unavailable, write a .symlink-info file.
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
#endif
}
}
catch
{
// Ignore failures to create symlink; write fallback info
try
{
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
}
catch
{
}
}
}
private static bool IsWindows()
{
return Path.DirectorySeparatorChar == '\\';
}
private static void TrySetTimes(string path, DateTimeOffset modTime)
{
try
{
var dt = modTime.UtcDateTime;
// convert to local to set file time sensibly
File.SetLastWriteTimeUtc(path, dt);
}
catch
{
/* best-effort */
}
}
private static void EnsureParentDirectoryExists(string path)
{
var dir = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
}
// Read exactly count bytes or throw if cannot
private static int ReadExactly(Stream s, byte[] buffer, int offset, int count)
{
var total = 0;
while (total < count)
{
var r = s.Read(buffer, offset + total, count - total);
if (r == 0) break;
total += r;
}
return total;
}
// Skip count bytes by reading and discarding
private static void Skip(Stream s, long count)
{
var tmp = new byte[8192];
var remaining = count;
while (remaining > 0)
{
var toRead = (int)Math.Min(tmp.Length, remaining);
var r = s.Read(tmp, 0, toRead);
if (r == 0) break;
remaining -= r;
}
}
private static void CopyExact(Stream source, Stream dest, long count)
{
var buf = new byte[8192];
var remaining = count;
while (remaining > 0)
{
var toRead = (int)Math.Min(buf.Length, remaining);
var r = source.Read(buf, 0, toRead);
if (r == 0) break;
dest.Write(buf, 0, r);
remaining -= r;
}
}
private static void SkipPadding(Stream s, long size)
{
var pad = (BlockSize - size % BlockSize) % BlockSize;
if (pad > 0) Skip(s, pad);
}
private static bool IsAllZero(byte[] block)
{
for (var i = 0; i < block.Length; i++)
if (block[i] != 0)
return false;
return true;
}
private static string ReadNullTerminatedString(byte[] bytes)
{
var len = 0;
while (len < bytes.Length && bytes[len] != 0) len++;
return Encoding.UTF8.GetString(bytes, 0, len);
}
private class TarHeader
{
public string Name { get; private set; }
public int Mode { get; private set; }
public int Uid { get; private set; }
public int Gid { get; private set; }
public long Size { get; private set; }
public DateTimeOffset ModTime { get; private set; }
public int Checksum { get; private set; }
public char TypeFlag { get; private set; }
public string LinkName { get; private set; }
public string Magic { get; private set; }
public string Version { get; private set; }
public string UName { get; private set; }
public string GName { get; private set; }
public string DevMajor { get; private set; }
public string DevMinor { get; private set; }
public string Prefix { get; private set; }
public static TarHeader FromBlock(byte[] block)
{
var h = new TarHeader();
h.Name = ReadString(block, 0, 100);
h.Mode = (int)ReadOctal(block, 100, 8);
h.Uid = (int)ReadOctal(block, 108, 8);
h.Gid = (int)ReadOctal(block, 116, 8);
h.Size = ReadOctal(block, 124, 12);
var mtime = ReadOctal(block, 136, 12);
h.ModTime = DateTimeOffset.FromUnixTimeSeconds(mtime);
h.Checksum = (int)ReadOctal(block, 148, 8);
h.TypeFlag = (char)block[156];
h.LinkName = ReadString(block, 157, 100);
h.Magic = ReadString(block, 257, 6);
h.Version = ReadString(block, 263, 2);
h.UName = ReadString(block, 265, 32);
h.GName = ReadString(block, 297, 32);
h.DevMajor = ReadString(block, 329, 8);
h.DevMinor = ReadString(block, 337, 8);
h.Prefix = ReadString(block, 345, 155);
return h;
}
public string GetName()
{
if (!string.IsNullOrEmpty(Prefix))
return $"{Prefix}/{Name}".Trim('/');
return Name;
}
public bool IsValidChecksum(byte[] block)
{
// compute checksum where checksum field (148..155) is spaces (0x20)
long sum = 0;
for (var i = 0; i < block.Length; i++)
if (i >= 148 && i < 156) sum += 32; // space
else sum += block[i];
// stored checksum could be octal until null
var stored = Checksum;
return Math.Abs(sum - stored) <= 1; // allow +/-1 tolerance
}
private static string ReadString(byte[] buf, int offset, int length)
{
var end = offset;
var max = offset + length;
while (end < max && buf[end] != 0) end++;
if (end == offset) return string.Empty;
return Encoding.ASCII.GetString(buf, offset, end - offset);
}
private static long ReadOctal(byte[] buf, int offset, int length)
{
// Many tars store as ASCII octal, possibly padded with nulls or spaces.
var end = offset + length;
var i = offset;
// skip leading spaces and nulls
while (i < end && (buf[i] == 0 || buf[i] == (byte)' ')) i++;
long val = 0;
var found = false;
for (; i < end; i++)
{
var b = buf[i];
if (b == 0 || b == (byte)' ') break;
if (b >= (byte)'0' && b <= (byte)'7')
{
found = true;
val = (val << 3) + (b - (byte)'0');
}
// some implementations use base-10 ascii or binary; ignore invalid chars
}
if (!found) return 0;
return val;
}
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Nebula.Shared.Configurations;
using Nebula.Shared.Services; using Nebula.Shared.Services;
namespace Nebula.UnitTest.NebulaSharedTests; namespace Nebula.UnitTest.NebulaSharedTests;

View File

@@ -0,0 +1,24 @@
using Nebula.Shared.Utils;
namespace Nebula.UnitTest.NebulaSharedTests;
[TestFixture]
[TestOf(typeof(CryptographicStore))]
public class CryptographicTest
{
[Test]
public async Task EncryptDecrypt()
{
var key = CryptographicStore.GetComputerKey();
Console.WriteLine($"Key: {Convert.ToBase64String(key)}");
var entry = new TestEncryptEntry("Hello", "World");
Console.WriteLine($"Raw data: {entry}");
var encrypt = CryptographicStore.Encrypt(entry, key);
Console.WriteLine($"Encrypted data: {encrypt}");
var decrypt = await CryptographicStore.Decrypt<TestEncryptEntry>(encrypt, key);
Console.WriteLine($"Decrypted data: {decrypt}");
Assert.That(decrypt, Is.EqualTo(entry));
}
}
public record struct TestEncryptEntry(string Key, string Value);

View File

@@ -0,0 +1,64 @@
using System.IO.Compression;
using Microsoft.Extensions.DependencyInjection;
using Nebula.Shared;
using Nebula.Shared.Services;
using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils;
namespace Nebula.UnitTest.NebulaSharedTests;
[TestFixture]
[TestOf(typeof(DotnetResolverService))]
public class TarTest : BaseSharedTest
{
private FileService _fileService = default!;
private ConfigurationService _configurationService = default!;
private readonly HttpClient _httpClient = new();
public override void BeforeServiceBuild(IServiceCollection services)
{
TestServiceHelper.InitFileServiceTest();
}
[SetUp]
public override void Setup()
{
base.Setup();
_fileService = _sharedUnit.GetService<FileService>();
_configurationService = _sharedUnit.GetService<ConfigurationService>();
}
[Test]
public async Task DownloadTarAndUnzipTest()
{
DotnetUrlHelper.RidOverrideTest = "linux-x64";
Console.WriteLine($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}...");
var url = DotnetUrlHelper.GetCurrentPlatformDotnetUrl(
_configurationService.GetConfigValue(CurrentConVar.DotnetUrl)!
);
using var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
await using var stream = await response.Content.ReadAsStreamAsync();
Directory.CreateDirectory(FileService.RootPath);
if (url.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))
{
using var zipArchive = new ZipArchive(stream);
zipArchive.ExtractToDirectory(FileService.RootPath, true);
}
else if (url.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase)
|| url.EndsWith(".tgz", StringComparison.OrdinalIgnoreCase))
{
TarUtils.ExtractTarGz(stream, FileService.RootPath);
}
else
{
throw new NotSupportedException("Unsupported archive format.");
}
Console.WriteLine("Downloading dotnet complete.");
}
}

View File

@@ -1,4 +1,5 @@
using Avalonia; using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
@@ -13,8 +14,6 @@ public partial class App : Application
public override void OnFrameworkInitializationCompleted() public override void OnFrameworkInitializationCompleted()
{ {
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{ {
desktop.MainWindow = new MainWindow(); desktop.MainWindow = new MainWindow();

View File

@@ -13,9 +13,11 @@ namespace Nebula.UpdateResolver;
public static class DotnetStandalone public static class DotnetStandalone
{ {
private static readonly HttpClient HttpClient = new HttpClient(); private static readonly HttpClient HttpClient = new();
private static readonly string FullPath =
Path.Join(MainWindow.RootPath, "dotnet", DotnetUrlHelper.GetRuntimeIdentifier());
private static readonly string FullPath = Path.Join(MainWindow.RootPath, "dotnet", DotnetUrlHelper.GetRuntimeIdentifier());
private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension()); private static readonly string ExecutePath = Path.Join(FullPath, "dotnet" + DotnetUrlHelper.GetExtension());
public static async Task<Process?> Run(string dllPath) public static async Task<Process?> Run(string dllPath)
@@ -34,21 +36,42 @@ public static class DotnetStandalone
}); });
} }
private static async Task EnsureDotnet(){ private static async Task EnsureDotnet()
{
if (!Directory.Exists(FullPath)) if (!Directory.Exists(FullPath))
await Download(); await Download();
} }
private static async Task Download(){ private static async Task Download()
{
LogStandalone.Log($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}..."); LogStandalone.Log($"Downloading dotnet {DotnetUrlHelper.GetRuntimeIdentifier()}...");
var ridExt =
DotnetUrlHelper.GetCurrentPlatformDotnetUrl(ConfigurationStandalone.GetConfigValue(UpdateConVars.DotnetUrl)!); var url = DotnetUrlHelper.GetCurrentPlatformDotnetUrl(
using var response = await HttpClient.GetAsync(ridExt); ConfigurationStandalone.GetConfigValue(UpdateConVars.DotnetUrl)!
using var zipArchive = new ZipArchive(await response.Content.ReadAsStreamAsync()); );
using var response = await HttpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
await using var stream = await response.Content.ReadAsStreamAsync();
Directory.CreateDirectory(FullPath); Directory.CreateDirectory(FullPath);
zipArchive.ExtractToDirectory(FullPath);
LogStandalone.Log($"Downloading dotnet complete."); if (url.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))
{
using var zipArchive = new ZipArchive(stream);
zipArchive.ExtractToDirectory(FullPath, true);
}
else if (url.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase)
|| url.EndsWith(".tgz", StringComparison.OrdinalIgnoreCase))
{
TarUtils.ExtractTarGz(stream, FullPath);
}
else
{
throw new NotSupportedException("Unsupported archive format.");
}
LogStandalone.Log("Downloading dotnet complete.");
} }
} }
@@ -62,12 +85,9 @@ public static class DotnetUrlHelper
public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl) public static string GetCurrentPlatformDotnetUrl(Dictionary<string, string> dotnetUrl)
{ {
string? rid = GetRuntimeIdentifier(); var rid = GetRuntimeIdentifier();
if (dotnetUrl.TryGetValue(rid, out var url)) if (dotnetUrl.TryGetValue(rid, out var url)) return url;
{
return url;
}
throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}"); throw new PlatformNotSupportedException($"No download URL available for the current platform: {rid}");
} }
@@ -75,14 +95,9 @@ public static class DotnetUrlHelper
public static string GetRuntimeIdentifier() public static string GetRuntimeIdentifier()
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.Is64BitProcess ? "win-x64" : "win-x86"; return Environment.Is64BitProcess ? "win-x64" : "win-x86";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return "linux-x64";
{
return "linux-x64";
}
throw new PlatformNotSupportedException("Unsupported operating system"); throw new PlatformNotSupportedException("Unsupported operating system");
} }

View File

@@ -36,7 +36,11 @@ public partial class MainWindow : Window
Console.WriteLine(messageOut); Console.WriteLine(messageOut);
LogStr += messageOut + "\n"; LogStr += messageOut + "\n";
}; };
Start(); LogStandalone.Log("Starting up");
if (!Design.IsDesignMode)
_ = Start();
else
LogStandalone.Log("Debug information", 51);
} }
private async Task Start() private async Task Start()

View File

@@ -0,0 +1,395 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
namespace Nebula.UpdateResolver;
public static class TarUtils
{
public static void ExtractTarGz(Stream stream, string destinationDirectory)
{
if (destinationDirectory == null) throw new ArgumentNullException(nameof(destinationDirectory));
using (var gzs = new GZipStream(stream, CompressionMode.Decompress, leaveOpen: false))
{
// GZipStream does not expose length, so just pass as streaming source
TarExtractor.ExtractTar(gzs, destinationDirectory);
}
}
}
public static class TarExtractor
{
private const int BlockSize = 512;
public static void ExtractTar(Stream tarStream, string destinationDirectory)
{
if (tarStream == null) throw new ArgumentNullException(nameof(tarStream));
if (destinationDirectory == null) throw new ArgumentNullException(nameof(destinationDirectory));
Directory.CreateDirectory(destinationDirectory);
string pendingLongName = null;
string pendingLongLink = null;
var block = new byte[BlockSize];
var zeroBlockCount = 0;
while (true)
{
var read = ReadExactly(tarStream, block, 0, BlockSize);
if (read == 0)
break;
if (IsAllZero(block))
{
zeroBlockCount++;
if (zeroBlockCount >= 2) break; // two consecutive zero blocks -> end of archive
continue;
}
zeroBlockCount = 0;
var header = TarHeader.FromBlock(block);
// validate header checksum (best-effort)
if (!header.IsValidChecksum(block))
{
// Not fatal, but warn (we're not writing warnings to console by default).
}
// Some tar implementations supply the long filename in a preceding entry whose typeflag is 'L'.
// If present, use that name for the following file.
if (header.TypeFlag == 'L') // GNU long name
{
// read content blocks with size header.Size
var size = header.Size;
var nameBytes = new byte[size];
ReadExactly(tarStream, nameBytes, 0, (int)size);
// skip padding to full 512 block
SkipPadding(tarStream, size);
pendingLongName = ReadNullTerminatedString(nameBytes);
continue;
}
if (header.TypeFlag == 'K') // GNU long linkname
{
var size = header.Size;
var linkBytes = new byte[size];
ReadExactly(tarStream, linkBytes, 0, (int)size);
SkipPadding(tarStream, size);
pendingLongLink = ReadNullTerminatedString(linkBytes);
continue;
}
// Determine final name
var entryName = !string.IsNullOrEmpty(pendingLongName) ? pendingLongName : header.GetName();
var entryLinkName = !string.IsNullOrEmpty(pendingLongLink) ? pendingLongLink : header.LinkName;
// reset pending longs after use
pendingLongName = null;
pendingLongLink = null;
// sanitize path separators and avoid absolute paths
entryName = entryName.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar)
.TrimStart(Path.DirectorySeparatorChar);
var targetPath = Path.Combine(destinationDirectory, entryName);
switch (header.TypeFlag)
{
case '0':
case '\0': // normal file
case '7': // regular file (SUSv4)
EnsureParentDirectoryExists(targetPath);
using (var outFile = File.Open(targetPath, FileMode.Create, FileAccess.Write))
{
CopyExact(tarStream, outFile, header.Size);
}
SkipPadding(tarStream, header.Size);
TrySetTimes(targetPath, header.ModTime);
break;
case '5': // directory
Directory.CreateDirectory(targetPath);
TrySetTimes(targetPath, header.ModTime);
break;
case '2': // symlink
// Creating symlinks require privileges on Windows and may fail.
// To keep things robust across platforms, write a small .symlink-info file for Windows fallback,
// and attempt real symlink creation on Unix-like platforms.
EnsureParentDirectoryExists(targetPath);
TryCreateSymlink(entryLinkName, targetPath);
break;
case '1': // hard link - we will try to create by copying if target exists; otherwise skip
var linkTargetPath = Path.Combine(destinationDirectory,
entryLinkName.Replace('/', Path.DirectorySeparatorChar));
if (File.Exists(linkTargetPath))
{
EnsureParentDirectoryExists(targetPath);
File.Copy(linkTargetPath, targetPath, true);
}
break;
case '3': // character device - skip
case '4': // block device - skip
case '6': // contiguous file - treat as regular
// To be safe, treat as file if size > 0
if (header.Size > 0)
{
EnsureParentDirectoryExists(targetPath);
using (var outFile = File.Open(targetPath, FileMode.Create, FileAccess.Write))
{
CopyExact(tarStream, outFile, header.Size);
}
SkipPadding(tarStream, header.Size);
TrySetTimes(targetPath, header.ModTime);
}
break;
default:
// Unknown type - skip the file data
if (header.Size > 0)
{
Skip(tarStream, header.Size);
SkipPadding(tarStream, header.Size);
}
break;
}
}
}
private static void TryCreateSymlink(string linkTarget, string symlinkPath)
{
try
{
// On Unix-like systems we can try to create a symlink
if (IsWindows())
{
// don't try symlinks on Windows by default - write a .symlink-info file instead
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
}
else
{
// Unix: use symlink
var dir = Path.GetDirectoryName(symlinkPath);
if (!string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir);
// Use native syscall via Mono.Posix? Not allowed. Fall back to invoking 'ln -s' is not allowed.
// Instead use System.IO.File.CreateSymbolicLink if available (net core 2.1+)
#if NETCOREAPP2_1_OR_GREATER || NET5_0_OR_GREATER
var sym = new FileInfo(symlinkPath);
sym.CreateAsSymbolicLink(linkTarget);
#else
// If unavailable, write a .symlink-info file.
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
#endif
}
}
catch
{
// Ignore failures to create symlink; write fallback info
try
{
File.WriteAllText(symlinkPath + ".symlink-info", $"symlink -> {linkTarget}");
}
catch
{
}
}
}
private static bool IsWindows()
{
return Path.DirectorySeparatorChar == '\\';
}
private static void TrySetTimes(string path, DateTimeOffset modTime)
{
try
{
var dt = modTime.UtcDateTime;
// convert to local to set file time sensibly
File.SetLastWriteTimeUtc(path, dt);
}
catch
{
/* best-effort */
}
}
private static void EnsureParentDirectoryExists(string path)
{
var dir = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
}
// Read exactly count bytes or throw if cannot
private static int ReadExactly(Stream s, byte[] buffer, int offset, int count)
{
var total = 0;
while (total < count)
{
var r = s.Read(buffer, offset + total, count - total);
if (r == 0) break;
total += r;
}
return total;
}
// Skip count bytes by reading and discarding
private static void Skip(Stream s, long count)
{
var tmp = new byte[8192];
var remaining = count;
while (remaining > 0)
{
var toRead = (int)Math.Min(tmp.Length, remaining);
var r = s.Read(tmp, 0, toRead);
if (r == 0) break;
remaining -= r;
}
}
private static void CopyExact(Stream source, Stream dest, long count)
{
var buf = new byte[8192];
var remaining = count;
while (remaining > 0)
{
var toRead = (int)Math.Min(buf.Length, remaining);
var r = source.Read(buf, 0, toRead);
if (r == 0) break;
dest.Write(buf, 0, r);
remaining -= r;
}
}
private static void SkipPadding(Stream s, long size)
{
var pad = (BlockSize - size % BlockSize) % BlockSize;
if (pad > 0) Skip(s, pad);
}
private static bool IsAllZero(byte[] block)
{
for (var i = 0; i < block.Length; i++)
if (block[i] != 0)
return false;
return true;
}
private static string ReadNullTerminatedString(byte[] bytes)
{
var len = 0;
while (len < bytes.Length && bytes[len] != 0) len++;
return Encoding.UTF8.GetString(bytes, 0, len);
}
private class TarHeader
{
public string Name { get; private set; }
public int Mode { get; private set; }
public int Uid { get; private set; }
public int Gid { get; private set; }
public long Size { get; private set; }
public DateTimeOffset ModTime { get; private set; }
public int Checksum { get; private set; }
public char TypeFlag { get; private set; }
public string LinkName { get; private set; }
public string Magic { get; private set; }
public string Version { get; private set; }
public string UName { get; private set; }
public string GName { get; private set; }
public string DevMajor { get; private set; }
public string DevMinor { get; private set; }
public string Prefix { get; private set; }
public static TarHeader FromBlock(byte[] block)
{
var h = new TarHeader();
h.Name = ReadString(block, 0, 100);
h.Mode = (int)ReadOctal(block, 100, 8);
h.Uid = (int)ReadOctal(block, 108, 8);
h.Gid = (int)ReadOctal(block, 116, 8);
h.Size = ReadOctal(block, 124, 12);
var mtime = ReadOctal(block, 136, 12);
h.ModTime = DateTimeOffset.FromUnixTimeSeconds(mtime);
h.Checksum = (int)ReadOctal(block, 148, 8);
h.TypeFlag = (char)block[156];
h.LinkName = ReadString(block, 157, 100);
h.Magic = ReadString(block, 257, 6);
h.Version = ReadString(block, 263, 2);
h.UName = ReadString(block, 265, 32);
h.GName = ReadString(block, 297, 32);
h.DevMajor = ReadString(block, 329, 8);
h.DevMinor = ReadString(block, 337, 8);
h.Prefix = ReadString(block, 345, 155);
return h;
}
public string GetName()
{
if (!string.IsNullOrEmpty(Prefix))
return $"{Prefix}/{Name}".Trim('/');
return Name;
}
public bool IsValidChecksum(byte[] block)
{
// compute checksum where checksum field (148..155) is spaces (0x20)
long sum = 0;
for (var i = 0; i < block.Length; i++)
if (i >= 148 && i < 156) sum += 32; // space
else sum += block[i];
// stored checksum could be octal until null
var stored = Checksum;
return Math.Abs(sum - stored) <= 1; // allow +/-1 tolerance
}
private static string ReadString(byte[] buf, int offset, int length)
{
var end = offset;
var max = offset + length;
while (end < max && buf[end] != 0) end++;
if (end == offset) return string.Empty;
return Encoding.ASCII.GetString(buf, offset, end - offset);
}
private static long ReadOctal(byte[] buf, int offset, int length)
{
// Many tars store as ASCII octal, possibly padded with nulls or spaces.
var end = offset + length;
var i = offset;
// skip leading spaces and nulls
while (i < end && (buf[i] == 0 || buf[i] == (byte)' ')) i++;
long val = 0;
var found = false;
for (; i < end; i++)
{
var b = buf[i];
if (b == 0 || b == (byte)' ') break;
if (b >= (byte)'0' && b <= (byte)'7')
{
found = true;
val = (val << 3) + (b - (byte)'0');
}
// some implementations use base-10 ascii or binary; ignore invalid chars
}
if (!found) return 0;
return val;
}
}
}

View File

@@ -7,6 +7,7 @@
<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_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_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_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_003ACanvas_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4f22e2865cd38f71233eed2ac7f2d13f6627622f1af9ae152497e8f1625513_003FCanvas_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_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_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_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>
@@ -17,11 +18,17 @@
<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_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_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_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_003AException_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4abeb5fc1a5cb44174bd960c913c975ff24e7df9ad448896bc0a113e5b5cd_003FException_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb4f8b29071cfcf73e927671b936ba53110f1b613a1cc9bef4fc4f07dd0fbe9_003FException_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_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_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_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_003AFuncValueConverter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fe91c13e7e24d7ba324e0e6eb12a24ea8c7761299d3c4703e55c86dd120835e61_003FFuncValueConverter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFunc_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003Fab_003F4dac48f4_003FFunc_00601_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_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_003AHttpBaseStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F5c9ea82983a677ae263ed0c49dd93a5e32866ad7ae97beea733f6df197e995_003FHttpBaseStream_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_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_003AHttpCompletionOption_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffcc079c54e9940c5ac59f0141dda9ad01b4928_003F28_003Fe60e6194_003FHttpCompletionOption_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_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_003AHttpListener_002EWindows_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ffb21cfde6c1ffa9b6be622d15d56f666ad94ada7dd7d81451418d807b98f2_003FHttpListener_002EWindows_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpListener_002EWindows_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ffb21cfde6c1ffa9b6be622d15d56f666ad94ada7dd7d81451418d807b98f2_003FHttpListener_002EWindows_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_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>
@@ -32,9 +39,13 @@
<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_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_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_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_003AIGeometryContext_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F22d92db124764b1ab49745245c66f01b1e1a00_003F_005F2c742_003FIGeometryContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AImage_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2b95745d8f2ddf7b8ad6130e01c5b2782e253ff11247a9aeefcef47277b1ab_003FImage_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_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_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_003AInterop_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc4d71b51722245ae8cde97bfd996e68386928_003F3a_003F004a1338_003FInterop_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInterop_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc4d71b51722245ae8cde97bfd996e68386928_003F3a_003F004a1338_003FInterop_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIObservable_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa6b7f037ba7b44df80b8d3aa7e58eeb2e8e938_003F36_003Fae70bbb9_003FIObservable_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AItemsControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9b99b33b61e064a95d985c50edb17a9ee889e36b9ae2381866346ee68ced8bd9_003FItemsControl_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_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_003AKnownHeader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1079f3c57a31ec97cba3b6ebb3d45c5a4afcdf6fa483a4db57c3d58ea59d7a9_003FKnownHeader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AKnownHeader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1079f3c57a31ec97cba3b6ebb3d45c5a4afcdf6fa483a4db57c3d58ea59d7a9_003FKnownHeader_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_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>
@@ -43,8 +54,10 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMetrics_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb07ddb833489431aae882d295a4e94797e00_003F0f_003Fc9e3d448_003FMetrics_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMetrics_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb07ddb833489431aae882d295a4e94797e00_003F0f_003Fc9e3d448_003FMetrics_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_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_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_003ANullable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F5acc345db3c207bc9d886a36ff14867ef8d65557432172c2a42f19aeac04d1b_003FNullable_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_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_003AObservableObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3e432edeee9469b7cfdb81d6e6bd278cf57afb9e54ab75649b8bb2f52cdde69_003FObservableObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObservableObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3e432edeee9469b7cfdb81d6e6bd278cf57afb9e54ab75649b8bb2f52cdde69_003FObservableObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObsoleteAttribute_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd6ed53c3c6ac5794ce2e51aa4bcfdb5734b7f78ccfeccd5ba93ac6a0da3b2_003FObsoleteAttribute_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_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_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F36fd1a9641998bb3afbf2091e26eafa6aaafabcb494bc746c0ba7471db513143_003FParallel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AParallel_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F36fd1a9641998bb3afbf2091e26eafa6aaafabcb494bc746c0ba7471db513143_003FParallel_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_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>
@@ -52,12 +65,16 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APerfCounterCollector_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb07ddb833489431aae882d295a4e94797e00_003F4f_003F4c0b90e8_003FPerfCounterCollector_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APerfCounterCollector_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb07ddb833489431aae882d295a4e94797e00_003F4f_003F4c0b90e8_003FPerfCounterCollector_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_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_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_003ARelayCommand_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F20c0f49b8854743afaecc2f359655fdbfc6c5264f49e9eb333686e85a87bf_003FRelayCommand_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_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_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_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_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_003ASR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc4d71b51722245ae8cde97bfd996e68386928_003F4d_003F9372fe61_003FSR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc4d71b51722245ae8cde97bfd996e68386928_003F4d_003F9372fe61_003FSR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStackPanel_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc2f6475524d844411f342ebac3dc9fdcc985293c63097183568b465a768cd5_003FStackPanel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStreamGeometryContext_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F5245275d55a2287c120f7503c3e453ddeee7c693d2f85f8cde43f7c8f01ee6_003FStreamGeometryContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStreamReader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6a802af2346a87e430fb66291f320aa22871259d47c2bc928a59f14b42aa34_003FStreamReader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStreamReader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6a802af2346a87e430fb66291f320aa22871259d47c2bc928a59f14b42aa34_003FStreamReader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003FCinka_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd1287462d4ec4078c61b8e92a0952fb7de3e7e877d279e390a4c136a6365126_003FStream_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_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_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_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>
@@ -92,5 +109,8 @@
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests.WriteConVarTest&lt;/TestId&gt;&#xD; &lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests.WriteConVarTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests.WriteArrayConvarTest&lt;/TestId&gt;&#xD; &lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests.WriteArrayConvarTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests&lt;/TestId&gt;&#xD; &lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.ConfigurationServiceTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.CryptographicTest.EncryptDecrypt&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.CryptographicTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::735691F8-949C-4476-B9E4-5DF6FF8D3D0B::net9.0::Nebula.UnitTest.NebulaSharedTests.TarTest.Download&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD; &lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary> &lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>