From 21a422cf7f12c31aab6a0d8a367feb27c1fb4e90 Mon Sep 17 00:00:00 2001 From: AsvalGTA Date: Tue, 12 Mar 2019 23:25:47 +0100 Subject: [PATCH] deleted config.json related code, added more settings --- FModel/App.config | 3 + FModel/Config.cs | 33 ----- FModel/FModel.csproj | 1 - FModel/Help.Designer.cs | 17 +-- FModel/Options.Designer.cs | 126 +++++++++++++----- FModel/Options.cs | 16 ++- FModel/PAKWindow.cs | 170 +++++++++++++------------ FModel/Properties/Settings.Designer.cs | 12 ++ FModel/Properties/Settings.settings | 3 + README.md | 18 +-- 10 files changed, 222 insertions(+), 177 deletions(-) delete mode 100644 FModel/Config.cs diff --git a/FModel/App.config b/FModel/App.config index f65e0ac0..8fae2515 100644 --- a/FModel/App.config +++ b/FModel/App.config @@ -16,6 +16,9 @@ + + + \ No newline at end of file diff --git a/FModel/Config.cs b/FModel/Config.cs deleted file mode 100644 index ade34fd8..00000000 --- a/FModel/Config.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.IO; -using Newtonsoft.Json; - -namespace FModel -{ - class Config - { - private static string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + "\\FModel"; - private const string configFile = "config.json"; - public static ConfigFile conf; - - static Config() - { - if (!Directory.Exists(docPath)) - Directory.CreateDirectory(docPath); - if (!File.Exists(docPath + "/" + configFile)) - { - string json = JsonConvert.SerializeObject(conf, Formatting.Indented); - File.WriteAllText(docPath + "/" + configFile, json); - } - else - { - string json = File.ReadAllText(docPath + "/" + configFile); - conf = JsonConvert.DeserializeObject(json); - } - } - } - public struct ConfigFile - { - public string pathToFortnitePAKs; - } -} \ No newline at end of file diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 965011c5..ee764b88 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -91,7 +91,6 @@ - Form diff --git a/FModel/Help.Designer.cs b/FModel/Help.Designer.cs index 9bf0fe76..9704a8c8 100644 --- a/FModel/Help.Designer.cs +++ b/FModel/Help.Designer.cs @@ -29,28 +29,17 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HelpWindow)); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // - // richTextBox1 - // - this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBox1.Location = new System.Drawing.Point(0, 0); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.ReadOnly = true; - this.richTextBox1.Size = new System.Drawing.Size(684, 211); - this.richTextBox1.TabIndex = 1; - this.richTextBox1.Text = ""; - // // HelpWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(684, 211); - this.Controls.Add(this.richTextBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "HelpWindow"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FModel Help"; @@ -59,7 +48,5 @@ } #endregion - - private System.Windows.Forms.RichTextBox richTextBox1; } } \ No newline at end of file diff --git a/FModel/Options.Designer.cs b/FModel/Options.Designer.cs index 865a520e..17d73390 100644 --- a/FModel/Options.Designer.cs +++ b/FModel/Options.Designer.cs @@ -34,14 +34,22 @@ this.label1 = new System.Windows.Forms.Label(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); this.textBox2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // optionsOKButton // this.optionsOKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.optionsOKButton.Location = new System.Drawing.Point(475, 92); + this.optionsOKButton.Location = new System.Drawing.Point(475, 169); this.optionsOKButton.Name = "optionsOKButton"; this.optionsOKButton.Size = new System.Drawing.Size(97, 21); this.optionsOKButton.TabIndex = 1; @@ -51,69 +59,117 @@ // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(92, 38); + this.textBox1.Location = new System.Drawing.Point(54, 19); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(480, 20); + this.textBox1.Size = new System.Drawing.Size(500, 20); this.textBox1.TabIndex = 2; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 41); + this.label1.Location = new System.Drawing.Point(6, 22); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(74, 13); + this.label1.Size = new System.Drawing.Size(42, 13); this.label1.TabIndex = 3; - this.label1.Text = "Output Folder:"; + this.label1.Text = "Output:"; // // checkBox1 // this.checkBox1.AutoSize = true; this.checkBox1.Checked = true; this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox1.Location = new System.Drawing.Point(432, 64); + this.checkBox1.Location = new System.Drawing.Point(448, 45); this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(140, 17); + this.checkBox1.Size = new System.Drawing.Size(101, 17); this.checkBox1.TabIndex = 4; - this.checkBox1.Text = "Serialize After Extraction"; + this.checkBox1.Text = "Always Serialize"; this.checkBox1.UseVisualStyleBackColor = true; // // label2 // this.label2.AutoSize = true; this.label2.ForeColor = System.Drawing.Color.Red; - this.label2.Location = new System.Drawing.Point(358, 65); + this.label2.Location = new System.Drawing.Point(374, 46); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(68, 13); this.label2.TabIndex = 5; this.label2.Text = "Advisable -->"; // - // label3 + // textBox3 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 15); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(112, 13); - this.label3.TabIndex = 7; - this.label3.Text = "Fortnite .PAK file path:"; + this.textBox3.Location = new System.Drawing.Point(69, 19); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(195, 20); + this.textBox3.TabIndex = 8; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 22); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(57, 13); + this.label4.TabIndex = 9; + this.label4.Text = "File Name:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.textBox3); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Location = new System.Drawing.Point(12, 144); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(270, 46); + this.groupBox1.TabIndex = 10; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Merger"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.textBox1); + this.groupBox2.Controls.Add(this.checkBox1); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Location = new System.Drawing.Point(12, 67); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(560, 71); + this.groupBox2.TabIndex = 11; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Extraction"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.textBox2); + this.groupBox3.Controls.Add(this.label3); + this.groupBox3.Location = new System.Drawing.Point(12, 12); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(560, 49); + this.groupBox3.TabIndex = 12; + this.groupBox3.TabStop = false; + this.groupBox3.Text = ".PAK files"; // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(130, 12); + this.textBox2.Location = new System.Drawing.Point(46, 19); this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(442, 20); - this.textBox2.TabIndex = 6; + this.textBox2.Size = new System.Drawing.Size(508, 20); + this.textBox2.TabIndex = 2; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 22); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(34, 13); + this.label3.TabIndex = 3; + this.label3.Text = "Input:"; // // OptionsWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(584, 123); - this.Controls.Add(this.label3); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.checkBox1); - this.Controls.Add(this.textBox1); + this.ClientSize = new System.Drawing.Size(584, 198); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.optionsOKButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -122,8 +178,13 @@ this.Name = "OptionsWindow"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FModel Options"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -133,7 +194,12 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/FModel/Options.cs b/FModel/Options.cs index 02a36841..a9a19ec5 100644 --- a/FModel/Options.cs +++ b/FModel/Options.cs @@ -13,6 +13,7 @@ namespace FModel { public partial class OptionsWindow : Form { + private static string PAKBefore; private static string OutputBefore; public OptionsWindow() @@ -21,8 +22,10 @@ namespace FModel checkBox1.Checked = Properties.Settings.Default.ExtractAndSerialize; textBox1.Text = Properties.Settings.Default.ExtractOutput; - //textBox2.Text = Properties.Settings.Default.FortnitePAKs; + textBox2.Text = Properties.Settings.Default.FortnitePAKs; + textBox3.Text = Properties.Settings.Default.mergerFileName; + PAKBefore = Properties.Settings.Default.FortnitePAKs; OutputBefore = Properties.Settings.Default.ExtractOutput; } @@ -37,15 +40,22 @@ namespace FModel Properties.Settings.Default.ExtractAndSerialize = false; } Properties.Settings.Default.ExtractOutput = textBox1.Text; - //Properties.Settings.Default.FortnitePAKs = textBox2.Text; + Properties.Settings.Default.FortnitePAKs = textBox2.Text; + Properties.Settings.Default.mergerFileName = textBox3.Text; if (!Directory.Exists(Properties.Settings.Default.ExtractOutput)) Directory.CreateDirectory(Properties.Settings.Default.ExtractOutput); + string PAKAfter = Properties.Settings.Default.FortnitePAKs; + if (PAKBefore != PAKAfter) + { + MessageBox.Show("Please, restart FModel to apply your new input path", "FModel Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + string OutputAfter = Properties.Settings.Default.ExtractOutput; if (OutputBefore != OutputAfter) { - MessageBox.Show("Please, restart FModel to apply your new path", "FModel Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Please, restart FModel to apply your new output path", "FModel Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); } Properties.Settings.Default.Save(); diff --git a/FModel/PAKWindow.cs b/FModel/PAKWindow.cs index 9907c52c..2c06ee9c 100644 --- a/FModel/PAKWindow.cs +++ b/FModel/PAKWindow.cs @@ -19,7 +19,6 @@ namespace FModel { public partial class PAKWindow : Form { - public static ConfigFile conf; public static string docPath; private static string[] PAKFileAsTXT; private static string ItemName; @@ -73,9 +72,6 @@ namespace FModel private void PAKWindow_Load(object sender, EventArgs e) { - Console.ForegroundColor = ConsoleColor.White; //DEFAULT CONSOLE COLOR - conf = new ConfigFile(); //CREATE CONFIG FILE - Properties.Settings.Default.ExtractAndSerialize = true; //SERIALIZE BY DEFAULT docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + "\\FModel"; @@ -89,17 +85,18 @@ namespace FModel docPath = Properties.Settings.Default.ExtractOutput; } - if (!Directory.Exists(Config.conf.pathToFortnitePAKs)) + if (!Directory.Exists(Properties.Settings.Default.FortnitePAKs)) { AppendText("[PathNotFoundException] ", Color.Red); - AppendText(" Please go to ", Color.Black); - AppendText(docPath, Color.SteelBlue); - AppendText(" and enter your Fortnite .PAK files path in ", Color.Black); - AppendText("config.json", Color.SteelBlue, true); + AppendText(" Please go to the ", Color.Black); + AppendText("Load button drop down menu ", Color.SteelBlue); + AppendText(", ", Color.Black); + AppendText("click on Options ", Color.SteelBlue); + AppendText("and enter your Fortnite .PAK files path", Color.Black, true); } else { - IEnumerable yourPAKs = Directory.GetFiles(Config.conf.pathToFortnitePAKs).Where(x => x.EndsWith(".pak")); + IEnumerable yourPAKs = Directory.GetFiles(Properties.Settings.Default.FortnitePAKs).Where(x => x.EndsWith(".pak")); for (int i = 0; i < yourPAKs.Count(); i++) { PAKsComboBox.Items.Add(Path.GetFileName(yourPAKs.ElementAt(i))); @@ -232,10 +229,10 @@ namespace FModel currentPAK = PAKsComboBox.SelectedItem.ToString(); LoadButton.Enabled = false; await Task.Run(() => { - jwpmProcess("filelist \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + docPath + "\""); + jwpmProcess("filelist \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + docPath + "\""); }); LoadButton.Enabled = true; - currentGUID = readPAKGuid(Config.conf.pathToFortnitePAKs + "\\" + PAKsComboBox.SelectedItem); + currentGUID = readPAKGuid(Properties.Settings.Default.FortnitePAKs + "\\" + PAKsComboBox.SelectedItem); if (!File.Exists(docPath + "\\" + PAKsComboBox.SelectedItem + ".txt")) { @@ -615,7 +612,7 @@ namespace FModel if (!File.Exists(files)) { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); }); files = Directory.GetFiles(docPath + "\\Extracted", currentItem + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); } @@ -688,7 +685,7 @@ namespace FModel AppendText(IDParser[iii].HeroDefinition, Color.DarkRed, true); await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].HeroDefinition + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].HeroDefinition + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].HeroDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -729,14 +726,14 @@ namespace FModel if (currentGUID != "0-0-0-0") { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } else { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -801,7 +798,7 @@ namespace FModel AppendText(IDParser[iii].WeaponDefinition, Color.DarkRed, true); await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].WeaponDefinition + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + IDParser[iii].WeaponDefinition + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", IDParser[iii].WeaponDefinition + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -842,14 +839,14 @@ namespace FModel if (currentGUID != "0-0-0-0") { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } else { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath2 = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -918,7 +915,7 @@ namespace FModel if (currentGUID != "0-0-0-0") //DYNAMIC PAK { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -927,15 +924,15 @@ namespace FModel await Task.Run(() => { if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/2dAssets/")) { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + 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/")) { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } else { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } }); filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); @@ -988,7 +985,7 @@ namespace FModel if (currentGUID != "0-0-0-0") { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); } @@ -997,15 +994,15 @@ namespace FModel await Task.Run(() => { if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/2dAssets/")) { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + 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/")) { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } else { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } }); filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); @@ -1144,7 +1141,7 @@ namespace FModel if (!File.Exists(filesPath)) { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", currentItem + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); } @@ -1219,7 +1216,7 @@ namespace FModel if (!File.Exists(filesPath)) { await Task.Run(() => { - jwpmProcess("extract \"" + Config.conf.pathToFortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + currentItem + "\" \"" + docPath + "\""); }); filesPath = Directory.GetFiles(docPath + "\\Extracted", currentItem + ".uexp", SearchOption.AllDirectories).FirstOrDefault(); } @@ -1329,67 +1326,74 @@ namespace FModel private void mergeGeneratedImagesToolStripMenuItem_Click(object sender, EventArgs e) { - OpenFileDialog theDialog = new OpenFileDialog(); - theDialog.Multiselect = true; - theDialog.InitialDirectory = docPath + "\\Generated Icons\\"; - theDialog.Title = "Choose your images"; - theDialog.Filter = "PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*"; - - if (theDialog.ShowDialog() == DialogResult.OK) + if (string.IsNullOrEmpty(Properties.Settings.Default.mergerFileName)) { - List selectedImages = new List(); - foreach (var files in theDialog.FileNames) + MessageBox.Show("Please, set a name to your file before trying to merge images\n\nSteps:\n\t- Load button drop down menu\n\t- Options", "FModel Merger File Name Missing", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + OpenFileDialog theDialog = new OpenFileDialog(); + theDialog.Multiselect = true; + theDialog.InitialDirectory = docPath + "\\Generated Icons\\"; + theDialog.Title = "Choose your images"; + theDialog.Filter = "PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*"; + + if (theDialog.ShowDialog() == DialogResult.OK) { - selectedImages.Add(Image.FromFile(files)); - } - - var numperrow = 7; - var w = 530 * numperrow; - int h = int.Parse(Math.Ceiling(double.Parse(selectedImages.Count.ToString()) / numperrow).ToString()) * 530; - Bitmap bmp = new Bitmap(w - 8, h - 8); - - if (selectedImages.Count * 530 < 530 * numperrow) - { - w = selectedImages.Count * 530; - } - - var num = 1; - var cur_w = 0; - var cur_h = 0; - - for (int i = 0; i < selectedImages.Count; i++) - { - using (Graphics g = Graphics.FromImage(bmp)) + List selectedImages = new List(); + foreach (var files in theDialog.FileNames) { - g.DrawImage(selectedImages[i], new PointF(cur_w, cur_h)); - if (num % numperrow == 0) + selectedImages.Add(Image.FromFile(files)); + } + + var numperrow = 7; + var w = 530 * numperrow; + int h = int.Parse(Math.Ceiling(double.Parse(selectedImages.Count.ToString()) / numperrow).ToString()) * 530; + Bitmap bmp = new Bitmap(w - 8, h - 8); + + if (selectedImages.Count * 530 < 530 * numperrow) + { + w = selectedImages.Count * 530; + } + + var num = 1; + var cur_w = 0; + var cur_h = 0; + + for (int i = 0; i < selectedImages.Count; i++) + { + using (Graphics g = Graphics.FromImage(bmp)) { - cur_w = 0; - cur_h += 530; - num += 1; - } - else - { - cur_w += 530; - num += 1; + g.DrawImage(selectedImages[i], new PointF(cur_w, cur_h)); + if (num % numperrow == 0) + { + cur_w = 0; + cur_h += 530; + num += 1; + } + else + { + cur_w += 530; + num += 1; + } } } + bmp.Save(docPath + "\\" + Properties.Settings.Default.mergerFileName + ".png", ImageFormat.Png); + var newForm = new Form(); + + PictureBox pb = new PictureBox(); + pb.Dock = DockStyle.Fill; + pb.Image = bmp; + pb.SizeMode = PictureBoxSizeMode.Zoom; + + newForm.WindowState = FormWindowState.Maximized; + newForm.Size = bmp.Size; + newForm.Icon = Properties.Resources.FNTools_Logo_Icon; + newForm.Text = docPath + "\\" + Properties.Settings.Default.mergerFileName + ".png"; + newForm.StartPosition = FormStartPosition.CenterScreen; + newForm.Controls.Add(pb); + newForm.Show(); } - bmp.Save(docPath + "\\Merger.png"); - var newForm = new Form(); - - PictureBox pb = new PictureBox(); - pb.Dock = DockStyle.Fill; - pb.Image = bmp; - pb.SizeMode = PictureBoxSizeMode.Zoom; - - newForm.WindowState = FormWindowState.Maximized; - newForm.Size = bmp.Size; - newForm.Icon = Properties.Resources.FNTools_Logo_Icon; - newForm.Text = docPath + "\\Merger.png"; - newForm.StartPosition = FormStartPosition.CenterScreen; - newForm.Controls.Add(pb); - newForm.Show(); } } diff --git a/FModel/Properties/Settings.Designer.cs b/FModel/Properties/Settings.Designer.cs index 5ed33fd3..0e7c6624 100644 --- a/FModel/Properties/Settings.Designer.cs +++ b/FModel/Properties/Settings.Designer.cs @@ -57,5 +57,17 @@ namespace FModel.Properties { this["FortnitePAKs"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string mergerFileName { + get { + return ((string)(this["mergerFileName"])); + } + set { + this["mergerFileName"] = value; + } + } } } diff --git a/FModel/Properties/Settings.settings b/FModel/Properties/Settings.settings index c616b5be..0c997af9 100644 --- a/FModel/Properties/Settings.settings +++ b/FModel/Properties/Settings.settings @@ -11,5 +11,8 @@ + + + \ No newline at end of file diff --git a/README.md b/README.md index 3ad94b8d..1de7a10c 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,15 @@ ### Prerequisites [.NET Framework 4.6.1](https://dotnet.microsoft.com/download/dotnet-framework-runtime/net461) ### How does it works -**1.** Once you start the executable, a `FModel` subfolder will be created in your `Documents` folder as well as a `config.json` file and it'll automatically download the latest version of the modded Fortnite Asset Parser. +**1.** Once you start the executable, you'll be asked to set your path to your Fortnite .PAK files. Meanwhile a `FModel` subfolder will be created in your `Documents` folder and it'll automatically download the latest version of the modded Fortnite Asset Parser in this subfolder. +![](https://i.imgur.com/oaceS8K.gif) -**2.** Open the config file and fill `pathToFortnitePAKs` with the path to your Fortnite .PAK files -```json -{ - "pathToFortnitePAKs": "C:\\Program Files\\Epic Games\\Fortnite\\FortniteGame\\Content\\Paks" -} -``` - -**3.** Restart the executable, select your .PAK file, enter the AES key and click **Load** +**2.** Restart the executable, select your .PAK file, enter the AES key and click **Load** - It will parse all Assets contained in the selected .PAK file with their respective path -**4.** Navigate through the tree to find the Asset you want +**3.** Navigate through the tree to find the Asset you want -**5.** Clicking on **Extract Asset** will extract the selected Asset to your `Documents` folder, try to serialize it and will display infos about it +**4.** Clicking on **Extract Asset** will extract the selected Asset to your `Documents` folder, try to serialize it and will display infos about it - Asset is an **_ID_**: - Try to create an [Icon](https://i.imgur.com/PStlmUV.png) with **Name**, **Description**, **Rarity**, **Type** and the **Cosmetic Source** - Asset is a **_Texture_**: @@ -52,7 +46,7 @@ I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) instea - [ ] Improve speed - [x] Multithreading - [x] Filter for the items ListBox -- [ ] More options +- [ ] More settings - [ ] Stop button while extracting - [ ] Support for meshes - [ ] Support for animations