diff --git a/FModel/Custom/Prompt.cs b/FModel/Custom/Prompt.cs new file mode 100644 index 00000000..9558f419 --- /dev/null +++ b/FModel/Custom/Prompt.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FModel +{ + public static class Prompt + { + public static string ShowDialog(string text, string caption) + { + Form prompt = new Form() + { + Width = 500, + Height = 150, + FormBorderStyle = FormBorderStyle.FixedDialog, + MaximizeBox = false, + MinimizeBox = false, + Text = caption, + StartPosition = FormStartPosition.CenterScreen + }; + Label textLabel = new Label() { Left = 50, Top = 20, Text = text }; + TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 }; + Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK }; + confirmation.Click += (sender, e) => { prompt.Close(); }; + prompt.Controls.Add(textBox); + prompt.Controls.Add(confirmation); + prompt.Controls.Add(textLabel); + prompt.AcceptButton = confirmation; + + return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""; + } + } +} diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index be2acf47..10e90ece 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -111,6 +111,7 @@ + Form diff --git a/FModel/Forms/BackupDynamicPAKs.resx b/FModel/Forms/BackupDynamicPAKs.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/FModel/Forms/BackupDynamicPAKs.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FModel/MainWindow.Designer.cs b/FModel/MainWindow.Designer.cs index 194b5387..733b2624 100644 --- a/FModel/MainWindow.Designer.cs +++ b/FModel/MainWindow.Designer.cs @@ -97,15 +97,15 @@ this.toolStripStatusLabel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200))))); this.toolStripStatusLabel1.Margin = new System.Windows.Forms.Padding(1, 3, 50, 2); this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(65, 17); - this.toolStripStatusLabel1.Text = "FModel 2.2"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(74, 17); + this.toolStripStatusLabel1.Text = "FModel 2.2.1"; // // toolStripStatusLabel2 // this.toolStripStatusLabel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200))))); this.toolStripStatusLabel2.Margin = new System.Windows.Forms.Padding(0, 3, 50, 2); this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; - this.toolStripStatusLabel2.Size = new System.Drawing.Size(945, 17); + this.toolStripStatusLabel2.Size = new System.Drawing.Size(936, 17); this.toolStripStatusLabel2.Spring = true; // // toolStripStatusLabel3 diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 454b0d34..a32745de 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -48,6 +48,7 @@ namespace FModel private static Dictionary _questStageDict; private static Dictionary _diffToExtract; private static string _backupFileName; + private static string _backupDynamicKeys; private static List _itemsToDisplay; public static string DefaultOutputPath; public static string CurrentUsedPak; @@ -816,12 +817,25 @@ namespace FModel } private void CreateBackupList(string[] allYourPaKs) { + bool connection = IsInternetAvailable(); + string url = "https://pastebin.com/raw/bbnhmjWN"; + if (connection) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) + using (Stream stream = response.GetResponseStream()) + using (StreamReader reader = new StreamReader(stream ?? throw new InvalidOperationException())) + { + _backupDynamicKeys = reader.ReadToEnd(); + } + } + for (int i = 0; i < allYourPaKs.Length; i++) { string arCurrentUsedPak = allYourPaKs[i]; //SET CURRENT PAK string arCurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak); //SET CURRENT PAK GUID - if (arCurrentUsedPakGuid == "0-0-0-0") //NO DYNAMIC PAK IN DICTIONARY + if (arCurrentUsedPakGuid == "0-0-0-0") //NO DYNAMIC PAK { JwpmProcess("filelist \"" + Settings.Default.PAKsPath + "\\" + arCurrentUsedPak + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); if (File.Exists(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt")) @@ -870,6 +884,59 @@ namespace FModel File.Delete(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"); } } + else + { + foreach (var myString in _backupDynamicKeys.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) + { + var parts = myString.Split(':'); + if (parts[0] == arCurrentUsedPak && parts[1].StartsWith("0x")) + { + JwpmProcess("filelist \"" + Settings.Default.PAKsPath + "\\" + arCurrentUsedPak + "\" \"" + DefaultOutputPath + "\" " + parts[1].Substring(2)); + if (File.Exists(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt")) + { + if (!File.Exists(DefaultOutputPath + "\\Backup" + _backupFileName)) + File.Create(DefaultOutputPath + "\\Backup" + _backupFileName).Dispose(); + + string[] currentUsedPakLines = File.ReadAllLines(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"); + for (int ii = 0; ii < currentUsedPakLines.Length; ii++) + { + currentUsedPakLines[ii] = "FortniteGame/" + currentUsedPakLines[ii]; + } + UpdateConsole(arCurrentUsedPak, Color.FromArgb(255, 244, 132, 66), "Waiting"); + + File.AppendAllLines(DefaultOutputPath + "\\Backup" + _backupFileName, currentUsedPakLines); + File.Delete(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"); + } + } + else if (parts[0] == arCurrentUsedPak && parts[1] == "undefined") + { + AppendText("No key found for ", Color.Black); + AppendText(arCurrentUsedPak, Color.DarkRed, true); + + //TODO: BETTER VERSION KTHX + /*string promptValue = Prompt.ShowDialog("AES Key:", arCurrentUsedPak); + if (!string.IsNullOrEmpty(promptValue)) + { + JwpmProcess("filelist \"" + Settings.Default.PAKsPath + "\\" + arCurrentUsedPak + "\" \"" + DefaultOutputPath + "\" " + promptValue.Substring(2)); + if (File.Exists(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt")) + { + if (!File.Exists(DefaultOutputPath + "\\Backup" + _backupFileName)) + File.Create(DefaultOutputPath + "\\Backup" + _backupFileName).Dispose(); + + string[] currentUsedPakLines = File.ReadAllLines(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"); + for (int ii = 0; ii < currentUsedPakLines.Length; ii++) + { + currentUsedPakLines[ii] = "FortniteGame/" + currentUsedPakLines[ii]; + } + UpdateConsole(".PAK mount point: \"/FortniteGame/\"", Color.FromArgb(255, 244, 132, 66), "Waiting"); + + File.AppendAllLines(DefaultOutputPath + "\\Backup" + _backupFileName, currentUsedPakLines); + File.Delete(DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"); + } + }*/ + } + } + } } if (File.Exists(DefaultOutputPath + "\\Backup" + _backupFileName)) UpdateConsole("\\Backup" + _backupFileName + " successfully created", Color.FromArgb(255, 66, 244, 66), "Success"); diff --git a/FModel/MainWindow.resx b/FModel/MainWindow.resx index 155ec83b..6a2a6906 100644 --- a/FModel/MainWindow.resx +++ b/FModel/MainWindow.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa - CAAAAk1TRnQBSQFMAgEBAgEAAagBAAGoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/FModel/Properties/AssemblyInfo.cs b/FModel/Properties/AssemblyInfo.cs index 4037238d..3e743c18 100644 --- a/FModel/Properties/AssemblyInfo.cs +++ b/FModel/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.0.0")] -[assembly: AssemblyFileVersion("2.2.0.0")] +[assembly: AssemblyVersion("2.2.1.0")] +[assembly: AssemblyFileVersion("2.2.1.0")] [assembly: NeutralResourcesLanguage("en")]