diff --git a/NebulaAuth/MainWindow.xaml b/NebulaAuth/MainWindow.xaml index fac5855..fbe2140 100644 --- a/NebulaAuth/MainWindow.xaml +++ b/NebulaAuth/MainWindow.xaml @@ -201,6 +201,7 @@ + diff --git a/NebulaAuth/Model/Exceptions/MafileNeedReloginException.cs b/NebulaAuth/Model/Exceptions/MafileNeedReloginException.cs new file mode 100644 index 0000000..dbc7004 --- /dev/null +++ b/NebulaAuth/Model/Exceptions/MafileNeedReloginException.cs @@ -0,0 +1,15 @@ +using System; +using NebulaAuth.Model.Entities; +using SteamLib; + +namespace NebulaAuth.Model.Exceptions; + +public class MafileNeedReloginException : Exception +{ + public Mafile Mafile { get; } + + public MafileNeedReloginException(Mafile mafile) + { + Mafile = mafile; + } +} \ No newline at end of file diff --git a/NebulaAuth/Model/NebulaSerializer.cs b/NebulaAuth/Model/NebulaSerializer.cs index 4b9835e..8a28f23 100644 --- a/NebulaAuth/Model/NebulaSerializer.cs +++ b/NebulaAuth/Model/NebulaSerializer.cs @@ -4,6 +4,7 @@ using SteamLib; using SteamLib.Utility.MafileSerialization; using System.Collections.Generic; using System; +using NebulaAuth.Model.Exceptions; using Newtonsoft.Json; namespace NebulaAuth.Model; @@ -20,7 +21,7 @@ public static class NebulaSerializer { AllowDeviceIdGeneration = true, AllowSessionIdGeneration = true, - ThrowIfInvalidSteamId = true + ThrowIfInvalidSteamId = false } }); } @@ -33,13 +34,19 @@ public static class NebulaSerializer var info = data.Info; if (info.IsExtended == false) throw new FormatException("Mafile is not extended data"); - + var props = info.UnusedProperties ?? new Dictionary(); var proxy = GetPropertyValue("Proxy", props); var group = GetPropertyValue("Group", props); var password = GetPropertyValue("Password", props); - return Mafile.FromMobileDataExtended((MobileDataExtended)mobileData, proxy, group, password); + var mafile = Mafile.FromMobileDataExtended((MobileDataExtended)mobileData, proxy, group, password); + + + if (!info.SteamIdValid) + throw new MafileNeedReloginException(mafile); + + return mafile; } private static T? GetPropertyValue(string name, Dictionary dictionary) diff --git a/NebulaAuth/Model/Storage.cs b/NebulaAuth/Model/Storage.cs index 574eff5..45e935a 100644 --- a/NebulaAuth/Model/Storage.cs +++ b/NebulaAuth/Model/Storage.cs @@ -8,6 +8,8 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using AchiesUtilities.Extensions; +using NebulaAuth.Model.Exceptions; +using NLog.Targets; using SteamLib; namespace NebulaAuth.Model; @@ -66,7 +68,14 @@ public static class Storage MaFiles = new ObservableCollection(MaFiles.OrderBy(m => m.AccountName)); } - + /// + /// + /// + /// + /// + /// + /// + /// public static void AddNewMafile(string path, bool overwrite) { Mafile data; @@ -74,17 +83,12 @@ public static class Storage { data = ReadMafile(path); } - catch (ArgumentException ex) - when(ex.ParamName == nameof(MobileDataExtended.SteamId)) - { - throw new SessionInvalidException(); //Allows to handle LoginOnImport - } catch (Exception ex) + when(ex is not MafileNeedReloginException) { Shell.Logger.Warn(ex, "Can't load mafile"); throw new FormatException("File data is not valid", ex); } - if (string.IsNullOrWhiteSpace(data.AccountName)) throw new FormatException("File data is not valid. Missing AccountName"); @@ -156,8 +160,8 @@ public static class Storage private static string CreatePathForMafile(Mafile data) { - var fileName = Settings.Instance.UseAccountNameAsMafileName - ? CreateFileNameWithAccountName(data.AccountName) + var fileName = Settings.Instance.UseAccountNameAsMafileName + ? CreateFileNameWithAccountName(data.AccountName) : CreateFileNameWithSteamId(data.SteamId); return Path.Combine(MafileFolder, fileName); diff --git a/NebulaAuth/NebulaAuth.csproj b/NebulaAuth/NebulaAuth.csproj index 971a2b8..e48d644 100644 --- a/NebulaAuth/NebulaAuth.csproj +++ b/NebulaAuth/NebulaAuth.csproj @@ -10,7 +10,7 @@ en;ru;ua Theme\lock.ico 7.0 - 1.5.3 + 1.5.4 true @@ -42,11 +42,6 @@ - - - - - diff --git a/NebulaAuth/PlannedChanges.txt b/NebulaAuth/PlannedChanges.txt new file mode 100644 index 0000000..bac9938 --- /dev/null +++ b/NebulaAuth/PlannedChanges.txt @@ -0,0 +1,9 @@ +• Есть люди которым нужна функция просмотра и завершения сессий аккаунта. Скорее всего в следующей версии это будет реализовано +• Сейчас, при наличии новой версии, отображается стандартное окно обновлений из библиотеки. Планируется сделать кастомный дизайн, для соответствия общему стилю. +• В приложении реализованы "совмещённые" подтверждения для торговой площадки. Т.е. при наличии более одного предмета, ожидающего подтверждение, можно либо отменить, либо подтвердить все. В планах добавить расширенный функционал, с возможностью точечного управления. +• Добавить кнопку "открыть мафайл" в меню "Файл" по аналогии с открытием папки +• Ускорить появление подсказок в интерфейсе +• Добавить запоминание пароля при привязке мафайла +• Функция переноса гуарда с мобильного устройства на ПК с созданием мафайла +• Добавить полное шифрование мафайлов по аналогии с SDA +• Сделать автоматический билд и загрузку обновления на Github при изменении в мастер ветке \ No newline at end of file diff --git a/NebulaAuth/Utility/ClipboardHelper.cs b/NebulaAuth/Utility/ClipboardHelper.cs new file mode 100644 index 0000000..084fead --- /dev/null +++ b/NebulaAuth/Utility/ClipboardHelper.cs @@ -0,0 +1,60 @@ +using NebulaAuth.Core; +using NebulaAuth.Model; +using System; +using System.Collections.Specialized; +using System.Windows; + +namespace NebulaAuth.Utility; + +public class ClipboardHelper +{ + public static bool Set(string text) + { + var i = 0; + while (i < 20) + { + try + { + Clipboard.SetText(text); + return true; + } + catch (Exception ex) + { + if (i == 19) + { + Shell.Logger.Error(ex); + SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error")); + } + + } + i++; + } + + return false; + } + + public static bool SetFiles(StringCollection files) + { + var i = 0; + while (i < 20) + { + try + { + Clipboard.SetFileDropList(files); + return true; + } + catch (Exception ex) + { + if (i == 19) + { + Shell.Logger.Error(ex); + SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error")); + } + + } + i++; + } + + return false; + } +} \ No newline at end of file diff --git a/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml b/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml index 57ae647..051a197 100644 --- a/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml +++ b/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml @@ -19,13 +19,13 @@ - + -