diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 73c200c7..9c5804a3 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -136,7 +136,6 @@ - @@ -242,10 +241,10 @@ - + Always - + Always diff --git a/FModel/Forms/AESManager.Designer.cs b/FModel/Forms/AESManager.Designer.cs index a2451f53..c05c6cc6 100644 --- a/FModel/Forms/AESManager.Designer.cs +++ b/FModel/Forms/AESManager.Designer.cs @@ -35,6 +35,7 @@ this.OKButton = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.panel1 = new System.Windows.Forms.Panel(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.groupBox3.SuspendLayout(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); @@ -103,11 +104,24 @@ this.panel1.Size = new System.Drawing.Size(559, 200); this.panel1.TabIndex = 0; // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(12, 296); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(124, 13); + this.linkLabel1.TabIndex = 18; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "Latest Fortnite AES Keys"; + this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked); + // // AESManager // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(589, 325); + this.Controls.Add(this.linkLabel1); this.Controls.Add(this.groupBox1); this.Controls.Add(this.OKButton); this.Controls.Add(this.groupBox3); @@ -121,6 +135,7 @@ this.groupBox3.PerformLayout(); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -132,5 +147,6 @@ private System.Windows.Forms.Button OKButton; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.LinkLabel linkLabel1; } } \ No newline at end of file diff --git a/FModel/Forms/AESManager.cs b/FModel/Forms/AESManager.cs index b44971cc..ed0c2559 100644 --- a/FModel/Forms/AESManager.cs +++ b/FModel/Forms/AESManager.cs @@ -49,7 +49,11 @@ namespace FModel.Forms private void OKButton_Click(object sender, EventArgs e) { - Properties.Settings.Default.AESKey = textBox2.Text.Substring(2).ToUpper(); + if (!string.IsNullOrWhiteSpace(textBox2.Text)) + { + Properties.Settings.Default.AESKey = textBox2.Text.Substring(2).ToUpper(); + } + else { Properties.Settings.Default.AESKey = ""; } DynamicKeysManager.AESEntries = new List(); for (int i = 0; i < ThePak.dynamicPaksList.Count; i++) @@ -75,5 +79,10 @@ namespace FModel.Forms Properties.Settings.Default.Save(); Close(); } + + private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start("http://benbotfn.tk:8080/api/aes"); + } } } diff --git a/FModel/Forms/About.Designer.cs b/FModel/Forms/About.Designer.cs index bc37b556..32286cbf 100644 --- a/FModel/Forms/About.Designer.cs +++ b/FModel/Forms/About.Designer.cs @@ -65,10 +65,10 @@ this.linkLabel2.AutoSize = true; this.linkLabel2.Location = new System.Drawing.Point(398, 91); this.linkLabel2.Name = "linkLabel2"; - this.linkLabel2.Size = new System.Drawing.Size(42, 13); + this.linkLabel2.Size = new System.Drawing.Size(43, 13); this.linkLabel2.TabIndex = 2; this.linkLabel2.TabStop = true; - this.linkLabel2.Text = "Donate"; + this.linkLabel2.Text = "Discord"; this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // // label1 diff --git a/FModel/Forms/About.cs b/FModel/Forms/About.cs index 352ba04b..91c016cf 100644 --- a/FModel/Forms/About.cs +++ b/FModel/Forms/About.cs @@ -19,7 +19,7 @@ namespace FModel.Forms private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - System.Diagnostics.Process.Start("https://paypal.me/AsvalD3SK1NG"); + System.Diagnostics.Process.Start("https://discordapp.com/invite/JmWvXKb"); } } } diff --git a/FModel/Forms/Settings.cs b/FModel/Forms/Settings.cs index cbacdf86..29e88b0c 100644 --- a/FModel/Forms/Settings.cs +++ b/FModel/Forms/Settings.cs @@ -118,6 +118,11 @@ namespace FModel.Forms Properties.Settings.Default.IconLanguage = comboBox1.SelectedItem.ToString(); Properties.Settings.Default.Save(); //SAVE + + if (ThePak.AllpaksDictionary != null) + { + LoadLocRes.LoadMySelectedLocRes(Properties.Settings.Default.IconLanguage); + } Close(); } diff --git a/FModel/MainWindow.Designer.cs b/FModel/MainWindow.Designer.cs index 07952a28..e5cb5318 100644 --- a/FModel/MainWindow.Designer.cs +++ b/FModel/MainWindow.Designer.cs @@ -46,6 +46,7 @@ this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.filesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.copySelectedFilePathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoSaveImagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -70,7 +71,6 @@ this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker(); - this.copySelectedFilePathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -196,7 +196,7 @@ // this.settingsToolStripMenuItem.Image = global::FModel.Properties.Resources.properties_16xLG; this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); + this.settingsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; this.settingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.settingsToolStripMenuItem.Text = "Settings"; this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); @@ -213,11 +213,19 @@ // searchToolStripMenuItem // this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; - this.searchToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; + this.searchToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2; this.searchToolStripMenuItem.Size = new System.Drawing.Size(216, 22); this.searchToolStripMenuItem.Text = "Search"; this.searchToolStripMenuItem.Click += new System.EventHandler(this.searchToolStripMenuItem_Click); // + // copySelectedFilePathToolStripMenuItem + // + this.copySelectedFilePathToolStripMenuItem.Name = "copySelectedFilePathToolStripMenuItem"; + this.copySelectedFilePathToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3; + this.copySelectedFilePathToolStripMenuItem.Size = new System.Drawing.Size(216, 22); + this.copySelectedFilePathToolStripMenuItem.Text = "Copy Selected File Path"; + this.copySelectedFilePathToolStripMenuItem.Click += new System.EventHandler(this.CopySelectedFilePathToolStripMenuItem_Click); + // // imageToolStripMenuItem // this.imageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -232,7 +240,7 @@ // 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); // @@ -240,18 +248,18 @@ // 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); // @@ -464,14 +472,6 @@ this.backgroundWorker2.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker2_DoWork); this.backgroundWorker2.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker2_RunWorkerCompleted); // - // copySelectedFilePathToolStripMenuItem - // - this.copySelectedFilePathToolStripMenuItem.Name = "copySelectedFilePathToolStripMenuItem"; - this.copySelectedFilePathToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2; - this.copySelectedFilePathToolStripMenuItem.Size = new System.Drawing.Size(216, 22); - this.copySelectedFilePathToolStripMenuItem.Text = "Copy Selected File Path"; - this.copySelectedFilePathToolStripMenuItem.Click += new System.EventHandler(this.CopySelectedFilePathToolStripMenuItem_Click); - // // MainWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index f32362ba..8d6f051b 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -278,7 +278,11 @@ namespace FModel { try { - JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey); + if (!string.IsNullOrWhiteSpace(Settings.Default.AESKey)) + { + JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey); + } + else { break; } } catch (Exception) { @@ -368,6 +372,7 @@ namespace FModel ThePak.CurrentUsedPak = null; ThePak.CurrentUsedPakGuid = null; } + LoadLocRes.LoadMySelectedLocRes(Settings.Default.IconLanguage); UpdateConsole("Building tree, please wait...", Color.FromArgb(255, 244, 132, 66), "Loading"); } private void TreeParsePath(TreeNodeCollection nodeList, string path) //https://social.msdn.microsoft.com/Forums/en-US/c75c1804-6933-40ba-b17a-0e36ae8bcbb5/how-to-create-a-tree-view-with-full-paths?forum=csharplanguage @@ -1262,7 +1267,7 @@ namespace FModel DrawText.DrawTexts(theItem, g, specialMode); - UpdateConsole(theItem.DisplayName, Color.FromArgb(255, 66, 244, 66), "Success"); + UpdateConsole(theItem.DisplayName.SourceString, Color.FromArgb(255, 66, 244, 66), "Success"); if (autoSaveImagesToolStripMenuItem.Checked || updateModeToolStripMenuItem.Checked) { bmp.Save(App.DefaultOutputPath + "\\Icons\\" + ThePak.CurrentUsedItem + ".png", ImageFormat.Png); @@ -1363,7 +1368,7 @@ namespace FModel } } - UpdateConsole(theItem.DisplayName, Color.FromArgb(255, 66, 244, 66), "Success"); + UpdateConsole(theItem.DisplayName.SourceString, Color.FromArgb(255, 66, 244, 66), "Success"); if (autoSaveImagesToolStripMenuItem.Checked || updateModeToolStripMenuItem.Checked) { Invoke(new Action(() => diff --git a/FModel/MainWindow.resx b/FModel/MainWindow.resx index dd0273af..b4540a87 100644 --- a/FModel/MainWindow.resx +++ b/FModel/MainWindow.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa - CAAAAk1TRnQBSQFMAgEBAgEAATABAQEwAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAATgBAQE4AQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/FModel/Methods/AESManager/DynamicKeysManager.cs b/FModel/Methods/AESManager/DynamicKeysManager.cs index 4d7968f8..db2773f9 100644 --- a/FModel/Methods/AESManager/DynamicKeysManager.cs +++ b/FModel/Methods/AESManager/DynamicKeysManager.cs @@ -39,7 +39,6 @@ namespace FModel } AESEntries = outputList; } - else { throw new Exception("Fail to locate AESManager.xml"); } } } } diff --git a/FModel/Methods/BackPAKs/DynamicPAKs.cs b/FModel/Methods/BackPAKs/DynamicPAKs.cs index 58674b90..20cdf5cf 100644 --- a/FModel/Methods/BackPAKs/DynamicPAKs.cs +++ b/FModel/Methods/BackPAKs/DynamicPAKs.cs @@ -1,7 +1,6 @@ using FModel.Methods.BackupPAKs.Parser.AccessCodeParser; using FModel.Methods.BackupPAKs.Parser.TokenParser; using RestSharp; -using System; using Newtonsoft.Json.Linq; using System.Globalization; using System.Collections.Generic; @@ -20,24 +19,17 @@ namespace FModel /// url content public static string GetEndpoint(string url, bool auth) { - string content = string.Empty; - try - { - RestClient EndpointClient = new RestClient(url); - RestRequest EndpointRequest = new RestRequest(Method.GET); + RestClient EndpointClient = new RestClient(url); + RestRequest EndpointRequest = new RestRequest(Method.GET); - if (auth) - { - EndpointRequest.AddHeader("Authorization", "bearer " + getExchangeToken(getAccessCode(getAccessToken(Properties.Settings.Default.eEmail, Properties.Settings.Default.ePassword)))); - } - - var response = EndpointClient.Execute(EndpointRequest); - content = JToken.Parse(response.Content).ToString(Newtonsoft.Json.Formatting.Indented); - } - catch (Exception ex) + if (auth) { - throw new Exception(ex.Message); + EndpointRequest.AddHeader("Authorization", "bearer " + getExchangeToken(getAccessCode(getAccessToken(Properties.Settings.Default.eEmail, Properties.Settings.Default.ePassword)))); } + + var response = EndpointClient.Execute(EndpointRequest); + string content = JToken.Parse(response.Content).ToString(Newtonsoft.Json.Formatting.Indented); + return content; } private static string getAccessToken(string email, string password) diff --git a/FModel/Methods/ChallengeGenerator/BundleDesign.cs b/FModel/Methods/ChallengeGenerator/BundleDesign.cs index b7c0d5cf..284d5b6b 100644 --- a/FModel/Methods/ChallengeGenerator/BundleDesign.cs +++ b/FModel/Methods/ChallengeGenerator/BundleDesign.cs @@ -154,13 +154,49 @@ namespace FModel } private static void drawCompletionText(string count) { + string all = string.Empty; + string any = string.Empty; + switch (Settings.Default.IconLanguage) + { + case "English": + all = "Complete ALL CHALLENGES to earn the reward item"; + any = "Complete ANY " + count + " CHALLENGES to earn the reward item"; + goto default; + case "French": + all = "Terminez CHACUN DES DÉFIS pour gagner la récompense"; + any = "Terminez " + count + " DES DÉFIS pour gagner la récompense"; + goto default; + case "German": + all = "Schließe ALLE HERAUSFORDERUNGEN ab, um die Belohnung zu verdienen"; + any = "Schließe " + count + " HERAUSFORDERUNGEN ab, um die Belohnung zu verdienen"; + goto default; + case "Italian": + all = "Completa TUTTE LE SFIDE per ottenere l'oggetto in ricompensa"; + any = "Completa " + count + " SFIDE QUALSIASI per ottenere l'oggetto ricompensa"; + goto default; + case "Spanish": + all = "Completa LOS DESAFÍOS para conseguir el objeto de recompensa"; + any = "Completa " + count + " DE LOS DESAFÍOS para conseguir el objeto de recompensa"; + goto default; + default: + if (count == "-1") + { + toDrawOn.DrawString(all, new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); + } + else + { + toDrawOn.DrawString(any, new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); + } + break; + } + if (count == "-1") { - toDrawOn.DrawString("Complete ALL CHALLENGES to earn the reward item", new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); + toDrawOn.DrawString(all, new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); } else { - toDrawOn.DrawString("Complete ANY " + count + " CHALLENGES to earn the reward item", new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); + toDrawOn.DrawString(any, new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22)); } } @@ -170,8 +206,25 @@ namespace FModel /// public static void drawWatermark(Bitmap myBitmap) { - toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0)), new Rectangle(0, theY + 240, myBitmap.Width, 40)); - toDrawOn.DrawString(myItem.DisplayName + " Generated using FModel & JohnWickParse - " + DateTime.Now.ToString("dd/MM/yyyy"), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width / 2, theY + 250), FontUtilities.centeredString); + if (LoadLocRes.myLocRes != null && Settings.Default.IconLanguage != "English") + { + string text = SearchResource.getTranslatedText(myItem.DisplayName.Key); + if (!string.IsNullOrEmpty(text)) + { + toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0)), new Rectangle(0, theY + 240, myBitmap.Width, 40)); + toDrawOn.DrawString(text + " Generated using FModel & JohnWickParse - " + DateTime.Now.ToString("dd/MM/yyyy"), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width / 2, theY + 250), FontUtilities.centeredString); + } + else + { + toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0)), new Rectangle(0, theY + 240, myBitmap.Width, 40)); + toDrawOn.DrawString(myItem.DisplayName.SourceString + " Generated using FModel & JohnWickParse - " + DateTime.Now.ToString("dd/MM/yyyy"), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width / 2, theY + 250), FontUtilities.centeredString); + } + } + else + { + toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0)), new Rectangle(0, theY + 240, myBitmap.Width, 40)); + toDrawOn.DrawString(myItem.DisplayName.SourceString + " Generated using FModel & JohnWickParse - " + DateTime.Now.ToString("dd/MM/yyyy"), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width / 2, theY + 250), FontUtilities.centeredString); + } } private static void drawForbyteReward() diff --git a/FModel/Methods/ChallengeGenerator/BundleInfos.cs b/FModel/Methods/ChallengeGenerator/BundleInfos.cs index 342d3ec0..dc97c755 100644 --- a/FModel/Methods/ChallengeGenerator/BundleInfos.cs +++ b/FModel/Methods/ChallengeGenerator/BundleInfos.cs @@ -34,7 +34,16 @@ namespace FModel } public static string getBundleDisplayName(ItemsIdParser theItem) { - return theItem.DisplayName.ToUpper(); + if (LoadLocRes.myLocRes != null && Properties.Settings.Default.IconLanguage != "English") + { + string text = SearchResource.getTranslatedText(theItem.DisplayName.Key); + if (!string.IsNullOrEmpty(text)) + { + return text.ToUpper(); + } + else { return theItem.DisplayName.SourceString.ToUpper(); } + } + else { return theItem.DisplayName.SourceString.ToUpper(); } } public static string getLastFolder(string pathToExtractedBundle) { @@ -94,11 +103,18 @@ namespace FModel for (int p = 0; p < questParser[x].Objectives.Length; p++) { - string newQuest = questParser[x].Objectives[p].Description; + string newQuest; + if (LoadLocRes.myLocRes != null && Properties.Settings.Default.IconLanguage != "English") + { + newQuest = SearchResource.getTranslatedText(questParser[x].Objectives[p].Description.Key); + } + else { newQuest = questParser[x].Objectives[p].Description.SourceString; } long newCount = questParser[x].Objectives[p].Count; - if (questParser[x].BAthenaMustCompleteInSingleMatch != false && questParser[x].ObjectiveCompletionCount > 0) + if (questParser[x].BAthenaMustCompleteInSingleMatch && questParser[x].ObjectiveCompletionCount > 0) + { newCount = questParser[x].ObjectiveCompletionCount; + } if (newQuest != oldQuest && newCount != oldCount) { diff --git a/FModel/Methods/IconGenerator/DrawText.cs b/FModel/Methods/IconGenerator/DrawText.cs index 43ef3b6c..7ed9b2b0 100644 --- a/FModel/Methods/IconGenerator/DrawText.cs +++ b/FModel/Methods/IconGenerator/DrawText.cs @@ -84,7 +84,19 @@ namespace FModel try { - ShortDescription = theItem.ShortDescription; + switch (Settings.Default.IconLanguage) + { + case "French": + case "German": + case "Italian": + case "Spanish": + ShortDescription = SearchResource.getTranslatedText(theItem.ShortDescription.Key); + if (string.IsNullOrEmpty(ShortDescription)) { ShortDescription = theItem.ShortDescription.SourceString; } + break; + default: + ShortDescription = theItem.ShortDescription.SourceString; + break; + } } catch (Exception) { @@ -219,7 +231,22 @@ namespace FModel { if (theItem.DisplayName != null) { - myGraphic.DrawString(theItem.DisplayName, new Font(FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); + if (LoadLocRes.myLocRes != null && Settings.Default.IconLanguage != "English") + { + string text = SearchResource.getTranslatedText(theItem.DisplayName.Key); + if (!string.IsNullOrEmpty(text)) + { + myGraphic.DrawString(text, new Font(FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); + } + else + { + myGraphic.DrawString(theItem.DisplayName.SourceString, new Font(FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); + } + } + else + { + myGraphic.DrawString(theItem.DisplayName.SourceString, new Font(FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); + } } } @@ -232,7 +259,22 @@ namespace FModel { if (theItem.Description != null) { - myGraphic.DrawString(theItem.Description, new Font("Arial", 10), new SolidBrush(Color.White), new RectangleF(5, 441, 512, 49), FontUtilities.centeredStringLine); + if (LoadLocRes.myLocRes != null && Settings.Default.IconLanguage != "English") + { + string text = SearchResource.getTranslatedText(theItem.Description.Key); + if (!string.IsNullOrEmpty(text)) + { + myGraphic.DrawString(text, new Font("Arial", 10), new SolidBrush(Color.White), new RectangleF(5, 441, 512, 49), FontUtilities.centeredStringLine); + } + else + { + myGraphic.DrawString(theItem.Description.SourceString, new Font("Arial", 10), new SolidBrush(Color.White), new RectangleF(5, 441, 512, 49), FontUtilities.centeredStringLine); + } + } + else + { + myGraphic.DrawString(theItem.Description.SourceString, new Font("Arial", 10), new SolidBrush(Color.White), new RectangleF(5, 441, 512, 49), FontUtilities.centeredStringLine); + } } } diff --git a/FModel/Methods/IconGenerator/Translations/AssetNameMap.cs b/FModel/Methods/IconGenerator/Translations/AssetNameMap.cs deleted file mode 100644 index b1504326..00000000 --- a/FModel/Methods/IconGenerator/Translations/AssetNameMap.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; - -namespace FModel -{ - static class AssetNameMap - { - public static List myNamespacesList { get; set; } - public static void searchStringsInUexp(string filepath) - { - myNamespacesList = new List(); - - if (File.Exists(filepath)) - { - List weirdStrings = new List(); - List listBeforeData = new List(); - bool previousByteWasValid = false; - - byte[] bytes = File.ReadAllBytes(filepath); - - string pattern = @"^[a-zA-Z0-9()'\-.&!+, ]"; - Regex regex = new Regex(pattern); - - foreach (byte b in bytes) // Iterate throught all the bytes of the file - { - string byteString = Encoding.UTF8.GetString(new[] { b }); // Generate string for single byte - - bool valid = regex.IsMatch(byteString); - - if (valid) - { - if (previousByteWasValid) weirdStrings[weirdStrings.Count - 1] += byteString; - else weirdStrings.Add(byteString); - } - previousByteWasValid = valid; - } - - bool found = false; - foreach (string str in weirdStrings) - { - if (str.Length >= 2) - { - if (found) { myNamespacesList.Add(str); break; } - - listBeforeData.Add(str); - - if (str == "Outfit" - || str == "Back Bling" - || str == "Pet" - || str == "Harvesting Tool" - || str == "Glider" - || str == "Contrail" - || str == "Emote" - || str == "Emoticon" - || str == "Toy" - || str == "Music") - { - int index = listBeforeData.IndexOf(str); - - Console.WriteLine("DName: " + listBeforeData[index - 3]); - Console.WriteLine("Description: " + listBeforeData[index - 1]); - - myNamespacesList.Add(listBeforeData[index - 3]); - myNamespacesList.Add(listBeforeData[index - 1]); - - found = true; - } - } - } - } - } - - public static void getNameMap(string filepath) - { - Console.Clear(); - - using (BinaryReader reader = new BinaryReader(File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.GetEncoding(1252))) - { - reader.ReadBytes(24); - - int AssetLength = reader.ReadInt32(); - //Console.WriteLine(AssetLength); - - reader.ReadBytes(13); - int NamespaceCount = reader.ReadInt32(); - - long LocalizedStringArrayOffset = -1; - LocalizedStringArrayOffset = reader.ReadInt64(); - if (LocalizedStringArrayOffset != -1) - { - long newOffset = LocalizedStringArrayOffset - 4; - reader.BaseStream.Seek(newOffset, SeekOrigin.Begin); - - string[] LocalizedStringArray = new string[NamespaceCount]; - for (int i = 0; i < LocalizedStringArray.Length; i++) - { - string tag = AssetReader.readCleanString(reader); - if (tag != "None") { LocalizedStringArray[i] = tag; Console.WriteLine(LocalizedStringArray[i]); } - } - } - } - } - } -} diff --git a/FModel/Methods/IconGenerator/Translations/LoadLocRes.cs b/FModel/Methods/IconGenerator/Translations/LoadLocRes.cs index dcbf7342..f4495fb5 100644 --- a/FModel/Methods/IconGenerator/Translations/LoadLocRes.cs +++ b/FModel/Methods/IconGenerator/Translations/LoadLocRes.cs @@ -27,7 +27,11 @@ private static string getMyLocRes(string selectedLanguage) { + string oldKey = JohnWick.MyKey; + JohnWick.MyKey = Properties.Settings.Default.AESKey; string locResPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["Game_BR.locres"], "Game_BR.locres"); + JohnWick.MyKey = oldKey; + return LocResSerializer.StringFinder(locResPath.Replace("zh-Hant", selectedLanguage)); } } diff --git a/FModel/Methods/IconGenerator/Translations/SearchResource.cs b/FModel/Methods/IconGenerator/Translations/SearchResource.cs index 40c9ef7a..4818606a 100644 --- a/FModel/Methods/IconGenerator/Translations/SearchResource.cs +++ b/FModel/Methods/IconGenerator/Translations/SearchResource.cs @@ -6,17 +6,19 @@ namespace FModel static class SearchResource { private static string parsedJsonToCheck { get; set; } + private static JObject jo { get; set; } + private static string oldLanguage = Properties.Settings.Default.IconLanguage; public static string getTranslatedText(string theNamespace) { string toReturn = string.Empty; - string myParsedJson = string.Empty; + string newLanguage = Properties.Settings.Default.IconLanguage; - if (myParsedJson != parsedJsonToCheck) + if (parsedJsonToCheck == null || newLanguage != oldLanguage) { - myParsedJson = JToken.Parse(LoadLocRes.myLocRes).ToString().TrimStart('[').TrimEnd(']'); + parsedJsonToCheck = JToken.Parse(LoadLocRes.myLocRes).ToString().TrimStart('[').TrimEnd(']'); + jo = JObject.Parse(parsedJsonToCheck); } - JObject jo = JObject.Parse(myParsedJson); foreach (JToken token in jo.FindTokens(theNamespace)) { LocResParser LocResParse = LocResParser.FromJson(token.ToString()); @@ -24,13 +26,9 @@ namespace FModel { toReturn = LocResParse.LocResText; } - else if (LocResParse.WorkerSetBonusTraitPattern != null) - { - toReturn = LocResParse.WorkerSetBonusTraitPattern; - } } + oldLanguage = newLanguage; - parsedJsonToCheck = myParsedJson; return toReturn; } } diff --git a/FModel/Methods/JohnWick/JohnWick.cs b/FModel/Methods/JohnWick/JohnWick.cs index 95635c79..d38e0ed5 100644 --- a/FModel/Methods/JohnWick/JohnWick.cs +++ b/FModel/Methods/JohnWick/JohnWick.cs @@ -99,18 +99,6 @@ namespace FModel } currentPakToCheck = currentPak; - /*if (AssetPath.Contains("Athena\\Items\\") && File.Exists(AssetPath.Substring(0, AssetPath.LastIndexOf(".")) + ".uexp")) //TEST - { - try - { - AssetNameMap.searchStringsInUexp(AssetPath.Substring(0, AssetPath.LastIndexOf(".")) + ".uexp"); - } - catch (Exception ex) - { - throw new Exception(ex.Message); - } - }*/ - return AssetPath; } diff --git a/FModel/Methods/Serializer/LocRes/LocResSerializer.cs b/FModel/Methods/Serializer/LocRes/LocResSerializer.cs index fb45e03a..a284176a 100644 --- a/FModel/Methods/Serializer/LocRes/LocResSerializer.cs +++ b/FModel/Methods/Serializer/LocRes/LocResSerializer.cs @@ -64,9 +64,9 @@ namespace FModel } } } - else { throw new Exception("Unsupported LocRes version."); } + else { throw new ArgumentException("Unsupported LocRes version."); } } - else { throw new Exception("Wrong LocResMagic number."); } + else { throw new ArgumentException("Wrong LocResMagic number."); } } return JsonConvert.SerializeObject(LocResDict, Formatting.Indented); diff --git a/FModel/Methods/Utilities/Utilities.cs b/FModel/Methods/Utilities/Utilities.cs index ccf4a67c..a1a9b1df 100644 --- a/FModel/Methods/Utilities/Utilities.cs +++ b/FModel/Methods/Utilities/Utilities.cs @@ -73,7 +73,7 @@ namespace FModel } /// - /// Once upon a time, it was used for shitty stuff + /// /// public static void JohnWickCheck() { diff --git a/FModel/Parser/Banners/BannersParser.cs b/FModel/Parser/Banners/BannersParser.cs index 50aeaf7d..2ebe9d70 100644 --- a/FModel/Parser/Banners/BannersParser.cs +++ b/FModel/Parser/Banners/BannersParser.cs @@ -27,15 +27,24 @@ namespace FModel.Parser.Banners public string CategoryRowName { get; set; } [JsonProperty("DisplayName")] - public string DisplayName { get; set; } + public FTextInfos DisplayName { get; set; } [JsonProperty("DisplayDescription")] - public string DisplayDescription { get; set; } + public FTextInfos DisplayDescription { get; set; } [JsonProperty("bFullUsageRights")] public bool BFullUsageRights { get; set; } } + public partial class FTextInfos + { + [JsonProperty("key")] + public string Key { get; set; } + + [JsonProperty("source_string")] + public string SourceString { get; set; } + } + public class Image { [JsonProperty("asset_path_name")] diff --git a/FModel/Parser/Challenges/ChallengeBundleIdParser.cs b/FModel/Parser/Challenges/ChallengeBundleIdParser.cs index 23c2b7f0..1c804381 100644 --- a/FModel/Parser/Challenges/ChallengeBundleIdParser.cs +++ b/FModel/Parser/Challenges/ChallengeBundleIdParser.cs @@ -19,7 +19,7 @@ namespace FModel.Parser.Challenges public DisplayStyle DisplayStyle { get; set; } [JsonProperty("DisplayName")] - public string DisplayName { get; set; } + public DisplayName DisplayName { get; set; } [JsonProperty("SmallPreviewImage")] public LargePreviewImage SmallPreviewImage { get; set; } @@ -28,6 +28,15 @@ namespace FModel.Parser.Challenges public LargePreviewImage LargePreviewImage { get; set; } } + public partial class DisplayName + { + [JsonProperty("key")] + public string Key { get; set; } + + [JsonProperty("source_string")] + public string SourceString { get; set; } + } + public class BundleCompletionReward { [JsonProperty("CompletionCount")] diff --git a/FModel/Parser/Items/ItemIDParser.cs b/FModel/Parser/Items/ItemIDParser.cs index b3227b84..5179f1cb 100644 --- a/FModel/Parser/Items/ItemIDParser.cs +++ b/FModel/Parser/Items/ItemIDParser.cs @@ -28,13 +28,13 @@ namespace FModel.Parser.Items public string Series { get; set; } [JsonProperty("DisplayName")] - public string DisplayName { get; set; } + public FTextInfos DisplayName { get; set; } [JsonProperty("ShortDescription")] - public string ShortDescription { get; set; } + public FTextInfos ShortDescription { get; set; } [JsonProperty("Description")] - public string Description { get; set; } + public FTextInfos Description { get; set; } [JsonProperty("GameplayTags")] public GameplayTags GameplayTags { get; set; } @@ -67,6 +67,15 @@ namespace FModel.Parser.Items public WeaponStatHandle WeaponStatHandle { get; set; } } + public partial class FTextInfos + { + [JsonProperty("key")] + public string Key { get; set; } + + [JsonProperty("source_string")] + public string SourceString { get; set; } + } + public class GameplayTags { [JsonProperty("gameplay_tags")] diff --git a/FModel/Parser/Quests/QuestParser.cs b/FModel/Parser/Quests/QuestParser.cs index 0b5346de..c6328da9 100644 --- a/FModel/Parser/Quests/QuestParser.cs +++ b/FModel/Parser/Quests/QuestParser.cs @@ -34,16 +34,16 @@ namespace FModel.Parser.Quests public double Weight { get; set; } [JsonProperty("CompletionText")] - public string CompletionText { get; set; } + public FTextInfos CompletionText { get; set; } [JsonProperty("GrantToProfileType")] public string GrantToProfileType { get; set; } [JsonProperty("DisplayName")] - public string DisplayName { get; set; } + public FTextInfos DisplayName { get; set; } [JsonProperty("Description")] - public string Description { get; set; } + public FTextInfos Description { get; set; } [JsonProperty("GameplayTags")] public GameplayTags GameplayTags { get; set; } @@ -55,6 +55,15 @@ namespace FModel.Parser.Quests public LargePreviewImage LargePreviewImage { get; set; } } + public partial class FTextInfos + { + [JsonProperty("key")] + public string Key { get; set; } + + [JsonProperty("source_string")] + public string SourceString { get; set; } + } + public class GameplayTags { [JsonProperty("gameplay_tags")] @@ -118,10 +127,10 @@ namespace FModel.Parser.Quests public long LinkSquadIndex { get; set; } [JsonProperty("Description")] - public string Description { get; set; } + public FTextInfos Description { get; set; } [JsonProperty("HudShortDescription")] - public string HudShortDescription { get; set; } + public FTextInfos HudShortDescription { get; set; } [JsonProperty("HudIcon")] public LargePreviewImage HudIcon { get; set; } diff --git a/FModel/Properties/AssemblyInfo.cs b/FModel/Properties/AssemblyInfo.cs index 13d72f84..fc4bcbb3 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.3.3.0")] -[assembly: AssemblyFileVersion("2.3.3.0")] +[assembly: AssemblyVersion("2.4.0.0")] +[assembly: AssemblyFileVersion("2.4.0.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/FModel/csharp_wick.dll b/FModel/csharp_wick.dll index 9b398057..3342f7a2 100644 Binary files a/FModel/csharp_wick.dll and b/FModel/csharp_wick.dll differ diff --git a/README.md b/README.md index 0fcd053d..bc93da00 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ ### Prerequisites [.NET Framework 4.7.1](https://dotnet.microsoft.com/download/dotnet-framework/net471) ### Download -[![](https://img.shields.io/badge/Release-Executable-orange.svg?logo=github)](https://github.com/iAmAsval/FModel/releases/tag/2.3.3) +[![](https://img.shields.io/badge/Release-Executable-orange.svg?logo=github)](https://github.com/iAmAsval/FModel/releases/tag/2.4.0) ### How does it works **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. ![](https://i.imgur.com/O2Vg3Bx.gif) -**2.** Restart the executable, enter the AES Key, click **Load** and select your .PAK file +**2.** Restart the executable, go to the AES Manager and add you AES Keys, click **Load** and select your .PAK file - It will parse all Assets contained in the selected .PAK file with their respective path **3.** Navigate through the tree to find the Asset you want @@ -77,17 +77,17 @@ Also if you find this project useful, feel free to give it a :star: thank you :k | **Waddlesworth** | **AyeTSG** | **FireMonkey** | **Maiky M** | | :---: | :---: | :---: | :---: | | [![Waddlesworth](https://avatars1.githubusercontent.com/u/769399?s=200&v=4)](https://github.com/SirWaddles) | [![AyeTSG](https://avatars1.githubusercontent.com/u/49595354?s=200&v=4)](https://github.com/AyeTSG) | [![FireMonkey](https://avatars2.githubusercontent.com/u/38590471?s=200&v=4)](https://github.com/ItsFireMonkey) | [![Maiky M](https://avatars3.githubusercontent.com/u/51415805?s=200&v=4)](https://github.com/MaikyM) | -| `https://github.com/SirWaddles` | `https://twitter.com/AyeTSG` | `https://twitter.com/FireMonkeyFN` |`https://twitter.com/Mikey_Bad05` | +| `https://github.com/SirWaddles` | `https://twitter.com/AyeTSG` | `https://twitter.com/FireMonkeyFN` |`https://twitter.com/MaikyMOficial` | ### Why FModel This project is mainly based on what [UModel](https://github.com/gildor2/UModel) can do, in a personalized way, in case UModel doesn't work, as a temporary rescue solution. I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) instead if you wanna use something made professionnaly. ## TODO - [ ] Code refactoring - - [ ] Icons translation - [ ] 2FA support - [ ] Export Queue - [ ] Nintendo Switch sound files + - [x] Translation support - [x] AES Manager - [x] Display support for .locres files - [x] Nintendo Switch PAKs