From 8ff960189ef02480d081de2a8dd6cd0959f47dd2 Mon Sep 17 00:00:00 2001 From: achiez Date: Fri, 2 May 2025 23:29:24 +0300 Subject: [PATCH] 1.5.6 Bug fixes and code clean-ups - Update: Added "Copy Password" to Mafile context menu (if available) - Update: "Save Password" now pre-fills the current password in the "Login Again" dialog when encryption is enabled - Fix: Prevented overlapping confirmation cycles in AutoConfirmer - Fix: Added a Snackbar notification when a confirmation cycle is skipped due to a too frequent timer interval - Fix: Fixed a rare bug where the previous proxy was used instead of the current one during session refresh - Fix: Corrected "Session Permanently Expired" message showing on unrelated errors (e.g. network issues) - UI-Fix: Fixed visual glitch where proxy input appeared non-empty when switching to a mafile-specific proxy - Cleanup: Refactored and cleaned up codebase, improved styling and formatting via ReSharper --- .../EncryptedManifest.cs | 28 +- NebulaAuth.LegacyConverter/Program.cs | 15 +- NebulaAuth.LegacyConverter/SDADecryptor.cs | 61 +- NebulaAuth.sln | 1 + NebulaAuth/App.xaml | 45 +- NebulaAuth/App.xaml.cs | 13 +- NebulaAuth/AssemblyInfo.cs | 10 +- .../AnyMafilesToVisibilityConverter.cs | 2 + .../BackgroundImageVisibleConverter.cs | 4 +- .../Background/BackgroundSourceConverter.cs | 4 +- .../Converters/ColorToBrushConverter.cs | 6 +- .../PortableMaClientStatusToColorConverter.cs | 6 +- .../Converters/ReverseBooleanConverter.cs | 2 +- NebulaAuth/Converters/ValueConverterGroup.cs | 8 +- NebulaAuth/Core/DialogsController.cs | 23 +- NebulaAuth/Core/LocalizationManager.cs | 20 +- NebulaAuth/Core/SnackbarController.cs | 14 +- NebulaAuth/Core/ThemeManager.cs | 12 +- NebulaAuth/Core/TrayManager.cs | 6 +- NebulaAuth/Core/UpdateManager.cs | 15 +- NebulaAuth/FodyWeavers.xml | 2 +- NebulaAuth/MainWindow.xaml | 283 +++++-- NebulaAuth/MainWindow.xaml.cs | 40 +- .../Model/Entities/LoginConfirmationResult.cs | 4 +- NebulaAuth/Model/Entities/MaProxy.cs | 2 +- NebulaAuth/Model/Entities/Mafile.cs | 7 +- .../Model/Entities/MarketMultiConfirmation.cs | 6 +- .../Exceptions/MafileNeedReloginException.cs | 1 - .../Model/MAAC/MultiAccountAutoConfirmer.cs | 60 +- NebulaAuth/Model/MAAC/PortableMaClient.cs | 62 +- NebulaAuth/Model/MaClient.cs | 40 +- NebulaAuth/Model/NebulaSerializer.cs | 20 +- NebulaAuth/Model/PHandler.cs | 18 +- NebulaAuth/Model/ProxyStorage.cs | 8 +- NebulaAuth/Model/SessionHandler.cs | 55 +- NebulaAuth/Model/SessionHandler_API.cs | 16 +- NebulaAuth/Model/Settings.cs | 47 +- NebulaAuth/Model/Shell.cs | 16 +- NebulaAuth/Model/Storage.cs | 48 +- NebulaAuth/NLog.config | 12 +- NebulaAuth/NebulaAuth.csproj | 2 +- NebulaAuth/Theme/FontScaleWindow.cs | 144 ++-- NebulaAuth/Theme/Palette.xaml | 66 +- NebulaAuth/Theme/WindowStyle/NativeMethods.cs | 55 +- .../Theme/WindowStyle/WindowChromeHelper.cs | 14 +- .../WindowChromeRenderedBehavior.cs | 6 +- NebulaAuth/Theme/WindowStyle/WindowStyle.xaml | 40 +- .../Theme/WindowStyle/WindowStyle.xaml.cs | 8 +- NebulaAuth/Utility/ClipboardHelper.cs | 10 +- NebulaAuth/Utility/ErrorTranslatorHelper.cs | 3 - NebulaAuth/Utility/ExceptionHandler.cs | 131 +-- NebulaAuth/View/ConfirmationTemplates.xaml | 167 ++-- .../View/Dialogs/ConfirmCancelDialog.xaml | 22 +- .../View/Dialogs/ConfirmCancelDialog.xaml.cs | 2 +- NebulaAuth/View/Dialogs/LoginAgainDialog.xaml | 46 +- .../View/Dialogs/LoginAgainDialog.xaml.cs | 2 +- .../Dialogs/LoginAgainOnImportDialog.xaml | 55 +- .../Dialogs/LoginAgainOnImportDialog.xaml.cs | 2 +- .../View/Dialogs/SetCryptPasswordDialog.xaml | 36 +- .../Dialogs/SetCryptPasswordDialog.xaml.cs | 2 +- NebulaAuth/View/Dialogs/WaitLoginDialog.xaml | 30 +- .../View/Dialogs/WaitLoginDialog.xaml.cs | 4 +- NebulaAuth/View/LinkerView.xaml | 140 ++-- NebulaAuth/View/LinkerView.xaml.cs | 2 +- NebulaAuth/View/ProxyManagerView.xaml | 94 ++- NebulaAuth/View/ProxyManagerView.xaml.cs | 2 +- NebulaAuth/View/SettingsView.xaml | 85 +- NebulaAuth/View/SettingsView.xaml.cs | 2 +- NebulaAuth/View/UpdaterView.xaml | 39 +- NebulaAuth/View/UpdaterView.xaml.cs | 2 +- NebulaAuth/ViewModel/MainVM.cs | 49 +- NebulaAuth/ViewModel/MainVM_Code.cs | 18 +- NebulaAuth/ViewModel/MainVM_Confirmations.cs | 20 +- NebulaAuth/ViewModel/MainVM_File.cs | 74 +- NebulaAuth/ViewModel/MainVM_Groups.cs | 35 +- NebulaAuth/ViewModel/MainVM_MAAC.cs | 28 +- NebulaAuth/ViewModel/MainVM_Proxy.cs | 118 ++- NebulaAuth/ViewModel/Other/LinkAccountVM.cs | 261 +++--- .../ViewModel/Other/LoginAgainOnImportVM.cs | 26 +- NebulaAuth/ViewModel/Other/LoginAgainVM.cs | 14 +- NebulaAuth/ViewModel/Other/ProxyManagerVM.cs | 29 +- NebulaAuth/ViewModel/Other/SettingsVM.cs | 13 +- NebulaAuth/ViewModel/Other/UpdaterVM.cs | 2 +- NebulaAuth/localization.loc.json | 74 +- NebulaAuth/update.xml | 7 +- SteamLibForked/Account/MobileSessionData.cs | 45 +- SteamLibForked/Account/SessionData.cs | 25 +- SteamLibForked/Account/SteamAuthToken.cs | 16 +- .../Api/Mobile/SteamAuthenticatorLinkerApi.cs | 52 +- SteamLibForked/Api/Mobile/SteamMobileApi.cs | 33 +- .../Api/Mobile/SteamMobileAuthenticatorApi.cs | 22 +- .../Api/Mobile/SteamMobileConfirmationsApi.cs | 27 +- SteamLibForked/Api/SteamGlobalApi.cs | 21 +- .../Authentication/AdmissionHelper.cs | 59 +- .../Authentication/Default/LoginExecutor.cs | 66 +- .../Default/LoginExecutorOptions.cs | 3 +- .../Authentication/Default/LoginResultJson.cs | 2 +- .../Authentication/Default/LoginStage.cs | 69 +- .../Authentication/Default/RsaKeyJson.cs | 3 +- .../LoginV2/FinalizeLoginJson.cs | 18 +- .../Authentication/LoginV2/LoginV2Executor.cs | 73 +- .../LoginV2/LoginV2ExecutorOptions.cs | 8 +- .../Authentication/SessionDataValidator.cs | 21 +- .../Authentication/SteamTokenHelper.cs | 43 +- .../TransferParameters.cs | 16 +- SteamLibForked/Core/Enums/Country.cs | 749 +++++++++--------- SteamLibForked/Core/Enums/Currency.cs | 89 ++- .../Core/Enums/SteamAccessTokenType.cs | 18 +- SteamLibForked/Core/Enums/SteamDomain.cs | 5 +- SteamLibForked/Core/HealthMonitor.cs | 48 +- .../Core/Interfaces/IEmailAuthProvider.cs | 2 +- SteamLibForked/Core/Models/SteamId.cs | 53 +- .../Core/Models/SteamIds/SteamId2.cs | 62 +- .../Core/Models/SteamIds/SteamId3.cs | 65 +- .../Core/Models/SteamIds/SteamId64.cs | 74 +- .../Core/StatusCodes/SteamStatusCode.cs | 58 +- .../Core/StatusCodes/SteamStatusCode_Codes.cs | 149 +++- SteamLibForked/Core/SteamConstants.cs | 12 +- SteamLibForked/Core/SteamDomains.cs | 34 +- .../CantLoadConfirmationsException.cs | 24 +- .../General/UnsupportedResponseException.cs | 6 +- SteamLibForked/Exceptions/LoginException.cs | 12 +- .../Mobile/AuthenticatorLinkerException.cs | 11 +- .../Mobile/BadMobileCookiesException.cs | 3 +- .../Exceptions/SessionExpiredException.cs | 24 +- .../Exceptions/SessionInvalidException.cs | 17 +- .../Exceptions/SteamStatusCodeException.cs | 3 +- .../Exceptions/UnknownSteamDomainException.cs | 5 +- .../MobileSteamClient/MobileData.cs | 10 +- .../ProtoCore/Enums/EAuthSessionGuardType.cs | 2 +- .../ProtoCore/Enums/EAuthTokenPlatformType.cs | 2 +- SteamLibForked/ProtoCore/Enums/EResult.cs | 2 +- .../ProtoCore/Exceptions/EResutException.cs | 8 +- .../Exceptions/UnknownEResultException.cs | 5 +- .../ProtoCore/Interfaces/IProtoMsg.cs | 1 - SteamLibForked/ProtoCore/ProtoHelpers.cs | 2 +- .../ProtoCore/ProtoHttpClientExtension.cs | 204 ++--- SteamLibForked/ProtoCore/ProtoResponse.cs | 33 +- .../Services/AuthenticationService.cs | 67 +- .../Services/AuthenticatorLinkerService.cs | 27 +- .../ProtoCore/Services/EmptyMessage.cs | 1 - .../Models[folder]/LinkOptions.cs | 3 +- .../Models[folder]/LinkResult.cs | 5 +- .../SteamAuthenticatorLinker.cs | 23 +- .../AccountRecoveryConfirmation.cs | 3 +- .../Concrete[folder]/Confirmation.cs | 27 +- .../Concrete[folder]/MarketConfirmation.cs | 6 +- .../RegisterApiKeyConfirmation.cs | 3 +- .../Concrete[folder]/TradeConfirmation.cs | 3 +- .../Confirmations/ConfirmationType.cs | 1 - .../Details[Folder]/ConfirmationDetails.cs | 1 - .../MarketConfirmationDetails.cs | 1 - .../TradeDetailsConfirmation.cs | 1 - .../SteamMobile/SteamGuardCodeGenerator.cs | 33 +- SteamLibForked/SteamMobile/TimeAligner.cs | 11 +- SteamLibForked/Utility/EncryptionHelper.cs | 18 +- SteamLibForked/Utility/EnvironmentUtility.cs | 32 +- .../DeserializedMafileData.cs | 32 +- .../MafileSerialization/LegacyMafile.cs | 17 +- .../MafileSerialization/MafileCredits.cs | 3 +- .../MafileSerialization/MafileSerializer.cs | 50 +- .../MafileSerializerSettings.cs | 16 +- .../MafileSerializer_SessionData.cs | 20 +- .../MafileSerializer_Utility.cs | 36 +- .../MafileSerializer_Validate.cs | 17 +- .../MafileSerializer_Write.cs | 33 +- SteamLibForked/Utility/SteamIdParser.cs | 34 +- SteamLibForked/Utility/Utilities.cs | 1 + SteamLibForked/Web/ClientBuilder.cs | 8 +- .../Web/Converters/SteamIdConverters.cs | 19 +- .../StringToLongIfNeededConverter.cs | 3 +- .../Web/Models/Account/UserWalletSchema.cs | 3 +- .../Web/Models/Account/WalletSchema.cs | 24 +- .../GlobalMarketInfo/GlobalInfoModel.cs | 6 +- .../GlobalMarketInfo/MarketWalletSchema.cs | 15 +- .../Web/Models/Mobile/Confirmations.cs | 17 +- .../HTML/MarketGlobalInfoScrapper.cs | 21 +- .../JSON/MobileConfirmationScrapper.cs | 19 +- .../SteamWebApi[folder]/SteamApi_Market.cs | 5 +- changelog/1.3.4.html | 24 +- changelog/1.4.4.html | 22 +- changelog/1.4.5.html | 28 +- changelog/1.4.6.html | 44 +- changelog/1.4.9.html | 16 +- changelog/1.5.0.html | 2 +- changelog/1.5.1.html | 20 +- changelog/1.5.2.html | 32 +- changelog/1.5.3.html | 55 +- changelog/1.5.4.html | 47 +- changelog/1.5.5.html | 27 +- changelog/1.5.6.html | 91 +++ 191 files changed, 3743 insertions(+), 2767 deletions(-) create mode 100644 changelog/1.5.6.html diff --git a/NebulaAuth.LegacyConverter/EncryptedManifest.cs b/NebulaAuth.LegacyConverter/EncryptedManifest.cs index 49591b1..8a8f0c4 100644 --- a/NebulaAuth.LegacyConverter/EncryptedManifest.cs +++ b/NebulaAuth.LegacyConverter/EncryptedManifest.cs @@ -5,19 +5,16 @@ namespace NebulaAuth.LegacyConverter; + public class Manifest { - [JsonProperty("encrypted")] - public bool Encrypted { get; set; } + [JsonProperty("encrypted")] public bool Encrypted { get; set; } - [JsonProperty("first_run")] - public bool FirstRun { get; set; } + [JsonProperty("first_run")] public bool FirstRun { get; set; } - [JsonProperty("entries")] - public Entry[] Entries { get; set; } + [JsonProperty("entries")] public Entry[] Entries { get; set; } - [JsonProperty("periodic_checking")] - public bool PeriodicChecking { get; set; } + [JsonProperty("periodic_checking")] public bool PeriodicChecking { get; set; } [JsonProperty("periodic_checking_interval")] public long PeriodicCheckingInterval { get; set; } @@ -28,21 +25,16 @@ public class Manifest [JsonProperty("auto_confirm_market_transactions")] public bool AutoConfirmMarketTransactions { get; set; } - [JsonProperty("auto_confirm_trades")] - public bool AutoConfirmTrades { get; set; } + [JsonProperty("auto_confirm_trades")] public bool AutoConfirmTrades { get; set; } } public class Entry { - [JsonProperty("encryption_iv")] - public string EncryptionIv { get; set; } + [JsonProperty("encryption_iv")] public string EncryptionIv { get; set; } - [JsonProperty("encryption_salt")] - public string EncryptionSalt { get; set; } + [JsonProperty("encryption_salt")] public string EncryptionSalt { get; set; } - [JsonProperty("filename")] - public string Filename { get; set; } + [JsonProperty("filename")] public string Filename { get; set; } - [JsonProperty("steamid")] - public ulong SteamId { get; set; } + [JsonProperty("steamid")] public ulong SteamId { get; set; } } \ No newline at end of file diff --git a/NebulaAuth.LegacyConverter/Program.cs b/NebulaAuth.LegacyConverter/Program.cs index 5e72683..64f48a5 100644 --- a/NebulaAuth.LegacyConverter/Program.cs +++ b/NebulaAuth.LegacyConverter/Program.cs @@ -1,10 +1,9 @@ -using AchiesUtilities.Extensions; +using System.Reflection; +using AchiesUtilities.Extensions; using NebulaAuth.LegacyConverter; using Newtonsoft.Json; using SteamLib.Utility.MafileSerialization; - - try { var mafileSerializer = new MafileSerializer(new MafileSerializerSettings @@ -12,10 +11,10 @@ try DeserializationOptions = { AllowDeviceIdGeneration = true, - AllowSessionIdGeneration = true, + AllowSessionIdGeneration = true } }); - var currentPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + var currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (currentPath != null) Environment.CurrentDirectory = currentPath; const string toStoreFolder = "ConvertedMafiles"; @@ -108,7 +107,6 @@ try foreach (var path in args) { - if (Path.Exists(path) == false) { Console.WriteLine($"NOT VALID PATH: '{path}'"); @@ -147,15 +145,12 @@ try { Console.WriteLine("-----------------------------------------"); } - - } //Local Functions void Write(string maf, string name) { - var path = Path.Combine(toStoreFolder, name + "_legacy.mafile"); File.WriteAllText(path, maf); } @@ -172,8 +167,6 @@ try var iv = entry.EncryptionIv; var salt = entry.EncryptionSalt; return SDAEncryptor.DecryptData(password, salt, iv, cipherText); - - } } finally diff --git a/NebulaAuth.LegacyConverter/SDADecryptor.cs b/NebulaAuth.LegacyConverter/SDADecryptor.cs index fd2f402..a1989b5 100644 --- a/NebulaAuth.LegacyConverter/SDADecryptor.cs +++ b/NebulaAuth.LegacyConverter/SDADecryptor.cs @@ -1,9 +1,7 @@ -#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. -namespace NebulaAuth.LegacyConverter; +using System.Security.Cryptography; -using System; -using System.IO; -using System.Security.Cryptography; +#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. +namespace NebulaAuth.LegacyConverter; #pragma warning disable all #pragma warning disable SYSLIB0023 @@ -13,24 +11,23 @@ using System.Security.Cryptography; //Resharper disable all //Pragma is disabled because it's legacy code from SDA - - /// -/// This class provides the controls that will encrypt and decrypt the *.maFile files -/// -/// Passwords entered will be passed into 100k rounds of PBKDF2 (RFC2898) with a cryptographically random salt. -/// The generated key will then be passed into AES-256 (RijndalManaged) which will encrypt the data -/// in cypher block chaining (CBC) mode, and then write both the PBKDF2 salt and encrypted data onto the disk. +/// This class provides the controls that will encrypt and decrypt the *.maFile files +/// Passwords entered will be passed into 100k rounds of PBKDF2 (RFC2898) with a cryptographically random salt. +/// The generated key will then be passed into AES-256 (RijndalManaged) which will encrypt the data +/// in cypher block chaining (CBC) mode, and then write both the PBKDF2 salt and encrypted data onto the disk. /// public static class SDAEncryptor { - private const int PBKDF2_ITERATIONS = 50000; //Set to 50k to make program not unbearably slow. May increase in future. + private const int + PBKDF2_ITERATIONS = 50000; //Set to 50k to make program not unbearably slow. May increase in future. + private const int SALT_LENGTH = 8; private const int KEY_SIZE_BYTES = 32; private const int IV_LENGTH = 16; /// - /// Returns an 8-byte cryptographically random salt in base64 encoding + /// Returns an 8-byte cryptographically random salt in base64 encoding /// /// public static string GetRandomSalt() @@ -40,11 +37,12 @@ public static class SDAEncryptor { rng.GetBytes(salt); } + return Convert.ToBase64String(salt); } /// - /// Returns a 16-byte cryptographically random initialization vector (IV) in base64 encoding + /// Returns a 16-byte cryptographically random initialization vector (IV) in base64 encoding /// /// public static string GetInitializationVector() @@ -54,14 +52,14 @@ public static class SDAEncryptor { rng.GetBytes(IV); } + return Convert.ToBase64String(IV); } /// - /// Generates an encryption key derived using a password, a random salt, and specified number of rounds of PBKDF2 - /// - /// TODO: pass in password via SecureString? + /// Generates an encryption key derived using a password, a random salt, and specified number of rounds of PBKDF2 + /// TODO: pass in password via SecureString? /// /// /// @@ -72,19 +70,22 @@ public static class SDAEncryptor { throw new ArgumentException("Password is empty"); } + if (string.IsNullOrEmpty(salt)) { throw new ArgumentException("Salt is empty"); } - using (Rfc2898DeriveBytes pbkdf2 = new Rfc2898DeriveBytes(password, Convert.FromBase64String(salt), PBKDF2_ITERATIONS)) + + using (Rfc2898DeriveBytes pbkdf2 = + new Rfc2898DeriveBytes(password, Convert.FromBase64String(salt), PBKDF2_ITERATIONS)) { return pbkdf2.GetBytes(KEY_SIZE_BYTES); } } /// - /// Tries to decrypt and return data given an encrypted base64 encoded string. Must use the same - /// password, salt, IV, and ciphertext that was used during the original encryption of the data. + /// Tries to decrypt and return data given an encrypted base64 encoded string. Must use the same + /// password, salt, IV, and ciphertext that was used during the original encryption of the data. /// /// /// @@ -97,14 +98,17 @@ public static class SDAEncryptor { throw new ArgumentException("Password is empty"); } + if (string.IsNullOrEmpty(passwordSalt)) { throw new ArgumentException("Salt is empty"); } + if (string.IsNullOrEmpty(IV)) { throw new ArgumentException("Initialization Vector is empty"); } + if (string.IsNullOrEmpty(encryptedData)) { throw new ArgumentException("Encrypted data is empty"); @@ -143,13 +147,14 @@ public static class SDAEncryptor plaintext = null; } } + return plaintext; } /// - /// Encrypts a string given a password, salt, and initialization vector, then returns result in base64 encoded string. - /// - /// To retrieve this data, you must decrypt with the same password, salt, IV, and cyphertext that was used during encryption + /// Encrypts a string given a password, salt, and initialization vector, then returns result in base64 encoded string. + /// To retrieve this data, you must decrypt with the same password, salt, IV, and cyphertext that was used during + /// encryption /// /// /// @@ -162,18 +167,22 @@ public static class SDAEncryptor { throw new ArgumentException("Password is empty"); } + if (string.IsNullOrEmpty(passwordSalt)) { throw new ArgumentException("Salt is empty"); } + if (string.IsNullOrEmpty(IV)) { throw new ArgumentException("Initialization Vector is empty"); } + if (string.IsNullOrEmpty(plaintext)) { throw new ArgumentException("Plaintext data is empty"); } + byte[] key = GetEncryptionKey(password, passwordSalt); byte[] ciphertext; @@ -194,10 +203,12 @@ public static class SDAEncryptor { swEncypt.Write(plaintext); } + ciphertext = msEncrypt.ToArray(); } } } + return Convert.ToBase64String(ciphertext); } -} +} \ No newline at end of file diff --git a/NebulaAuth.sln b/NebulaAuth.sln index d4d148d..b2d6f6d 100644 --- a/NebulaAuth.sln +++ b/NebulaAuth.sln @@ -27,6 +27,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "changelog", "changelog", "{ changelog\1.5.3.html = changelog\1.5.3.html changelog\1.5.4.html = changelog\1.5.4.html changelog\1.5.5.html = changelog\1.5.5.html + changelog\1.5.6.html = changelog\1.5.6.html EndProjectSection EndProject Global diff --git a/NebulaAuth/App.xaml b/NebulaAuth/App.xaml index cd88f9d..ef12067 100644 --- a/NebulaAuth/App.xaml +++ b/NebulaAuth/App.xaml @@ -11,38 +11,41 @@ #1E2025 pack://application:,,,/Fonts/Roboto/#Roboto pack://application:,,,/Fonts/Roboto/#Roboto Symbols - - - - - - - - + + + + + + + + - - + + True False - + - - - - - - + + + + + + - - + + - + - + \ No newline at end of file diff --git a/NebulaAuth/App.xaml.cs b/NebulaAuth/App.xaml.cs index f80f81e..9ae9dc1 100644 --- a/NebulaAuth/App.xaml.cs +++ b/NebulaAuth/App.xaml.cs @@ -1,12 +1,11 @@ -using NebulaAuth.Core; +using System; +using System.Windows; +using NebulaAuth.Core; using NebulaAuth.Model; using NebulaAuth.Model.Exceptions; -using System; -using System.Windows; namespace NebulaAuth; - public partial class App { protected override void OnStartup(StartupEventArgs e) @@ -27,9 +26,9 @@ public partial class App msg = LocManager.Get("CantAlignTimeError"); } - MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); + MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.OK, + MessageBoxOptions.DefaultDesktopOnly); throw; - } } -} +} \ No newline at end of file diff --git a/NebulaAuth/AssemblyInfo.cs b/NebulaAuth/AssemblyInfo.cs index 8b5504e..4a05c7d 100644 --- a/NebulaAuth/AssemblyInfo.cs +++ b/NebulaAuth/AssemblyInfo.cs @@ -2,9 +2,9 @@ using System.Windows; [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) + //(used if a resource is not found in the page, + // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] \ No newline at end of file diff --git a/NebulaAuth/Converters/AnyMafilesToVisibilityConverter.cs b/NebulaAuth/Converters/AnyMafilesToVisibilityConverter.cs index 04dcf5c..0ef92fa 100644 --- a/NebulaAuth/Converters/AnyMafilesToVisibilityConverter.cs +++ b/NebulaAuth/Converters/AnyMafilesToVisibilityConverter.cs @@ -8,12 +8,14 @@ namespace NebulaAuth.Converters; public class AnyMafilesToVisibilityConverter : IValueConverter { private static bool _everAnyMafiles; + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (_everAnyMafiles) { return Visibility.Collapsed; } + if (value is 0) { return Visibility.Visible; diff --git a/NebulaAuth/Converters/Background/BackgroundImageVisibleConverter.cs b/NebulaAuth/Converters/Background/BackgroundImageVisibleConverter.cs index 3a92e03..5383db1 100644 --- a/NebulaAuth/Converters/Background/BackgroundImageVisibleConverter.cs +++ b/NebulaAuth/Converters/Background/BackgroundImageVisibleConverter.cs @@ -1,8 +1,8 @@ -using NebulaAuth.Model; -using System; +using System; using System.Globalization; using System.Windows; using System.Windows.Data; +using NebulaAuth.Model; namespace NebulaAuth.Converters.Background; diff --git a/NebulaAuth/Converters/Background/BackgroundSourceConverter.cs b/NebulaAuth/Converters/Background/BackgroundSourceConverter.cs index d4399a2..e4a5255 100644 --- a/NebulaAuth/Converters/Background/BackgroundSourceConverter.cs +++ b/NebulaAuth/Converters/Background/BackgroundSourceConverter.cs @@ -13,10 +13,10 @@ public class BackgroundSourceConverter : IValueConverter { if (value is BackgroundMode.Custom) { - if(File.Exists("Background.png")) + if (File.Exists("Background.png")) return new BitmapImage(new Uri(Path.GetFullPath("Background.png"))); } - + return new BitmapImage(new Uri("pack://application:,,,/Theme/Background.jpg")); } diff --git a/NebulaAuth/Converters/ColorToBrushConverter.cs b/NebulaAuth/Converters/ColorToBrushConverter.cs index c84794b..878ed51 100644 --- a/NebulaAuth/Converters/ColorToBrushConverter.cs +++ b/NebulaAuth/Converters/ColorToBrushConverter.cs @@ -1,7 +1,7 @@ -using System.Globalization; +using System; +using System.Globalization; using System.Windows.Data; using System.Windows.Media; -using System; namespace NebulaAuth.Converters; @@ -16,6 +16,7 @@ public class ColorToBrushConverter : IValueConverter rv.Freeze(); return rv; } + return Binding.DoNothing; } @@ -25,6 +26,7 @@ public class ColorToBrushConverter : IValueConverter { return brush.Color; } + return default(Color); } } \ No newline at end of file diff --git a/NebulaAuth/Converters/PortableMaClientStatusToColorConverter.cs b/NebulaAuth/Converters/PortableMaClientStatusToColorConverter.cs index fdd0516..6e84920 100644 --- a/NebulaAuth/Converters/PortableMaClientStatusToColorConverter.cs +++ b/NebulaAuth/Converters/PortableMaClientStatusToColorConverter.cs @@ -1,7 +1,7 @@ -using System.Globalization; +using System; +using System.Globalization; using System.Windows.Data; using System.Windows.Media; -using System; namespace NebulaAuth.Converters; @@ -13,8 +13,8 @@ public class PortableMaClientStatusToColorConverter : IValueConverter { return new SolidColorBrush(Color.FromRgb(187, 224, 139)); } - return new SolidColorBrush(Color.FromRgb(224, 139, 139)); + return new SolidColorBrush(Color.FromRgb(224, 139, 139)); } public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) diff --git a/NebulaAuth/Converters/ReverseBooleanConverter.cs b/NebulaAuth/Converters/ReverseBooleanConverter.cs index 0f40c2c..01d1c29 100644 --- a/NebulaAuth/Converters/ReverseBooleanConverter.cs +++ b/NebulaAuth/Converters/ReverseBooleanConverter.cs @@ -25,4 +25,4 @@ public class ReverseBooleanConverter : IValueConverter throw new ArgumentException("Value must be of type bool", nameof(value)); } -} +} \ No newline at end of file diff --git a/NebulaAuth/Converters/ValueConverterGroup.cs b/NebulaAuth/Converters/ValueConverterGroup.cs index ebd749f..d015ebb 100644 --- a/NebulaAuth/Converters/ValueConverterGroup.cs +++ b/NebulaAuth/Converters/ValueConverterGroup.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Windows.Data; @@ -9,12 +10,13 @@ public class ValueConverterGroup : List, IValueConverter { #region IValueConverter Members - public object? Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture) + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { - return this.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture)); + return this.Aggregate(value, + (current, converter) => converter.Convert(current, targetType, parameter, culture)); } - public object ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture) + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { throw new NotSupportedException(); } diff --git a/NebulaAuth/Core/DialogsController.cs b/NebulaAuth/Core/DialogsController.cs index f7047a7..6d41807 100644 --- a/NebulaAuth/Core/DialogsController.cs +++ b/NebulaAuth/Core/DialogsController.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using MaterialDesignThemes.Wpf; +using NebulaAuth.Model; using NebulaAuth.Model.Entities; using NebulaAuth.View; using NebulaAuth.View.Dialogs; @@ -10,12 +11,10 @@ namespace NebulaAuth.Core; public static class DialogsController { - #region CommonDialogs public static async Task ShowConfirmCancelDialog(string? msg = null) { - var content = msg == null ? new ConfirmCancelDialog() : new ConfirmCancelDialog(msg); var result = await DialogHost.Show(content); @@ -31,11 +30,13 @@ public static class DialogsController #endregion - public static async Task ShowLoginAgainDialog(string username) + public static async Task ShowLoginAgainDialog(string username, string? currentPassword = null) { var vm = new LoginAgainVM { - UserName = username + UserName = username, + Password = currentPassword ?? string.Empty, + SavePassword = PHandler.IsPasswordSet }; var content = new LoginAgainDialog { @@ -50,10 +51,11 @@ public static class DialogsController return null; } - public static async Task ShowLoginAgainOnImportDialog(Mafile mafile, IEnumerable proxies) + public static async Task ShowLoginAgainOnImportDialog(Mafile mafile, + IEnumerable proxies) { var vm = new LoginAgainOnImportVM(mafile, proxies); - var content = new LoginAgainOnImportDialog() + var content = new LoginAgainOnImportDialog { DataContext = vm }; @@ -66,7 +68,7 @@ public static class DialogsController return null; } - public static async Task ShowProxyManager(MaProxy? currentProxy) + public static async Task ShowProxyManager() { var vm = new ProxyManagerVM(); var view = new ProxyManagerView @@ -74,20 +76,21 @@ public static class DialogsController DataContext = vm }; await DialogHost.Show(view); + return vm.AnyChanges; } + public static void CloseDialog() { DialogHost.Close(null); } + public static async Task ShowLinkerDialog() { var vm = new LinkAccountVM(); - var view = new LinkerView() + var view = new LinkerView { DataContext = vm }; await DialogHost.Show(view); } - - } \ No newline at end of file diff --git a/NebulaAuth/Core/LocalizationManager.cs b/NebulaAuth/Core/LocalizationManager.cs index a111a09..fd01f0d 100644 --- a/NebulaAuth/Core/LocalizationManager.cs +++ b/NebulaAuth/Core/LocalizationManager.cs @@ -1,9 +1,9 @@ -using CodingSeb.Localization; -using CodingSeb.Localization.Loaders; -using System; +using System; using System.IO; using System.Reflection; using System.Text; +using CodingSeb.Localization; +using CodingSeb.Localization.Loaders; namespace NebulaAuth.Core; @@ -11,6 +11,7 @@ public static class LocManager { public const string CODE_BEHIND_PATH_PART = "CodeBehind"; public const string COMMON_PATH_PART = "Common"; + public static void SetApplicationLocalization(LocalizationLanguage language) { Loc.Instance.CurrentLanguage = GetLanguageCode(language); @@ -35,7 +36,6 @@ public static class LocManager } - public static void Init() { Loc.LogOutMissingTranslations = true; @@ -47,7 +47,8 @@ public static class LocManager public static void ReloadFiles() { - string exampleFileFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "localization.loc.json"); + var exampleFileFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, + "localization.loc.json"); LocalizationLoader.Instance.ClearAllTranslations(); LocalizationLoader.Instance.AddFile(exampleFileFileName); } @@ -64,14 +65,14 @@ public static class LocManager public static string? GetCommon(params string[] path) { - return GetConcat(COMMON_PATH_PART, path); + return GetConcat(COMMON_PATH_PART, path); } public static string GetCommonOrDefault(string def, params string[] path) { - return GetCommon(path) ?? def; + return GetCommon(path) ?? def; } - + public static string? Get(params string[] path) { @@ -92,9 +93,10 @@ public static class LocManager { return Get(path) ?? def; } + private static string? GetConcat(string first, string[] path) { - string[] newArray = new string[path.Length + 1]; + var newArray = new string[path.Length + 1]; newArray[0] = first; Array.Copy(path, 0, newArray, 1, path.Length); return Get(newArray); diff --git a/NebulaAuth/Core/SnackbarController.cs b/NebulaAuth/Core/SnackbarController.cs index 2d6b142..8404c7f 100644 --- a/NebulaAuth/Core/SnackbarController.cs +++ b/NebulaAuth/Core/SnackbarController.cs @@ -5,12 +5,11 @@ namespace NebulaAuth.Core; public class SnackbarController { - - public static SnackbarMessageQueue MessageQueue { get; } = new() { DiscardDuplicates = true}; private const int MIN_SNACKBAR_TIME = 1200; + public static SnackbarMessageQueue MessageQueue { get; } = new() {DiscardDuplicates = true}; + /// - /// /// /// /// Default duration is 1 second @@ -21,13 +20,13 @@ public class SnackbarController } /// - /// /// /// /// /// Default duration is 1 second /// Default: 'OK' - public static void SendSnackbarWithButton(string text, string actionText = "OK", Action? action = null, TimeSpan? duration = null) + public static void SendSnackbarWithButton(string text, string actionText = "OK", Action? action = null, + TimeSpan? duration = null) { duration ??= GetSnackbarTime(text); Action argAction; @@ -48,10 +47,9 @@ public class SnackbarController var duration = str.Length / 0.03; if (duration < MIN_SNACKBAR_TIME) { - duration = MIN_SNACKBAR_TIME; + duration = MIN_SNACKBAR_TIME; } + return TimeSpan.FromMilliseconds(duration); - } - } \ No newline at end of file diff --git a/NebulaAuth/Core/ThemeManager.cs b/NebulaAuth/Core/ThemeManager.cs index ffbe285..81b123f 100644 --- a/NebulaAuth/Core/ThemeManager.cs +++ b/NebulaAuth/Core/ThemeManager.cs @@ -1,11 +1,13 @@ -using NebulaAuth.Model; -using System; +using System; using System.ComponentModel; using System.Drawing; +using System.Drawing.Drawing2D; using System.Windows; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Shell; +using NebulaAuth.Model; using Color = System.Drawing.Color; namespace NebulaAuth.Core; @@ -14,6 +16,7 @@ public static class ThemeManager { public static System.Windows.Media.Color DefaultBackgroundColor = System.Windows.Media.Color.FromRgb(30, 32, 37); private static readonly Window MainWindow = Application.Current.MainWindow!; + static ThemeManager() { Settings.Instance.PropertyChanged += SettingsOnPropertyChanged; @@ -44,13 +47,13 @@ public static class ThemeManager var diameter = 14; var bitmap = new Bitmap(diameter, diameter); var graphics = Graphics.FromImage(bitmap); - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + graphics.SmoothingMode = SmoothingMode.AntiAlias; var brush = new SolidBrush(Color.FromArgb(c.A, c.R, c.G, c.B)); graphics.FillEllipse(brush, 0, 0, diameter, diameter); var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); - MainWindow.TaskbarItemInfo = new(); + MainWindow.TaskbarItemInfo = new TaskbarItemInfo(); MainWindow.TaskbarItemInfo.Overlay = bitmapSource; } } @@ -59,7 +62,6 @@ public static class ThemeManager { var color = Settings.Instance.BackgroundColor ?? DefaultBackgroundColor; Application.Current.Resources["WindowBackground"] = new SolidColorBrush(color); - } public static void InitializeTheme() diff --git a/NebulaAuth/Core/TrayManager.cs b/NebulaAuth/Core/TrayManager.cs index aa57e35..91724c1 100644 --- a/NebulaAuth/Core/TrayManager.cs +++ b/NebulaAuth/Core/TrayManager.cs @@ -1,9 +1,9 @@ -using NebulaAuth.Model; -using System; +using System; using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Windows; using System.Windows.Forms; +using NebulaAuth.Model; using Application = System.Windows.Application; namespace NebulaAuth.Core; @@ -29,7 +29,7 @@ public static class TrayManager var contextMenu = new ContextMenuStrip(); - contextMenu.Items.Add("Выйти", null!, onClick: OnExitClick); + contextMenu.Items.Add("Выйти", null!, OnExitClick); _notifyIcon.ContextMenuStrip = contextMenu; diff --git a/NebulaAuth/Core/UpdateManager.cs b/NebulaAuth/Core/UpdateManager.cs index d93e794..3415a49 100644 --- a/NebulaAuth/Core/UpdateManager.cs +++ b/NebulaAuth/Core/UpdateManager.cs @@ -1,24 +1,23 @@ -using AutoUpdaterDotNET; -using NebulaAuth.Model; -using System; +using System; using System.IO; - +using AutoUpdaterDotNET; +using NebulaAuth.Model; namespace NebulaAuth.Core; public static class UpdateManager { - private const string UPDATE_URL = "https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/NebulaAuth/update.xml"; + private const string UPDATE_URL = + "https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/NebulaAuth/update.xml"; + public static void CheckForUpdates() { - string jsonPath = Path.Combine(Environment.CurrentDirectory, "update-settings.json"); + var jsonPath = Path.Combine(Environment.CurrentDirectory, "update-settings.json"); AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath); AutoUpdater.ShowSkipButton = false; if (Settings.Instance.AllowAutoUpdate) AutoUpdater.UpdateMode = Mode.ForcedDownload; AutoUpdater.Start(UPDATE_URL); - - } diff --git a/NebulaAuth/FodyWeavers.xml b/NebulaAuth/FodyWeavers.xml index 4025f81..c97e85c 100644 --- a/NebulaAuth/FodyWeavers.xml +++ b/NebulaAuth/FodyWeavers.xml @@ -1,3 +1,3 @@  - + \ No newline at end of file diff --git a/NebulaAuth/MainWindow.xaml b/NebulaAuth/MainWindow.xaml index fbe2140..41e64c2 100644 --- a/NebulaAuth/MainWindow.xaml +++ b/NebulaAuth/MainWindow.xaml @@ -15,21 +15,19 @@ RenderOptions.BitmapScalingMode="HighQuality" Foreground="#FFF5F5F5" FontFamily="{md:MaterialDesignFont}" TextElement.Foreground="{DynamicResource MaterialDesignBody}" - mc:Ignorable="d" - d:DataContext="{d:DesignInstance viewModel:MainVM}" - - - > + mc:Ignorable="d" + d:DataContext="{d:DesignInstance viewModel:MainVM}"> - + - + @@ -37,39 +35,61 @@ - - - - - - + + + + + + - + - + - - - + + + - + - - + + - - + + - @@ -82,37 +102,43 @@ - + - + - + - + - - + + + @@ -126,27 +152,53 @@ - - - + + + - - + + - + - - + + - - + + @@ -162,74 +214,107 @@ - + - + - - + + - + - + - + - - - + + + - - + + - - - - + + + + - - + + - + - + - + - + - + @@ -247,7 +332,10 @@ - + @@ -257,14 +345,27 @@ - + - - - + Grid.Row="1" + Background="{DynamicResource MainBackgroundBrush}"> @@ -74,11 +73,12 @@ - + - + - + diff --git a/NebulaAuth/Theme/WindowStyle/WindowStyle.xaml.cs b/NebulaAuth/Theme/WindowStyle/WindowStyle.xaml.cs index c46e2ab..3005904 100644 --- a/NebulaAuth/Theme/WindowStyle/WindowStyle.xaml.cs +++ b/NebulaAuth/Theme/WindowStyle/WindowStyle.xaml.cs @@ -3,7 +3,7 @@ namespace NebulaAuth.Theme.WindowStyle; /// -/// Логика взаимодействия для WindowStyle.xaml +/// Логика взаимодействия для WindowStyle.xaml /// partial class WindowStyle { @@ -14,21 +14,21 @@ partial class WindowStyle private void OnCloseClick(object sender, RoutedEventArgs e) { - var window = (Window)((FrameworkElement)sender).TemplatedParent; + var window = (Window) ((FrameworkElement) sender).TemplatedParent; window.Close(); } private void OnMaximizeRestoreClick(object sender, RoutedEventArgs e) { - var window = (Window)((FrameworkElement)sender).TemplatedParent; + var window = (Window) ((FrameworkElement) sender).TemplatedParent; window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal; } private void OnMinimizeClick(object sender, RoutedEventArgs e) { - var window = (Window)((FrameworkElement)sender).TemplatedParent; + var window = (Window) ((FrameworkElement) sender).TemplatedParent; window.WindowState = WindowState.Minimized; } diff --git a/NebulaAuth/Utility/ClipboardHelper.cs b/NebulaAuth/Utility/ClipboardHelper.cs index 084fead..6235546 100644 --- a/NebulaAuth/Utility/ClipboardHelper.cs +++ b/NebulaAuth/Utility/ClipboardHelper.cs @@ -1,8 +1,8 @@ -using NebulaAuth.Core; -using NebulaAuth.Model; -using System; +using System; using System.Collections.Specialized; using System.Windows; +using NebulaAuth.Core; +using NebulaAuth.Model; namespace NebulaAuth.Utility; @@ -25,8 +25,8 @@ public class ClipboardHelper Shell.Logger.Error(ex); SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error")); } - } + i++; } @@ -50,8 +50,8 @@ public class ClipboardHelper Shell.Logger.Error(ex); SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error")); } - } + i++; } diff --git a/NebulaAuth/Utility/ErrorTranslatorHelper.cs b/NebulaAuth/Utility/ErrorTranslatorHelper.cs index b024bc6..9f39d81 100644 --- a/NebulaAuth/Utility/ErrorTranslatorHelper.cs +++ b/NebulaAuth/Utility/ErrorTranslatorHelper.cs @@ -8,7 +8,6 @@ namespace NebulaAuth.Utility; public static class ErrorTranslatorHelper { - public static string TranslateLoginError(LoginError error) { var result = GetMessage("Login", error.ToString()); @@ -20,7 +19,6 @@ public static class ErrorTranslatorHelper { var result = GetMessage("EResult", eResult.ToString()); return result ?? eResult.ToString(); - } public static string TranslateLinkerError(AuthenticatorLinkerError error) @@ -34,6 +32,5 @@ public static class ErrorTranslatorHelper var message = Loc.Tr(fullPath, "|ABSENT|"); if (message == "|ABSENT|") return null; return message; - } } \ No newline at end of file diff --git a/NebulaAuth/Utility/ExceptionHandler.cs b/NebulaAuth/Utility/ExceptionHandler.cs index e9b034f..395c462 100644 --- a/NebulaAuth/Utility/ExceptionHandler.cs +++ b/NebulaAuth/Utility/ExceptionHandler.cs @@ -1,93 +1,99 @@ -using NebulaAuth.Core; +using System; +using System.Net.Http; +using System.Threading.Tasks; +using NebulaAuth.Core; using NebulaAuth.Model; using SteamLib.Exceptions; using SteamLib.Exceptions.General; using SteamLib.ProtoCore.Exceptions; -using System; -using System.Net.Http; -using System.Threading.Tasks; namespace NebulaAuth.Utility; public static class ExceptionHandler { private const string EXCEPTION_HANDLER_LOC_PATH = "ExceptionHandler"; - public static bool Handle(Exception ex, string? prefix = null, string? postfix = null, bool handleAllExceptions = false) + + public static bool Handle(Exception ex, string? prefix = null, string? postfix = null, + bool handleAllExceptions = false) { string msg; Shell.Logger.Error(ex); switch (ex) { case SessionPermanentlyExpiredException: - { - msg = "SessionExpiredException".GetCodeBehindLocalization(); - break; - } + { + msg = "SessionExpiredException".GetCodeBehindLocalization(); + break; + } case SessionInvalidException: - { - msg = "SessionExpiredException".GetCodeBehindLocalization(); - break; - } + { + msg = "SessionExpiredException".GetCodeBehindLocalization(); + break; + } case TaskCanceledException e: - { - msg = e.InnerException is TimeoutException - ? "TimeoutException".GetCodeBehindLocalization() - : "TaskCanceledException".GetCodeBehindLocalization(); - break; - } + { + msg = e.InnerException is TimeoutException + ? "TimeoutException".GetCodeBehindLocalization() + : "TaskCanceledException".GetCodeBehindLocalization(); + break; + } case HttpRequestException e: + { + var str = "RequestError".GetCommonLocalization() + ": "; + if (e.StatusCode != null) { - var str = "RequestError".GetCommonLocalization() + ": "; - if (e.StatusCode != null) - { - msg = str + e.StatusCode; - } - else if (e.InnerException != null) - { - msg = (str + e.InnerException.Message); - } - else - { - msg = (str + e.Message); - } + msg = str + e.StatusCode; + } + else if (e.InnerException != null) + { + msg = str + e.InnerException.Message; + } + else + { + msg = str + e.Message; + } - break; - } + break; + } case UnsupportedResponseException: - { - msg = "UnsupportedResponseException".GetCodeBehindLocalization(); - break; - } + { + msg = "UnsupportedResponseException".GetCodeBehindLocalization(); + break; + } case CantLoadConfirmationsException e: + { + msg = LocManager.GetCodeBehindOrDefault(nameof(CantLoadConfirmationsException), + EXCEPTION_HANDLER_LOC_PATH, nameof(CantLoadConfirmationsException), "Common"); + if (e.Error == LoadConfirmationsError.Unknown) { - msg = LocManager.GetCodeBehindOrDefault(nameof(CantLoadConfirmationsException), EXCEPTION_HANDLER_LOC_PATH, nameof(CantLoadConfirmationsException), "Common"); - if (e.Error == LoadConfirmationsError.Unknown) - { - msg += e.ErrorMessage; - msg += ' '; - msg += e.ErrorDetails; - } - else - { - msg += LocManager.GetCodeBehindOrDefault(e.Error.ToString(), EXCEPTION_HANDLER_LOC_PATH, nameof(CantLoadConfirmationsException), e.Error.ToString()); - } - break; + msg += e.ErrorMessage; + msg += ' '; + msg += e.ErrorDetails; } + else + { + msg += LocManager.GetCodeBehindOrDefault(e.Error.ToString(), EXCEPTION_HANDLER_LOC_PATH, + nameof(CantLoadConfirmationsException), e.Error.ToString()); + } + + break; + } case EResultException e: - { - msg = "Error".GetCommonLocalization() + ": " + ErrorTranslatorHelper.TranslateEResult(e.Result); - break; - } + { + msg = "Error".GetCommonLocalization() + ": " + ErrorTranslatorHelper.TranslateEResult(e.Result); + break; + } case LoginException e: - { - msg = "LoginException".GetCodeBehindLocalization() + ": " + ErrorTranslatorHelper.TranslateLoginError(e.Error); - break; - } + { + msg = "LoginException".GetCodeBehindLocalization() + ": " + + ErrorTranslatorHelper.TranslateLoginError(e.Error); + break; + } case not null when handleAllExceptions: - { - msg = "UnknownException".GetCodeBehindLocalization() + ex.Message; - break; - } + { + msg = "UnknownException".GetCodeBehindLocalization() + ex.Message; + break; + } default: return false; } @@ -95,6 +101,7 @@ public static class ExceptionHandler SnackbarController.SendSnackbar(prefix + msg + postfix); return true; } + private static string GetCommonLocalization(this string key) { return LocManager.GetCommonOrDefault(key, key); diff --git a/NebulaAuth/View/ConfirmationTemplates.xaml b/NebulaAuth/View/ConfirmationTemplates.xaml index 60ded1c..56b2f01 100644 --- a/NebulaAuth/View/ConfirmationTemplates.xaml +++ b/NebulaAuth/View/ConfirmationTemplates.xaml @@ -9,18 +9,21 @@ - + - - - - - + + + + + - + - - - + \ No newline at end of file diff --git a/NebulaAuth/View/Dialogs/WaitLoginDialog.xaml.cs b/NebulaAuth/View/Dialogs/WaitLoginDialog.xaml.cs index 156f5f7..bc1268f 100644 --- a/NebulaAuth/View/Dialogs/WaitLoginDialog.xaml.cs +++ b/NebulaAuth/View/Dialogs/WaitLoginDialog.xaml.cs @@ -10,11 +10,12 @@ using SteamLib.Exceptions; namespace NebulaAuth.View.Dialogs; /// -/// Логика взаимодействия для WaitLoginDialog.xaml +/// Логика взаимодействия для WaitLoginDialog.xaml /// public partial class WaitLoginDialog : ICaptchaResolver { private TaskCompletionSource _tcs = new(); + public WaitLoginDialog() { InitializeComponent(); @@ -22,7 +23,6 @@ public partial class WaitLoginDialog : ICaptchaResolver public async Task Resolve(Uri imageUrl, HttpClient client) { - CaptchaGrid.Visibility = Visibility.Visible; var stream = await client.GetStreamAsync(imageUrl); return await Application.Current.Dispatcher.Invoke(async () => diff --git a/NebulaAuth/View/LinkerView.xaml b/NebulaAuth/View/LinkerView.xaml index 736df5a..970d539 100644 --- a/NebulaAuth/View/LinkerView.xaml +++ b/NebulaAuth/View/LinkerView.xaml @@ -1,11 +1,11 @@  - - - - - - - - - - - + + + + + + + + + + + - - - + + - - - + + + - + - @@ -77,72 +82,85 @@ - + - + - - + + - - + - @@ -36,14 +39,15 @@ - - + + - - - - + + + - + - + @@ -78,36 +85,41 @@ - + - - + + - - - + + + - - + - + - - - + + + - - - - - - - - - - - + + + + + + + + + - - + + - - + + - + - + - + - + - + \ No newline at end of file diff --git a/NebulaAuth/View/SettingsView.xaml.cs b/NebulaAuth/View/SettingsView.xaml.cs index baa65f3..183e3a7 100644 --- a/NebulaAuth/View/SettingsView.xaml.cs +++ b/NebulaAuth/View/SettingsView.xaml.cs @@ -1,7 +1,7 @@ namespace NebulaAuth.View; /// -/// Логика взаимодействия для SettingsView.xaml +/// Логика взаимодействия для SettingsView.xaml /// public partial class SettingsView { diff --git a/NebulaAuth/View/UpdaterView.xaml b/NebulaAuth/View/UpdaterView.xaml index 07b33c0..7340a81 100644 --- a/NebulaAuth/View/UpdaterView.xaml +++ b/NebulaAuth/View/UpdaterView.xaml @@ -1,11 +1,11 @@  - - - - - + + + + + - + - - - - - - + + + + + + -
-
Version 1.3.4
-
2024-02-01
-
- - First release
+ +
+
Version 1.3.4
+
2024-02-01
+
+ - First release
+
-
- + \ No newline at end of file diff --git a/changelog/1.4.4.html b/changelog/1.4.4.html index cd565c5..37e32e4 100644 --- a/changelog/1.4.4.html +++ b/changelog/1.4.4.html @@ -1,10 +1,10 @@ - - -Changelog - + + + +
+ +
+
Version 1.5.6
+
02.05.2025
+
+
    +
  • + NEWS: Official Telegram group now available! Join us at + + t.me/nebulaauth + +
  • +
  • UPDATE: Added "Copy Password" to Mafile context menu (if available)
  • +
  • UPDATE: "Save Password to Mafile" is now checked and the current password (if available) is automatically inserted in the "Login Again" dialog when an encryption password is set
  • +
  • FIX: Fixed a rare bug where the previous proxy was used instead of the current one during session refresh
  • +
  • FIX: Prevented overlapping confirmation cycles in AutoConfirmer. Added a user notification when confirmation is skipped due to too frequent timer interval
  • +
  • FIX: Fixed an issue where the "Session Permanently Expired" message was shown on any error, even if the error was related to connection or other issues
  • +
  • UI-FIX: Fixed a misleading non-empty proxy input when switching to a mafile-specific proxy (with red indicator); it was a visual glitch
  • +
+
+
+
+ + + \ No newline at end of file