From 19639a6df79f29e33d33811dd98af1db70da1c77 Mon Sep 17 00:00:00 2001 From: iAmAsval Date: Fri, 31 Jul 2020 11:17:24 +0200 Subject: [PATCH] better ux if no aes key is set --- FModel/Grabber/Paks/PaksGrabber.cs | 3 ++- FModel/Properties/Resources.Designer.cs | 9 +++++++++ FModel/Properties/Resources.fr-FR.resx | 5 ++++- FModel/Properties/Resources.resx | 3 +++ FModel/Properties/Resources.zh-CN.resx | 14 +++++++------- FModel/Utils/Keys.cs | 11 ++++++++--- FModel/ViewModels/MenuItem/MenuItems.cs | 8 +++++--- 7 files changed, 38 insertions(+), 15 deletions(-) diff --git a/FModel/Grabber/Paks/PaksGrabber.cs b/FModel/Grabber/Paks/PaksGrabber.cs index df443714..6d8b5c66 100644 --- a/FModel/Grabber/Paks/PaksGrabber.cs +++ b/FModel/Grabber/Paks/PaksGrabber.cs @@ -118,7 +118,8 @@ namespace FModel.Grabber.Paks MenuItems.pakFiles.Add(new PakMenuItemViewModel { Header = Properties.Resources.LoadAll, - Icon = new Image { Source = new BitmapImage(new Uri("Resources/folder-download.png", UriKind.Relative)) } + Icon = new Image { Source = new BitmapImage(new Uri("Resources/folder-download.png", UriKind.Relative)) }, + IsEnabled = false }); // Separator diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs index b2f5829a..70fe094b 100644 --- a/FModel/Properties/Resources.Designer.cs +++ b/FModel/Properties/Resources.Designer.cs @@ -1780,6 +1780,15 @@ namespace FModel.Properties { } } + /// + /// Recherche une chaîne localisée semblable à An encrypted .PAK file has been found. In order to decrypt it, please specify a working AES encryption key. + /// + public static string NoKeyWarning { + get { + return ResourceManager.GetString("NoKeyWarning", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à No Text. /// diff --git a/FModel/Properties/Resources.fr-FR.resx b/FModel/Properties/Resources.fr-FR.resx index fd9c9a7a..d3731cbf 100644 --- a/FModel/Properties/Resources.fr-FR.resx +++ b/FModel/Properties/Resources.fr-FR.resx @@ -318,7 +318,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite.Activé - Crypté + Chiffré sentence example: 200 Encrypted files @@ -825,4 +825,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite. Position / Valeur + + Un fichier .PAK chiffré a été trouvé. Afin de le déchiffrer, veuillez spécifier une clé de chiffrement AES fonctionnelle + \ No newline at end of file diff --git a/FModel/Properties/Resources.resx b/FModel/Properties/Resources.resx index 6d590378..8cc9b8cc 100644 --- a/FModel/Properties/Resources.resx +++ b/FModel/Properties/Resources.resx @@ -1078,4 +1078,7 @@ It's now the most used free software to leak on Fortnite. ..\Resources\Cpp.xshd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + An encrypted .PAK file has been found. In order to decrypt it, please specify a working AES encryption key + \ No newline at end of file diff --git a/FModel/Properties/Resources.zh-CN.resx b/FModel/Properties/Resources.zh-CN.resx index 41e19fe3..ff1e48f1 100644 --- a/FModel/Properties/Resources.zh-CN.resx +++ b/FModel/Properties/Resources.zh-CN.resx @@ -457,9 +457,6 @@ KB - - FBKP文件(*.fbkp)| *.fbkp |所有文件(*.*)| *.* - 韩语 @@ -691,9 +688,6 @@ - - 静态密钥 - {0}对您的PAK文件不起作用 @@ -787,4 +781,10 @@ 是(显示更改日志) - + + FBKP文件(*.fbkp)| *.fbkp |所有文件(*.*)| *.* + + + 静态密钥 + + \ No newline at end of file diff --git a/FModel/Utils/Keys.cs b/FModel/Utils/Keys.cs index 611b9714..0a573cd2 100644 --- a/FModel/Utils/Keys.cs +++ b/FModel/Utils/Keys.cs @@ -20,7 +20,7 @@ namespace FModel.Utils if (MenuItems.pakFiles.AtLeastOnePak()) { if (disableAll) - foreach (PakMenuItemViewModel menuItem in MenuItems.pakFiles.GetMenuItemWithPakFiles()) + foreach (PakMenuItemViewModel menuItem in MenuItems.pakFiles.GetMenuItemsWithPakFiles()) menuItem.IsEnabled = false; else { @@ -40,7 +40,7 @@ namespace FModel.Utils bool mainError = false; // used to avoid notifications about all static paks not working with the key StatusBarVm.statusBarViewModel.Reset(); - foreach (PakMenuItemViewModel menuItem in MenuItems.pakFiles.GetMenuItemWithPakFiles()) + foreach (PakMenuItemViewModel menuItem in MenuItems.pakFiles.GetMenuItemsWithPakFiles()) { // reset everyone menuItem.PakFile.AesKey = null; @@ -61,8 +61,11 @@ namespace FModel.Utils { mainError = true; StatusBarVm.statusBarViewModel.Set(e.Message, Properties.Resources.Error); - FConsole.AppendText(string.Format(Properties.Resources.StaticKeyNotWorking, $"0x{sKey}"), FColors.Red, true); DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[AES]", $"0x{sKey} is NOT!!!! working with user's pak files"); + if (string.IsNullOrEmpty(sKey)) + FConsole.AppendText(Properties.Resources.NoKeyWarning, FColors.Red, true); + else + FConsole.AppendText(string.Format(Properties.Resources.StaticKeyNotWorking, $"0x{sKey}"), FColors.Red, true); } } } @@ -87,6 +90,8 @@ namespace FModel.Utils menuItem.IsEnabled = menuItem.PakFile.AesKey != null || !menuItem.PakFile.Info.bEncryptedIndex; } + + MenuItems.pakFiles[1].IsEnabled = MenuItems.pakFiles.AtLeastOnePakWithKey(); } } } diff --git a/FModel/ViewModels/MenuItem/MenuItems.cs b/FModel/ViewModels/MenuItem/MenuItems.cs index 5a358a18..5ec414d5 100644 --- a/FModel/ViewModels/MenuItem/MenuItems.cs +++ b/FModel/ViewModels/MenuItem/MenuItems.cs @@ -105,12 +105,14 @@ namespace FModel.ViewModels.MenuItem // comment methods you don't use, thx public static bool AtLeastOnePak(this ObservableCollection o) => Application.Current.Dispatcher.Invoke(() => o.Any(x => !x.GetType().Equals(typeof(Separator)) && x.PakFile != null)); - public static IEnumerable GetMenuItemWithPakFiles(this ObservableCollection o) => + public static bool AtLeastOnePakWithKey(this ObservableCollection o) => + Application.Current.Dispatcher.Invoke(() => o.Any(x => !x.GetType().Equals(typeof(Separator)) && x.PakFile != null && (x.PakFile.AesKey != null || !x.PakFile.Info.bEncryptedIndex))); + public static IEnumerable GetMenuItemsWithPakFiles(this ObservableCollection o) => Application.Current.Dispatcher.Invoke(() => o.Where(x => !x.GetType().Equals(typeof(Separator)) && x.PakFile != null).Select(x => (PakMenuItemViewModel)x)); public static int GetPakCount(this ObservableCollection o) => - Application.Current.Dispatcher.Invoke(() => o.GetMenuItemWithPakFiles().Count()); + Application.Current.Dispatcher.Invoke(() => o.GetMenuItemsWithPakFiles().Count()); public static IEnumerable GetPakFileReaders(this ObservableCollection o) => - Application.Current.Dispatcher.Invoke(() => o.GetMenuItemWithPakFiles().Select(x => x.PakFile)); + Application.Current.Dispatcher.Invoke(() => o.GetMenuItemsWithPakFiles().Select(x => x.PakFile)); public static IEnumerable GetDynamicPakFileReaders(this ObservableCollection o) => Application.Current.Dispatcher.Invoke(() => o.GetPakFileReaders().Where(x => x.Info.bEncryptedIndex && !x.Info.EncryptionKeyGuid.Equals(new FGuid(0u, 0u, 0u, 0u)))); }