diff --git a/FModel/MainWindow.Designer.cs b/FModel/MainWindow.Designer.cs index 82fe7f90..1c2e3c38 100644 --- a/FModel/MainWindow.Designer.cs +++ b/FModel/MainWindow.Designer.cs @@ -53,6 +53,8 @@ namespace FModel this.autoSaveImagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.mergeImagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.tweetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutFModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panel1 = new System.Windows.Forms.Panel(); @@ -80,8 +82,8 @@ namespace FModel this.copyFilePathWithoutExtensionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.copyFileNameWithoutExtensionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAsJSONToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.tweetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.extractFolderContentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -89,6 +91,7 @@ namespace FModel this.tableLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.contextMenuStrip1.SuspendLayout(); + this.contextMenuStrip2.SuspendLayout(); this.SuspendLayout(); // // statusStrip1 @@ -263,7 +266,7 @@ namespace FModel // saveImageToolStripMenuItem // this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem"; - this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.saveImageToolStripMenuItem.Text = "Save Image"; this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click); // @@ -271,21 +274,33 @@ namespace FModel // this.autoSaveImagesToolStripMenuItem.CheckOnClick = true; this.autoSaveImagesToolStripMenuItem.Name = "autoSaveImagesToolStripMenuItem"; - this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.autoSaveImagesToolStripMenuItem.Text = "Auto Save Images"; // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(165, 6); // // mergeImagesToolStripMenuItem // this.mergeImagesToolStripMenuItem.Name = "mergeImagesToolStripMenuItem"; - this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.mergeImagesToolStripMenuItem.Text = "Merge Images"; this.mergeImagesToolStripMenuItem.Click += new System.EventHandler(this.mergeImagesToolStripMenuItem_Click); // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(165, 6); + // + // tweetToolStripMenuItem + // + this.tweetToolStripMenuItem.Name = "tweetToolStripMenuItem"; + this.tweetToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + this.tweetToolStripMenuItem.Text = "Tweet"; + this.tweetToolStripMenuItem.Click += new System.EventHandler(this.TweetToolStripMenuItem_Click); + // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -558,17 +573,19 @@ namespace FModel this.saveAsJSONToolStripMenuItem1.Text = "Save as JSON"; this.saveAsJSONToolStripMenuItem1.Click += new System.EventHandler(this.saveAsJSONToolStripMenuItem1_Click); // - // toolStripSeparator4 + // contextMenuStrip2 // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6); + this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.extractFolderContentsToolStripMenuItem}); + this.contextMenuStrip2.Name = "contextMenuStrip2"; + this.contextMenuStrip2.Size = new System.Drawing.Size(197, 48); // - // tweetToolStripMenuItem + // extractFolderContentsToolStripMenuItem // - this.tweetToolStripMenuItem.Name = "tweetToolStripMenuItem"; - this.tweetToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.tweetToolStripMenuItem.Text = "Tweet"; - this.tweetToolStripMenuItem.Click += new System.EventHandler(this.TweetToolStripMenuItem_Click); + this.extractFolderContentsToolStripMenuItem.Name = "extractFolderContentsToolStripMenuItem"; + this.extractFolderContentsToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.extractFolderContentsToolStripMenuItem.Text = "Extract Folder Contents"; + this.extractFolderContentsToolStripMenuItem.Click += new System.EventHandler(this.ExtractFolderContentsToolStripMenuItem_Click); // // MainWindow // @@ -597,6 +614,7 @@ namespace FModel this.tableLayoutPanel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.contextMenuStrip1.ResumeLayout(false); + this.contextMenuStrip2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -656,6 +674,8 @@ namespace FModel private System.Windows.Forms.ToolStripMenuItem saveAsJSONToolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripMenuItem tweetToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; + private System.Windows.Forms.ToolStripMenuItem extractFolderContentsToolStripMenuItem; } } diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 8650d37e..c8eeb4da 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -1018,9 +1018,18 @@ namespace FModel //EVENTS private async void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { - await Task.Run(() => { - GetFilesAndFill(e); - }); + if (e.Node != null && e.Button == MouseButtons.Right) + { + Checking.currentSelectedNodePartialPath = e.Node.FullPath + "\\"; + extractFolderContentsToolStripMenuItem.Text = "Extract " + e.Node.Text + " Folder Contents"; + contextMenuStrip2.Show(Cursor.Position); + } + else + { + await Task.Run(() => { + GetFilesAndFill(e); + }); + } } private async void FilterTextBox_TextChanged(object sender, EventArgs e) { @@ -1118,9 +1127,9 @@ namespace FModel })); } if (Checking.ExtractedFilePath.Contains(".locres") && !Checking.ExtractedFilePath.Contains("EngineOverrides")) - { SerializeLocRes(); - } + if (Checking.ExtractedFilePath.Contains(".uplugin")) + uPluginConvertToJson(Checking.ExtractedFilePath); } else { throw new ArgumentException("Error while extracting " + ThePak.CurrentUsedItem); } } @@ -1249,7 +1258,7 @@ namespace FModel DrawText.DrawTexts(theItem, g, specialMode); - if (autoSaveImagesToolStripMenuItem.Checked || updateModeToolStripMenuItem.Checked) + if (autoSaveImagesToolStripMenuItem.Checked || Checking.UmWorking) { bmp.Save(App.DefaultOutputPath + "\\Icons\\" + ThePak.CurrentUsedItem + ".png", ImageFormat.Png); @@ -1356,7 +1365,7 @@ namespace FModel } UpdateConsole(theItem.DisplayName.SourceString, Color.FromArgb(255, 66, 244, 66), "Success"); - if (autoSaveImagesToolStripMenuItem.Checked || updateModeToolStripMenuItem.Checked) + if (autoSaveImagesToolStripMenuItem.Checked || Checking.UmWorking) { Invoke(new Action(() => { @@ -1450,8 +1459,21 @@ namespace FModel /// private void ConvertToTtf(string file) { - File.Move(file, Path.ChangeExtension(file, ".ttf") ?? throw new InvalidOperationException()); - UpdateConsole(ThePak.CurrentUsedItem + " successfully converter to a font", Color.FromArgb(255, 66, 244, 66), "Success"); + if (File.Exists(Path.ChangeExtension(file, ".ttf"))) File.Delete(Path.ChangeExtension(file, ".ttf")); + + File.Move(file, Path.ChangeExtension(file, ".ttf")); + UpdateConsole(ThePak.CurrentUsedItem + " successfully converted to a font", Color.FromArgb(255, 66, 244, 66), "Success"); + } + private void uPluginConvertToJson(string file) + { + if (File.Exists(Path.ChangeExtension(file, ".json"))) File.Delete(Path.ChangeExtension(file, ".json")); + + File.Move(file, Path.ChangeExtension(file, ".json")); + Invoke(new Action(() => + { + scintilla1.Text = File.ReadAllText(Path.ChangeExtension(file, ".json")); + })); + UpdateConsole(ThePak.CurrentUsedItem + " successfully converter to JSON", Color.FromArgb(255, 66, 244, 66), "Success"); } //EVENTS @@ -1779,17 +1801,14 @@ namespace FModel { CopySelectedFile(); } - private void copyFileNameToolStripMenuItem_Click(object sender, EventArgs e) { CopySelectedFile(true); } - private void copyFilePathWithoutExtensionToolStripMenuItem_Click(object sender, EventArgs e) { CopySelectedFile(false, false); } - private void copyFileNameWithoutExtensionToolStripMenuItem_Click(object sender, EventArgs e) { CopySelectedFile(true, false); @@ -1804,6 +1823,36 @@ namespace FModel { SaveAsJSON(); } + + private void ExtractFolderContentsToolStripMenuItem_Click(object sender, EventArgs e) + { + _diffToExtract = new Dictionary(); + + for (int i = 0; i < PakAsTxt.Length; i++) + { + if (PakAsTxt[i].Contains(Checking.currentSelectedNodePartialPath.Replace("\\", "/"))) + { + string filename = Path.GetFileName(PakAsTxt[i]); + if (filename.Contains(".uasset") || filename.Contains(".uexp") || filename.Contains(".ubulk")) + { + if (!_diffToExtract.ContainsKey(filename.Substring(0, filename.LastIndexOf(".", StringComparison.Ordinal)))) + _diffToExtract.Add(filename.Substring(0, filename.LastIndexOf(".", StringComparison.Ordinal)), PakAsTxt[i]); + } + } + } + Checking.UmWorking = true; + + Invoke(new Action(() => + { + ExtractButton.Enabled = false; + OpenImageButton.Enabled = false; + StopButton.Enabled = true; + })); + if (backgroundWorker2.IsBusy != true) + { + backgroundWorker2.RunWorkerAsync(); + } + } #endregion } } diff --git a/FModel/MainWindow.resx b/FModel/MainWindow.resx index c1dfa462..79b6d856 100644 --- a/FModel/MainWindow.resx +++ b/FModel/MainWindow.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa - CAAAAk1TRnQBSQFMAgEBAgEAAbABAQGwAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAbgBAQG4AQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -178,6 +178,9 @@ 686, 17 + + 841, 17 + 63 diff --git a/FModel/Methods/VarApp.cs b/FModel/Methods/VarApp.cs index 5e26916f..08574379 100644 --- a/FModel/Methods/VarApp.cs +++ b/FModel/Methods/VarApp.cs @@ -69,6 +69,7 @@ namespace FModel public static string BackupFileName { get; set; } public static string ExtractedFilePath { get; set; } public static bool DifferenceFileExists = false; + public static string currentSelectedNodePartialPath { get; set; } } public struct BundleInfoEntry: IEquatable { diff --git a/FModel/Resources/U512.png b/FModel/Resources/U512.png index 1ccc9d6a..3239cc96 100644 Binary files a/FModel/Resources/U512.png and b/FModel/Resources/U512.png differ