diff --git a/src/NebulaAuth.LegacyConverter/Program.cs b/src/NebulaAuth.LegacyConverter/Program.cs
index 64f48a5..5bd88be 100644
--- a/src/NebulaAuth.LegacyConverter/Program.cs
+++ b/src/NebulaAuth.LegacyConverter/Program.cs
@@ -1,8 +1,8 @@
-using System.Reflection;
-using AchiesUtilities.Extensions;
+using AchiesUtilities.Extensions;
using NebulaAuth.LegacyConverter;
using Newtonsoft.Json;
using SteamLib.Utility.MafileSerialization;
+using System.Reflection;
try
{
diff --git a/src/NebulaAuth/App.xaml b/src/NebulaAuth/App.xaml
index f33b575..f8140d2 100644
--- a/src/NebulaAuth/App.xaml
+++ b/src/NebulaAuth/App.xaml
@@ -33,6 +33,7 @@
+
diff --git a/src/NebulaAuth/App.xaml.cs b/src/NebulaAuth/App.xaml.cs
index 53c3e81..d91f119 100644
--- a/src/NebulaAuth/App.xaml.cs
+++ b/src/NebulaAuth/App.xaml.cs
@@ -1,8 +1,5 @@
using System;
-using System.IO;
-using System.Linq;
using System.Windows;
-using AchiesUtilities.Extensions;
using NebulaAuth.Core;
using NebulaAuth.Model;
using NebulaAuth.Model.Exceptions;
@@ -21,13 +18,7 @@ public partial class App
LocManager.Init();
LocManager.SetApplicationLocalization(Settings.Instance.Language);
Shell.Initialize();
-
- var files = 0;
- if (Directory.Exists(Storage.MAFILE_F))
- files = Directory.GetFiles(Storage.MafileFolder)
- .Count(f => Path.GetExtension(f).EqualsIgnoreCase(".mafile"));
-
- var threads = files > 0 ? files / 100 + 1 : 1;
+ var threads = Environment.ProcessorCount > 0 ? Environment.ProcessorCount : 1;
await Storage.Initialize(threads);
var mainWindow = new MainWindow();
Current.MainWindow = mainWindow;
diff --git a/src/NebulaAuth/Theme/Controls/CodeProgressBar.cs b/src/NebulaAuth/Components/CodeProgressBar.cs
similarity index 97%
rename from src/NebulaAuth/Theme/Controls/CodeProgressBar.cs
rename to src/NebulaAuth/Components/CodeProgressBar.cs
index 4f55936..8171e7b 100644
--- a/src/NebulaAuth/Theme/Controls/CodeProgressBar.cs
+++ b/src/NebulaAuth/Components/CodeProgressBar.cs
@@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
-namespace NebulaAuth.Theme.Controls;
+namespace NebulaAuth;
public class CodeProgressBar : ProgressBar
{
diff --git a/src/NebulaAuth/Components/HintBox.xaml b/src/NebulaAuth/Components/HintBox.xaml
new file mode 100644
index 0000000..fdf57e9
--- /dev/null
+++ b/src/NebulaAuth/Components/HintBox.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/NebulaAuth/Components/HintBox.xaml.cs b/src/NebulaAuth/Components/HintBox.xaml.cs
new file mode 100644
index 0000000..38d84d1
--- /dev/null
+++ b/src/NebulaAuth/Components/HintBox.xaml.cs
@@ -0,0 +1,98 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using CommunityToolkit.Mvvm.Input;
+using MaterialDesignThemes.Wpf;
+
+namespace NebulaAuth;
+
+public partial class HintBox : UserControl
+{
+ public static readonly DependencyProperty TextProperty =
+ DependencyProperty.Register(nameof(Text), typeof(string), typeof(HintBox));
+
+ public static readonly DependencyProperty SeverityProperty =
+ DependencyProperty.Register(nameof(Severity), typeof(HintBoxSeverity), typeof(HintBox),
+ new PropertyMetadata(HintBoxSeverity.Info, OnSeverityChanged));
+
+ public static readonly DependencyProperty ShowCloseButtonProperty =
+ DependencyProperty.Register(nameof(ShowCloseButton), typeof(bool), typeof(HintBox),
+ new PropertyMetadata(false));
+
+
+ public static readonly DependencyProperty CloseCommandProperty =
+ DependencyProperty.Register(nameof(CloseCommand), typeof(ICommand), typeof(HintBox),
+ new PropertyMetadata(null));
+
+ public string Text
+ {
+ get => (string) GetValue(TextProperty);
+ set => SetValue(TextProperty, value);
+ }
+
+ public HintBoxSeverity Severity
+ {
+ get => (HintBoxSeverity) GetValue(SeverityProperty);
+ set => SetValue(SeverityProperty, value);
+ }
+
+ public ICommand CloseCommand
+ {
+ get => (ICommand) GetValue(CloseCommandProperty) ?? InternalCloseCommand;
+ set => SetValue(CloseCommandProperty, value);
+ }
+
+ public bool ShowCloseButton
+ {
+ get => (bool) GetValue(ShowCloseButtonProperty);
+ set => SetValue(ShowCloseButtonProperty, value);
+ }
+
+ private ICommand InternalCloseCommand { get; }
+
+ public PackIconKind IconKind { get; private set; }
+ public Brush IconBrush { get; private set; }
+
+ public HintBox()
+ {
+ InitializeComponent();
+ ApplySeverityVisuals();
+
+ InternalCloseCommand = new RelayCommand(Close);
+ }
+
+ public event RoutedEventHandler Closed;
+
+ private static void OnSeverityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ((HintBox) d).ApplySeverityVisuals();
+ }
+
+ private void ApplySeverityVisuals()
+ {
+ switch (Severity)
+ {
+ case HintBoxSeverity.Error:
+ IconKind = PackIconKind.ErrorOutline;
+ IconBrush = (Brush) Application.Current.FindResource("ErrorBrush")!;
+ break;
+ default:
+ IconKind = PackIconKind.InfoCircleOutline;
+ IconBrush = (Brush) Application.Current.FindResource("InfoBrush")!;
+ break;
+ }
+ }
+
+ private void Close()
+ {
+ Visibility = Visibility.Collapsed;
+ Closed?.Invoke(this, new RoutedEventArgs());
+ }
+}
+
+public enum HintBoxSeverity
+{
+ Info,
+ Error
+}
\ No newline at end of file
diff --git a/src/NebulaAuth/Converters/Converters.xaml b/src/NebulaAuth/Converters/Converters.xaml
index 5b35f4c..eb20e3f 100644
--- a/src/NebulaAuth/Converters/Converters.xaml
+++ b/src/NebulaAuth/Converters/Converters.xaml
@@ -8,6 +8,7 @@
+
diff --git a/src/NebulaAuth/Converters/ProxyTextConverter.cs b/src/NebulaAuth/Converters/ProxyTextConverter.cs
index 2dab8f2..36aea4f 100644
--- a/src/NebulaAuth/Converters/ProxyTextConverter.cs
+++ b/src/NebulaAuth/Converters/ProxyTextConverter.cs
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
+using System.Text;
using System.Windows.Data;
using AchiesUtilities.Web.Proxy;
using NebulaAuth.Model.Entities;
@@ -33,11 +34,50 @@ public class ProxyDataTextConverter : IValueConverter
return string.Empty;
}
- return $"{p.Address}:{p.Port}";
+ return $"{p.Protocol.ToString().ToLowerInvariant()}://{p.Address}:{p.Port}";
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
+}
+
+public class ProxyDataTextMultiConverter : IMultiValueConverter
+{
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ var value = values[0] as ProxyData;
+ var displayProtocol = values.Length > 1 && values[1] is bool dp && dp;
+ var displayCredentials = values.Length > 2 && values[2] is bool dc && dc;
+ if (value == null)
+ {
+ return string.Empty;
+ }
+
+ var sb = new StringBuilder();
+ if (displayProtocol)
+ {
+ sb.Append(value.Protocol.ToString().ToLowerInvariant());
+ sb.Append("://");
+ }
+
+ sb.Append(value.Address);
+ sb.Append(':');
+ sb.Append(value.Port);
+ if (displayCredentials && value.AuthEnabled)
+ {
+ sb.Append(':');
+ sb.Append(value.Username);
+ sb.Append(':');
+ sb.Append(value.Password);
+ }
+
+ return sb.ToString();
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
}
\ No newline at end of file
diff --git a/src/NebulaAuth/MainWindow.xaml b/src/NebulaAuth/MainWindow.xaml
index 6540f4c..5bd6b88 100644
--- a/src/NebulaAuth/MainWindow.xaml
+++ b/src/NebulaAuth/MainWindow.xaml
@@ -8,7 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
xmlns:viewModel="clr-namespace:NebulaAuth.ViewModel"
- xmlns:controls="clr-namespace:NebulaAuth.Theme.Controls"
+ xmlns:nebulaAuth="clr-namespace:NebulaAuth"
WindowStartupLocation="CenterScreen"
MinHeight="500" MinWidth="500"
Title="NebulaAuth" Height="800" Width="730"
@@ -73,8 +73,7 @@
@@ -254,8 +251,11 @@
Text="{Tr MainWindow.LeftPart.NoMafiles}" />
+ SelectedValue="{Binding SelectedMafile}"
+ PreviewMouseDown="MafileListBox_OnPreviewMouseDown">