diff --git a/FModel/Forms/UpdateModeSettings.cs b/FModel/Forms/UpdateModeSettings.cs index 67c9f29d..dcc3a863 100644 --- a/FModel/Forms/UpdateModeSettings.cs +++ b/FModel/Forms/UpdateModeSettings.cs @@ -68,29 +68,29 @@ namespace FModel.Forms Properties.Settings.Default.UMOpacity = trackBar1.Value; //PARAMETERS - if (checkedListBox1.GetItemCheckState(0) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/Cosmetics/"); } - if (checkedListBox1.GetItemCheckState(1) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/CosmeticVariantTokens/"); } - if (checkedListBox1.GetItemCheckState(2) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/BannerToken/"); } - if (checkedListBox1.GetItemCheckState(3) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/ChallengeBundles/"); } - if (checkedListBox1.GetItemCheckState(4) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/Consumables/"); } - if (checkedListBox1.GetItemCheckState(5) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/Gameplay/"); } - if (checkedListBox1.GetItemCheckState(6) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/Traps/"); } - if (checkedListBox1.GetItemCheckState(7) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Athena/Items/Weapons/"); } - if (checkedListBox1.GetItemCheckState(8) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Heroes/"); } - if (checkedListBox1.GetItemCheckState(9) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Defenders/"); } - if (checkedListBox1.GetItemCheckState(10) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Workers/"); } - if (checkedListBox1.GetItemCheckState(11) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Traps/"); } - if (checkedListBox1.GetItemCheckState(12) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Weapons/"); } - if (checkedListBox1.GetItemCheckState(13) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Ingredients/"); } - if (checkedListBox1.GetItemCheckState(14) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/PersistentResources/"); } - if (checkedListBox1.GetItemCheckState(15) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/CardPacks/"); } - if (checkedListBox1.GetItemCheckState(16) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/Items/Tokens/"); } + if (checkedListBox1.GetItemCheckState(0) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/Cosmetics/"); } + if (checkedListBox1.GetItemCheckState(1) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/CosmeticVariantTokens/"); } + if (checkedListBox1.GetItemCheckState(2) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/BannerToken/"); } + if (checkedListBox1.GetItemCheckState(3) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/ChallengeBundles/"); } + if (checkedListBox1.GetItemCheckState(4) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/Consumables/"); } + if (checkedListBox1.GetItemCheckState(5) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/Gameplay/"); } + if (checkedListBox1.GetItemCheckState(6) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/Traps/"); } + if (checkedListBox1.GetItemCheckState(7) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Athena/Items/Weapons/"); } + if (checkedListBox1.GetItemCheckState(8) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Heroes/"); } + if (checkedListBox1.GetItemCheckState(9) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Defenders/"); } + if (checkedListBox1.GetItemCheckState(10) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Workers/"); } + if (checkedListBox1.GetItemCheckState(11) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Traps/"); } + if (checkedListBox1.GetItemCheckState(12) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Weapons/"); } + if (checkedListBox1.GetItemCheckState(13) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Ingredients/"); } + if (checkedListBox1.GetItemCheckState(14) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/PersistentResources/"); } + if (checkedListBox1.GetItemCheckState(15) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/CardPacks/"); } + if (checkedListBox1.GetItemCheckState(16) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/Items/Tokens/"); } - if (checkedListBox2.GetItemCheckState(0) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/2dAssets/"); } - if (checkedListBox2.GetItemCheckState(1) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/UI/Foundation/Textures/BattleRoyale/FeaturedItems/"); } - if (checkedListBox2.GetItemCheckState(2) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/UI/Foundation/Textures/Icons/"); } - if (checkedListBox2.GetItemCheckState(3) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/UI/Foundation/Textures/Banner/"); } - if (checkedListBox2.GetItemCheckState(4) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("../FortniteGame/Content/UI/Foundation/Textures/LoadingScreens/"); } + if (checkedListBox2.GetItemCheckState(0) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/2dAssets/"); } + if (checkedListBox2.GetItemCheckState(1) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/UI/Foundation/Textures/BattleRoyale/FeaturedItems/"); } + if (checkedListBox2.GetItemCheckState(2) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/UI/Foundation/Textures/Icons/"); } + if (checkedListBox2.GetItemCheckState(3) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/UI/Foundation/Textures/Banner/"); } + if (checkedListBox2.GetItemCheckState(4) == CheckState.Checked) { RegisterSettings.updateModeListParameters.Add("FortniteGame/Content/UI/Foundation/Textures/LoadingScreens/"); } //LOCRES Properties.Settings.Default.IconLanguage = comboBox1.SelectedItem.ToString(); diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 112120d6..e159da7a 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -325,8 +325,8 @@ namespace FModel { String[] linesA = File.ReadAllLines(theDialog.FileName); for (int i = 0; i < linesA.Length; i++) - if (!linesA[i].StartsWith("../")) - linesA[i] = "../" + linesA[i]; + if (linesA[i].StartsWith("../")) + linesA[i] = linesA[i].Substring(3); IEnumerable onlyB = PakHelper.PakAsTxt.Except(linesA); IEnumerable removed = linesA.Except(PakHelper.PakAsTxt); @@ -376,7 +376,6 @@ namespace FModel private void CreatePakList(ToolStripItemClickedEventArgs selectedPak = null, bool loadAllPaKs = false, bool getDiff = false, bool updateMode = false) { ThePak.AllpaksDictionary = new Dictionary(); - ThePak.PaksMountPoint = new Dictionary(); ThePak.PaksExtractorDictionary = new Dictionary(); ThePak.PaksFileArrayDictionary = new Dictionary(); RegisterSettings.updateModeDictionary = new Dictionary(); @@ -428,7 +427,7 @@ namespace FModel { TreeParsePath(treeView1.Nodes, PakHelper.PakAsTxt[i].Replace(PakHelper.PakAsTxt[i].Split('/').Last(), "")); } - Utilities.ExpandToLevel(treeView1.Nodes, 2); + Utilities.ExpandToLevel(treeView1.Nodes, 1); treeView1.EndUpdate(); })); new UpdateMyState(Settings.Default.PAKsPath, "Success").ChangeProcessState(); @@ -460,7 +459,7 @@ namespace FModel { TreeParsePath(treeView1.Nodes, PakHelper.PakAsTxt[i].Replace(PakHelper.PakAsTxt[i].Split('/').Last(), "")); } - Utilities.ExpandToLevel(treeView1.Nodes, 2); + Utilities.ExpandToLevel(treeView1.Nodes, 1); treeView1.EndUpdate(); })); @@ -493,7 +492,7 @@ namespace FModel string mountPoint = extractor.GetMountPoint(); for (int ii = 0; ii < CurrentUsedPakLines.Length; ii++) { - CurrentUsedPakLines[ii] = mountPoint.Substring(6) + CurrentUsedPakLines[ii]; + CurrentUsedPakLines[ii] = mountPoint.Substring(9) + CurrentUsedPakLines[ii]; sb.Append(CurrentUsedPakLines[ii] + "\n"); } @@ -526,7 +525,7 @@ namespace FModel string mountPoint = extractor.GetMountPoint(); for (int ii = 0; ii < CurrentUsedPakLines.Length; ii++) { - CurrentUsedPakLines[ii] = mountPoint.Substring(6) + CurrentUsedPakLines[ii]; + CurrentUsedPakLines[ii] = mountPoint.Substring(9) + CurrentUsedPakLines[ii]; sb.Append(CurrentUsedPakLines[ii] + "\n"); } @@ -990,7 +989,14 @@ namespace FModel } catch (Exception ex) { - throw new ArgumentException(ex.Message); + if (Checking.UmWorking) + { + new UpdateMyConsole(ex.Message, Color.Red, true).AppendToConsole(); + } + else + { + throw new ArgumentException(ex.Message); + } } } private void CreateItemIcon(JToken theItem, string specialMode = null) diff --git a/FModel/Methods/JohnWick/JohnWick.cs b/FModel/Methods/JohnWick/JohnWick.cs index 451225c5..aa91ec1b 100644 --- a/FModel/Methods/JohnWick/JohnWick.cs +++ b/FModel/Methods/JohnWick/JohnWick.cs @@ -12,29 +12,18 @@ namespace FModel { public static PakAsset MyAsset; - /// - /// Normal pak file: using AllpaksDictionary, it tells you the pak name depending on currentItem. Using this pak name and PaksMountPoint we get the mount point - /// - /// - /// the mount point as string, used to create subfolders when extracting or create the tree when loading all paks - private static string GetMountPointFromDict(string currentItem) - { - return ThePak.PaksMountPoint[ThePak.AllpaksDictionary[currentItem]]; - } - /// /// just the method to create subfolders using GetMountPointFromDict and write the file from myResults with its byte[] data /// - /// /// /// /// the path to this brand new created file - private static string WriteFile(string currentItem, string myResults, byte[] data) + private static string WriteFile(string myResults, byte[] data) { - Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults.Substring(0, myResults.LastIndexOf("/", StringComparison.Ordinal))); - File.WriteAllBytes(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults, data); + Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\" + myResults.Substring(0, myResults.LastIndexOf("/", StringComparison.Ordinal))); + File.WriteAllBytes(App.DefaultOutputPath + "\\Extracted\\" + myResults, data); - return App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults; + return App.DefaultOutputPath + "\\Extracted\\" + myResults; } /// @@ -68,7 +57,7 @@ namespace FModel uint y = (uint)index; byte[] b = pakExtractor.GetData(y); - AssetPath = WriteFile(currentItem, results[i], b).Replace("/", "\\"); + AssetPath = WriteFile(results[i], b).Replace("/", "\\"); } return AssetPath; diff --git a/FModel/Methods/PakHelper/PakHelper.cs b/FModel/Methods/PakHelper/PakHelper.cs index 759bc59d..29e16529 100644 --- a/FModel/Methods/PakHelper/PakHelper.cs +++ b/FModel/Methods/PakHelper/PakHelper.cs @@ -12,7 +12,6 @@ namespace FModel static class PakHelper { public static string[] PakAsTxt { get; set; } - private static PakExtractor _extractor { get; set; } private static StringBuilder _sb { get; set; } /// @@ -24,39 +23,43 @@ namespace FModel /// public static void RegisterPaKsinDict(ToolStripItemClickedEventArgs theSinglePak = null, bool loadAllPaKs = false) { - _extractor = null; _sb = new StringBuilder(); bool bMainKeyWorking = false; for (int i = 0; i < ThePak.mainPaksList.Count; i++) { + PakExtractor theExtractor = null; try { if (!string.IsNullOrWhiteSpace(Settings.Default.AESKey)) { - _extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey); + theExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey); } - else { if (_extractor != null) { _extractor.Dispose(); } break; } + else { if (theExtractor != null) { theExtractor.Dispose(); } break; } } catch (Exception) { - if (_extractor != null) { _extractor.Dispose(); } + if (theExtractor != null) { theExtractor.Dispose(); } break; } - string[] CurrentUsedPakLines = _extractor.GetFileList().ToArray(); + string[] CurrentUsedPakLines = theExtractor.GetFileList().ToArray(); if (CurrentUsedPakLines != null) { bMainKeyWorking = true; - ThePak.PaksExtractorDictionary.Add(ThePak.mainPaksList[i].thePak, _extractor); - ThePak.PaksFileArrayDictionary.Add(_extractor, CurrentUsedPakLines); - RegisterInDict(ThePak.mainPaksList[i].thePak, CurrentUsedPakLines, theSinglePak, loadAllPaKs); + string mountPoint = theExtractor.GetMountPoint(); + + ThePak.PaksExtractorDictionary.Add(ThePak.mainPaksList[i].thePak, theExtractor); + ThePak.PaksFileArrayDictionary.Add(theExtractor, CurrentUsedPakLines); //in RegisterInDict we add the mount point to CurrentUsedPakLines + + RegisterInDict(ThePak.mainPaksList[i].thePak, CurrentUsedPakLines, mountPoint, theSinglePak, loadAllPaKs); } } if (bMainKeyWorking) { LoadLocRes.LoadMySelectedLocRes(Settings.Default.IconLanguage); } for (int i = 0; i < ThePak.dynamicPaksList.Count; i++) { + PakExtractor theExtractor = null; string pakName = DynamicKeysManager.AESEntries.Where(x => x.thePak == ThePak.dynamicPaksList[i].thePak).Select(x => x.thePak).FirstOrDefault(); string pakKey = DynamicKeysManager.AESEntries.Where(x => x.thePak == ThePak.dynamicPaksList[i].thePak).Select(x => x.theKey).FirstOrDefault(); @@ -64,21 +67,24 @@ namespace FModel { try { - _extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + pakName, pakKey); + theExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + pakName, pakKey); } catch (Exception) { new UpdateMyConsole("0x" + pakKey + " doesn't work with " + ThePak.dynamicPaksList[i].thePak, Color.Red, true).AppendToConsole(); - if (_extractor != null) { _extractor.Dispose(); } + if (theExtractor != null) { theExtractor.Dispose(); } continue; } - string[] CurrentUsedPakLines = _extractor.GetFileList().ToArray(); + string[] CurrentUsedPakLines = theExtractor.GetFileList().ToArray(); if (CurrentUsedPakLines != null) { - ThePak.PaksExtractorDictionary.Add(ThePak.dynamicPaksList[i].thePak, _extractor); - ThePak.PaksFileArrayDictionary.Add(_extractor, CurrentUsedPakLines); - RegisterInDict(ThePak.dynamicPaksList[i].thePak, CurrentUsedPakLines, theSinglePak, loadAllPaKs); + string mountPoint = theExtractor.GetMountPoint(); + + ThePak.PaksExtractorDictionary.Add(ThePak.dynamicPaksList[i].thePak, theExtractor); + ThePak.PaksFileArrayDictionary.Add(theExtractor, CurrentUsedPakLines); //in RegisterInDict we add the mount point to CurrentUsedPakLines + + RegisterInDict(ThePak.dynamicPaksList[i].thePak, CurrentUsedPakLines, mountPoint, theSinglePak, loadAllPaKs); } } } @@ -99,14 +105,11 @@ namespace FModel /// /// /// - private static void RegisterInDict(string thePakName, string[] thePakLines, ToolStripItemClickedEventArgs theSinglePak = null, bool weLoadAll = false) + private static void RegisterInDict(string thePakName, string[] thePakLines, string mountPoint, ToolStripItemClickedEventArgs theSinglePak = null, bool weLoadAll = false) { - string mountPoint = _extractor.GetMountPoint(); - ThePak.PaksMountPoint.Add(thePakName, mountPoint.Substring(9)); - for (int i = 0; i < thePakLines.Length; i++) { - thePakLines[i] = mountPoint.Substring(6) + thePakLines[i]; + thePakLines[i] = mountPoint.Substring(9) + thePakLines[i]; string CurrentUsedPakFileName = thePakLines[i].Substring(thePakLines[i].LastIndexOf("/", StringComparison.Ordinal) + 1); if (CurrentUsedPakFileName.Contains(".uasset") || CurrentUsedPakFileName.Contains(".uexp") || CurrentUsedPakFileName.Contains(".ubulk")) diff --git a/FModel/Methods/VarApp.cs b/FModel/Methods/VarApp.cs index eaef3e5b..f6624b95 100644 --- a/FModel/Methods/VarApp.cs +++ b/FModel/Methods/VarApp.cs @@ -52,7 +52,6 @@ namespace FModel public static Dictionary AllpaksDictionary { get; set; } public static Dictionary PaksExtractorDictionary { get; set; } public static Dictionary PaksFileArrayDictionary { get; set; } - public static Dictionary PaksMountPoint { get; set; } /// /// read the GUID of a the param, it's basically just reading some bytes at the end of a pak file, but it's useful to tell if the pak is dynamically encrypted