From db6c32e0f8a6ca1d793e6b3796e24456763b89df Mon Sep 17 00:00:00 2001 From: AsvalGTA Date: Fri, 29 Mar 2019 01:01:03 +0100 Subject: [PATCH] added string concatenation to guess DA file for CIDs --- FModel/PAKWindow.Designer.cs | 101 +++-- FModel/PAKWindow.cs | 772 ++++++++++++++++++++++++++++++++++- FModel/PAKWindow.resx | 5 +- 3 files changed, 835 insertions(+), 43 deletions(-) diff --git a/FModel/PAKWindow.Designer.cs b/FModel/PAKWindow.Designer.cs index fe571d26..19d6bc44 100644 --- a/FModel/PAKWindow.Designer.cs +++ b/FModel/PAKWindow.Designer.cs @@ -31,7 +31,6 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PAKWindow)); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.LoadButton = new FModel.SplitButton(); this.LoadContext = new System.Windows.Forms.ContextMenuStrip(this.components); this.loadAllPAKsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.backupCurrentPAKsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -47,10 +46,8 @@ this.ItemIconPictureBox = new System.Windows.Forms.PictureBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.scintilla1 = new ScintillaNET.Scintilla(); - this.OpenImageButton = new FModel.SplitButton(); this.ImageContext = new System.Windows.Forms.ContextMenuStrip(this.components); this.ImageSaveTS = new System.Windows.Forms.ToolStripMenuItem(); - this.ExtractAssetButton = new FModel.SplitButton(); this.ExtractAsset = new System.Windows.Forms.ContextMenuStrip(this.components); this.LoadDataTS = new System.Windows.Forms.ToolStripMenuItem(); this.SaveImageTS = new System.Windows.Forms.ToolStripMenuItem(); @@ -59,6 +56,11 @@ this.ConsoleRichTextBox = new System.Windows.Forms.RichTextBox(); this.FilterLabel = new System.Windows.Forms.Label(); this.FilterTextBox = new System.Windows.Forms.TextBox(); + this.updateModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.OpenImageButton = new FModel.SplitButton(); + this.ExtractAssetButton = new FModel.SplitButton(); + this.LoadButton = new FModel.SplitButton(); this.groupBox1.SuspendLayout(); this.LoadContext.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ItemIconPictureBox)).BeginInit(); @@ -80,29 +82,19 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "PAK"; // - // LoadButton - // - this.LoadButton.Location = new System.Drawing.Point(296, 18); - this.LoadButton.Menu = this.LoadContext; - this.LoadButton.Name = "LoadButton"; - this.LoadButton.Size = new System.Drawing.Size(106, 23); - this.LoadButton.TabIndex = 12; - this.LoadButton.Text = " Load"; - this.LoadButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.LoadButton.UseVisualStyleBackColor = true; - this.LoadButton.Click += new System.EventHandler(this.LoadButton_Click); - // // LoadContext // this.LoadContext.ImageScalingSize = new System.Drawing.Size(18, 18); this.LoadContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.loadAllPAKsToolStripMenuItem, + this.toolStripSeparator2, this.backupCurrentPAKsToolStripMenuItem, this.enablePAKsDiffToolStripMenuItem, - this.toolStripSeparator2, + this.updateModeToolStripMenuItem, + this.toolStripSeparator3, this.optionsToolStripMenuItem}); this.LoadContext.Name = "LoadContext"; - this.LoadContext.Size = new System.Drawing.Size(186, 120); + this.LoadContext.Size = new System.Drawing.Size(186, 148); // // loadAllPAKsToolStripMenuItem // @@ -230,18 +222,6 @@ this.scintilla1.Size = new System.Drawing.Size(560, 350); this.scintilla1.TabIndex = 12; // - // OpenImageButton - // - this.OpenImageButton.Location = new System.Drawing.Point(810, 635); - this.OpenImageButton.Menu = this.ImageContext; - this.OpenImageButton.Name = "OpenImageButton"; - this.OpenImageButton.Size = new System.Drawing.Size(112, 23); - this.OpenImageButton.TabIndex = 11; - this.OpenImageButton.Text = " Open Image"; - this.OpenImageButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.OpenImageButton.UseVisualStyleBackColor = true; - this.OpenImageButton.Click += new System.EventHandler(this.OpenImageButton_Click); - // // ImageContext // this.ImageContext.ImageScalingSize = new System.Drawing.Size(18, 18); @@ -258,18 +238,6 @@ this.ImageSaveTS.Text = "Save Image"; this.ImageSaveTS.Click += new System.EventHandler(this.ImageSaveTS_Click); // - // ExtractAssetButton - // - this.ExtractAssetButton.Location = new System.Drawing.Point(810, 664); - this.ExtractAssetButton.Menu = this.ExtractAsset; - this.ExtractAssetButton.Name = "ExtractAssetButton"; - this.ExtractAssetButton.Size = new System.Drawing.Size(112, 23); - this.ExtractAssetButton.TabIndex = 10; - this.ExtractAssetButton.Text = " Extract Asset"; - this.ExtractAssetButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ExtractAssetButton.UseVisualStyleBackColor = true; - this.ExtractAssetButton.Click += new System.EventHandler(this.ExtractAssetButton_Click); - // // ExtractAsset // this.ExtractAsset.ImageScalingSize = new System.Drawing.Size(18, 18); @@ -339,6 +307,55 @@ this.FilterTextBox.TabIndex = 5; this.FilterTextBox.TextChanged += new System.EventHandler(this.FilterTextBox_TextChanged); // + // updateModeToolStripMenuItem + // + this.updateModeToolStripMenuItem.CheckOnClick = true; + this.updateModeToolStripMenuItem.Enabled = false; + this.updateModeToolStripMenuItem.Name = "updateModeToolStripMenuItem"; + this.updateModeToolStripMenuItem.Size = new System.Drawing.Size(185, 22); + this.updateModeToolStripMenuItem.Text = "Update Mode"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(182, 6); + // + // OpenImageButton + // + this.OpenImageButton.Location = new System.Drawing.Point(810, 635); + this.OpenImageButton.Menu = this.ImageContext; + this.OpenImageButton.Name = "OpenImageButton"; + this.OpenImageButton.Size = new System.Drawing.Size(112, 23); + this.OpenImageButton.TabIndex = 11; + this.OpenImageButton.Text = " Open Image"; + this.OpenImageButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.OpenImageButton.UseVisualStyleBackColor = true; + this.OpenImageButton.Click += new System.EventHandler(this.OpenImageButton_Click); + // + // ExtractAssetButton + // + this.ExtractAssetButton.Location = new System.Drawing.Point(810, 664); + this.ExtractAssetButton.Menu = this.ExtractAsset; + this.ExtractAssetButton.Name = "ExtractAssetButton"; + this.ExtractAssetButton.Size = new System.Drawing.Size(112, 23); + this.ExtractAssetButton.TabIndex = 10; + this.ExtractAssetButton.Text = " Extract Asset"; + this.ExtractAssetButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ExtractAssetButton.UseVisualStyleBackColor = true; + this.ExtractAssetButton.Click += new System.EventHandler(this.ExtractAssetButton_Click); + // + // LoadButton + // + this.LoadButton.Location = new System.Drawing.Point(296, 18); + this.LoadButton.Menu = this.LoadContext; + this.LoadButton.Name = "LoadButton"; + this.LoadButton.Size = new System.Drawing.Size(106, 23); + this.LoadButton.TabIndex = 12; + this.LoadButton.Text = " Load"; + this.LoadButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.LoadButton.UseVisualStyleBackColor = true; + this.LoadButton.Click += new System.EventHandler(this.LoadButton_Click); + // // PAKWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -401,6 +418,8 @@ private System.Windows.Forms.ToolStripMenuItem backupCurrentPAKsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem enablePAKsDiffToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem updateModeToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; } } diff --git a/FModel/PAKWindow.cs b/FModel/PAKWindow.cs index 8a202203..8e7199df 100644 --- a/FModel/PAKWindow.cs +++ b/FModel/PAKWindow.cs @@ -774,9 +774,17 @@ namespace FModel private void enablePAKsDiffToolStripMenuItem_CheckedChanged(object sender, EventArgs e) { if (enablePAKsDiffToolStripMenuItem.Checked == true) + { loadAllPAKsToolStripMenuItem.Text = "Load Difference"; + updateModeToolStripMenuItem.Enabled = true; + } if (enablePAKsDiffToolStripMenuItem.Checked == false) + { loadAllPAKsToolStripMenuItem.Text = "Load All PAKs"; + updateModeToolStripMenuItem.Enabled = false; + if (updateModeToolStripMenuItem.Checked == true) + updateModeToolStripMenuItem.Checked = false; + } } public static IEnumerable GetAncestors(TItem item, Func getParentFunc) @@ -2075,6 +2083,768 @@ namespace FModel AppendText(PAKsComboBox.SelectedItem.ToString(), Color.DarkRed, true); } } + else if (IDParser[iii].DisplayAssetPath == null && IDParser[iii].ExportType == "AthenaCharacterItemDefinition") + { + var files2 = Directory.GetFiles(docPath + "\\Extracted", "DA_Featured_" + currentItem + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); + if (!File.Exists(files2)) + { + if (isAllPAKs == false) + { + await Task.Run(() => { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + "DA_Featured_" + currentItem + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict["DA_Featured_" + currentItem] + "\" \"" + "DA_Featured_" + currentItem + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + files2 = Directory.GetFiles(docPath + "\\Extracted", "DA_Featured_" + currentItem + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); + } + try + { + if (files2 != null) + { + wasFeatured = true; + AppendText("✔ ", Color.Green); + AppendText("DA_Featured_" + currentItem, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(files2.Substring(0, files2.LastIndexOf('.')), Color.SteelBlue, true); + try + { + await Task.Run(() => + { + jwpmProcess("serialize \"" + files2.Substring(0, files2.LastIndexOf('.')) + "\""); + }); + var filesJSON2 = Directory.GetFiles(docPath, "DA_Featured_" + currentItem + ".json", SearchOption.AllDirectories).FirstOrDefault(); + var json2 = JToken.Parse(File.ReadAllText(filesJSON2)).ToString(); + File.Delete(filesJSON2); + AppendText("✔ ", Color.Green); + AppendText("DA_Featured_" + currentItem, Color.DarkRed); + AppendText(" successfully serialized", Color.Black, true); + + var IDParser2 = FeaturedParser.FromJson(json2); + for (int i1 = 0; i1 < IDParser2.Length; i1++) + { + if (IDParser2[i1].DetailsImage != null) + { + string textureFile = IDParser2[i1].DetailsImage.ResourceObject; + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath2)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile] + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath2 != null && filesPath2.Contains("MI_UI_FeaturedRenderSwitch_")) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath2.Substring(0, filesPath2.LastIndexOf('.')), Color.SteelBlue, true); + try + { + await Task.Run(() => + { + jwpmProcess("serialize \"" + filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + "\""); + }); + var filesJSON3 = Directory.GetFiles(docPath, textureFile + ".json", SearchOption.AllDirectories).FirstOrDefault(); + var json3 = JToken.Parse(File.ReadAllText(filesJSON3)).ToString(); + File.Delete(filesJSON3); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully serialized", Color.Black, true); + + var RenderParser = RenderSwitchMaterial.FromJson(json3); + for (int i2 = 0; i2 < RenderParser.Length; i2++) + { + if (RenderParser[i2].TextureParameterValues.FirstOrDefault().ParameterValue != null) + { + string textureFile2 = RenderParser[i2].TextureParameterValues.FirstOrDefault().ParameterValue; + AppendText("✔ ", Color.Green); + AppendText(textureFile2, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath3 = Directory.GetFiles(docPath + "\\Extracted", textureFile2 + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath3)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile2 + "\" \"" + docPath + "\""); + }); + filesPath3 = Directory.GetFiles(docPath + "\\Extracted", textureFile2 + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile2 + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile2] + "\" \"" + textureFile2 + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath3 = Directory.GetFiles(docPath + "\\Extracted", textureFile2 + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath3 != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile2, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath3.Substring(0, filesPath3.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath3.Substring(0, filesPath3.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath3.Substring(0, filesPath3.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath3.Substring(0, filesPath3.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile2, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile2, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + else if (filesPath2 != null && !filesPath2.Contains("MI_UI_FeaturedRenderSwitch_")) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath2.Substring(0, filesPath2.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + else + { + wasFeatured = false; + if (IDParser[iii].HeroDefinition != null) + { + var filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].HeroDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + AppendText("✔ ", Color.Green); + AppendText("Extracting ", Color.Black); + AppendText(IDParser[iii].HeroDefinition, Color.DarkRed, true); + + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].HeroDefinition + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[IDParser[iii].HeroDefinition] + "\" \"" + IDParser[iii].HeroDefinition + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].HeroDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(IDParser[iii].HeroDefinition, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + try + { + await Task.Run(() => + { + jwpmProcess("serialize \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + var filesJSON2 = Directory.GetFiles(docPath, IDParser[iii].HeroDefinition + ".json", SearchOption.AllDirectories).FirstOrDefault(); + var json2 = JToken.Parse(File.ReadAllText(filesJSON2)).ToString(); + File.Delete(filesJSON2); + AppendText("✔ ", Color.Green); + AppendText(IDParser[iii].HeroDefinition, Color.DarkRed); + AppendText(" successfully serialized", Color.Black, true); + + var IDParser2 = ItemsIdParser.FromJson(json2); + for (int i1 = 0; i1 < IDParser2.Length; i1++) + { + if (IDParser2[i1].LargePreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser2[i1].LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser2[i1].LargePreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath2)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile] + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath2 != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath2.Substring(0, filesPath2.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(IDParser[iii].HeroDefinition, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText(PAKsComboBox.SelectedItem.ToString(), Color.DarkRed, true); + } + } + else if (IDParser[iii].WeaponDefinition != null) + { + var filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].WeaponDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + AppendText("✔ ", Color.Green); + AppendText("Extracting ", Color.Black); + AppendText(IDParser[iii].WeaponDefinition, Color.DarkRed, true); + + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].WeaponDefinition + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[IDParser[iii].WeaponDefinition] + "\" \"" + IDParser[iii].WeaponDefinition + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].WeaponDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(IDParser[iii].WeaponDefinition, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + try + { + await Task.Run(() => + { + jwpmProcess("serialize \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + var filesJSON2 = Directory.GetFiles(docPath, IDParser[iii].WeaponDefinition + ".json", SearchOption.AllDirectories).FirstOrDefault(); + var json2 = JToken.Parse(File.ReadAllText(filesJSON2)).ToString(); + File.Delete(filesJSON2); + AppendText("✔ ", Color.Green); + AppendText(IDParser[iii].WeaponDefinition, Color.DarkRed); + AppendText(" successfully serialized", Color.Black, true); + + var IDParser2 = ItemsIdParser.FromJson(json2); + for (int i2 = 0; i2 < IDParser2.Length; i2++) + { + if (IDParser2[i2].LargePreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser2[i2].LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser2[i2].LargePreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath2)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile] + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath2 != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath2.Substring(0, filesPath2.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath2.Substring(0, filesPath2.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(IDParser[iii].WeaponDefinition, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText(PAKsComboBox.SelectedItem.ToString(), Color.DarkRed, true); + } + } + else if (IDParser[iii].LargePreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") //DYNAMIC PAK + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else //NORMAL PAK + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile] + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + else if (IDParser[iii].SmallPreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + if (isAllPAKs == false) + { + await Task.Run(() => + { + if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + } + if (isAllPAKs == true) + { + await Task.Run(() => { + try + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + AllPAKsDict[textureFile] + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + catch (KeyNotFoundException ex) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("[ERROR] "); + Console.ForegroundColor = ConsoleColor.White; + Console.Write(ex.Message); + } + }); + } + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText("DA_Featured_" + currentItem, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText(PAKsComboBox.SelectedItem.ToString(), Color.DarkRed, true); + } + } else { wasFeatured = false; @@ -4072,7 +4842,7 @@ namespace FModel { using (Graphics g = Graphics.FromImage(bmp)) { - g.DrawImage(selectedImages[i], new PointF(cur_w, cur_h)); + g.DrawImage(ResizeImage(selectedImages[i], 522, 522), new PointF(cur_w, cur_h)); if (num % numperrow == 0) { cur_w = 0; diff --git a/FModel/PAKWindow.resx b/FModel/PAKWindow.resx index 20e7d49e..93806a9c 100644 --- a/FModel/PAKWindow.resx +++ b/FModel/PAKWindow.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + 277, 17 @@ -131,7 +134,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACc - BwAAAk1TRnQBSQFMAgEBAgEAAXgBAAF4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + BwAAAk1TRnQBSQFMAgEBAgEAAYgBAAGIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA