From 90c0202c42056f466f7cb389966c722ace416b0b Mon Sep 17 00:00:00 2001 From: Asval Date: Tue, 20 Aug 2019 20:52:27 +0200 Subject: [PATCH] bigger display name if Russian + no more "LocResText" for locres stuff --- FModel/Forms/Settings.Designer.cs | 22 +++++++++---------- FModel/MainWindow.cs | 16 ++++++++++++++ .../IconGenerator/ItemGenerator/DrawText.cs | 20 ++++++++++++----- .../IconGenerator/ItemGenerator/Rarity.cs | 22 +++++++++++-------- .../Translations/SearchResource.cs | 16 ++++---------- FModel/Methods/PakHelper/PakHelper.cs | 1 + .../Serializer/LocRes/LocResSerializer.cs | 8 +++---- README.md | 2 +- 8 files changed, 64 insertions(+), 43 deletions(-) diff --git a/FModel/Forms/Settings.Designer.cs b/FModel/Forms/Settings.Designer.cs index 988f4bce..55595463 100644 --- a/FModel/Forms/Settings.Designer.cs +++ b/FModel/Forms/Settings.Designer.cs @@ -52,6 +52,7 @@ namespace FModel.Forms this.button1 = new System.Windows.Forms.Button(); this.wPictureBox = new System.Windows.Forms.PictureBox(); this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.button5 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); @@ -62,7 +63,6 @@ namespace FModel.Forms this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.textBox6 = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); - this.button5 = new System.Windows.Forms.Button(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox4.SuspendLayout(); @@ -345,6 +345,16 @@ namespace FModel.Forms this.groupBox6.TabStop = false; this.groupBox6.Text = "Challenges Theme"; // + // button5 + // + this.button5.Location = new System.Drawing.Point(168, 48); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(124, 23); + this.button5.TabIndex = 34; + this.button5.Text = "Delete Current Banner"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.Button5_Click); + // // button3 // this.button3.Location = new System.Drawing.Point(102, 129); @@ -446,16 +456,6 @@ namespace FModel.Forms this.label12.TabIndex = 9; this.label12.Text = "Watermark:"; // - // button5 - // - this.button5.Location = new System.Drawing.Point(168, 48); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(124, 23); - this.button5.TabIndex = 34; - this.button5.Text = "Delete Current Banner"; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.Button5_Click); - // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 9f978da0..2670eac6 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -518,12 +518,20 @@ namespace FModel { scintilla1.Text = ""; pictureBox1.Image = null; + loadOneToolStripMenuItem.Enabled = false; + loadAllToolStripMenuItem.Enabled = false; treeView1.Nodes.Clear(); //SMH HERE IT DOESN'T LAG listBox1.Items.Clear(); })); CreatePakList(e); + + Invoke(new Action(() => + { + loadOneToolStripMenuItem.Enabled = true; + loadAllToolStripMenuItem.Enabled = true; + })); }); } private async void loadAllToolStripMenuItem_Click(object sender, EventArgs e) @@ -532,6 +540,8 @@ namespace FModel { scintilla1.Text = ""; pictureBox1.Image = null; + loadOneToolStripMenuItem.Enabled = false; + loadAllToolStripMenuItem.Enabled = false; treeView1.Nodes.Clear(); //SMH HERE IT DOESN'T LAG listBox1.Items.Clear(); @@ -555,6 +565,12 @@ namespace FModel UpdateModeHereWeGooooo(); }); } + + Invoke(new Action(() => + { + loadOneToolStripMenuItem.Enabled = true; + loadAllToolStripMenuItem.Enabled = true; + })); } private async void backupPAKsToolStripMenuItem_Click(object sender, EventArgs e) { diff --git a/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs b/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs index f4264430..6762358c 100644 --- a/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs +++ b/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs @@ -354,22 +354,30 @@ namespace FModel JToken sourceString = displayName["source_string"]; if (key != null && sourceString != null) { - //myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(5, 405, 512, 55)); + //myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(5, 385, 512, 59)); + + Size rectSize = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 405, 512, 55).Size : new Rectangle(5, 395, 512, 49).Size; + Point textPoint = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : new Point(522 / 2, 395); + if (Settings.Default.IconLanguage == "Russian") + { + rectSize = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 395, 512, 55).Size : new Rectangle(5, 385, 512, 59).Size; + textPoint = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : new Point(522 / 2, 390); + } string text = SearchResource.getTextByKey(key.Value(), sourceString.Value()); Font goodFont = FontUtilities.FindFont( myGraphic, - text, - string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 405, 512, 55).Size : new Rectangle(5, 395, 512, 49).Size, - new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : Settings.Default.IconLanguage == "Russian" || Settings.Default.IconLanguage == "Chinese (S)" ? FontUtilities.pfc.Families[1] : FontUtilities.pfc.Families[0], 35) + Settings.Default.IconLanguage == "Russian" ? text.ToUpper() : text, + rectSize, + new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : Settings.Default.IconLanguage == "Russian" || Settings.Default.IconLanguage == "Chinese (S)" ? FontUtilities.pfc.Families[1] : FontUtilities.pfc.Families[0], Settings.Default.IconLanguage == "Russian" ? 45 : 35) ); myGraphic.DrawString( - text, + Settings.Default.IconLanguage == "Russian" ? text.ToUpper() : text, goodFont, new SolidBrush(Color.White), - string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : new Point(522 / 2, 395), + textPoint, string.Equals(Settings.Default.rarityDesign, "Flat") ? FontUtilities.rightString : FontUtilities.centeredString ); } diff --git a/FModel/Methods/IconGenerator/ItemGenerator/Rarity.cs b/FModel/Methods/IconGenerator/ItemGenerator/Rarity.cs index 0c32dce5..00535330 100644 --- a/FModel/Methods/IconGenerator/ItemGenerator/Rarity.cs +++ b/FModel/Methods/IconGenerator/ItemGenerator/Rarity.cs @@ -9,12 +9,17 @@ namespace FModel { private static void DrawBackground(Graphics toDrawOn, Color background, Color backgroundUpDown, Color border) { + Pen pen = null; + GraphicsPath p = null; + PathGradientBrush pthGrBrush = null; + Color[] colors = { backgroundUpDown }; + switch (Settings.Default.rarityDesign) { case "Flat": toDrawOn.FillRectangle(new SolidBrush(background), new Rectangle(-1, -1, 522, 522)); - GraphicsPath p = new GraphicsPath(); + p = new GraphicsPath(); p.StartFigure(); p.AddLine(4, 438, 517, 383); p.AddLine(517, 383, 517, 383 + 134); @@ -29,24 +34,23 @@ namespace FModel p.CloseFigure(); toDrawOn.FillPath(new SolidBrush(Utilities.ChangeLightness(background, (float) 0.8)), p); - Pen pen = new Pen(border, 5); + pen = new Pen(border, 5); pen.Alignment = PenAlignment.Inset; toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 522, 522)); break; case "Default": - GraphicsPath path = new GraphicsPath(); - path.AddEllipse(-266, -266, 1044, 1044); + p = new GraphicsPath(); + p.AddEllipse(-266, -266, 1044, 1044); - PathGradientBrush pthGrBrush = new PathGradientBrush(path); + pthGrBrush = new PathGradientBrush(p); pthGrBrush.CenterColor = background; - Color[] colors = { backgroundUpDown }; pthGrBrush.SurroundColors = colors; toDrawOn.FillEllipse(pthGrBrush, -266, -266, 1044, 1044); - Pen pen2 = new Pen(border, 5); - pen2.Alignment = PenAlignment.Inset; - toDrawOn.DrawRectangle(pen2, new Rectangle(-1, -1, 522, 522)); + pen = new Pen(border, 5); + pen.Alignment = PenAlignment.Inset; + toDrawOn.DrawRectangle(pen, new Rectangle(-1, -1, 522, 522)); break; } } diff --git a/FModel/Methods/IconGenerator/Translations/SearchResource.cs b/FModel/Methods/IconGenerator/Translations/SearchResource.cs index 75ad27b8..16df5210 100644 --- a/FModel/Methods/IconGenerator/Translations/SearchResource.cs +++ b/FModel/Methods/IconGenerator/Translations/SearchResource.cs @@ -4,25 +4,17 @@ namespace FModel { static class SearchResource { - /// - /// because idk, i made my serializer in a weird way - /// if a namespace is empty the key become the namespace and the new key is "LocResText" - /// i could change the serializer but it's gonna break a lot of things and i don't wanna take time to fix them - /// - /// - /// - /// public static string getTranslatedText(string theNamespace, string theKey) { try { - if (!string.Equals(theNamespace, "LocResText")) + if (string.IsNullOrEmpty(theNamespace)) { - return LocResSerializer.LocResDict[theNamespace][theKey]; + return LocResSerializer.LocResDict[theKey]; } else { - return LocResSerializer.LocResDict[theKey][theNamespace]; + return LocResSerializer.LocResDict[theNamespace][theKey]; } } catch (KeyNotFoundException) @@ -39,7 +31,7 @@ namespace FModel string text = defaultText; if (LocResSerializer.LocResDict != null) { - text = getTranslatedText(namespac == null ? "LocResText" : namespac, key); + text = getTranslatedText(namespac, key); if (string.IsNullOrEmpty(text)) text = defaultText; } diff --git a/FModel/Methods/PakHelper/PakHelper.cs b/FModel/Methods/PakHelper/PakHelper.cs index b55f2548..6323902f 100644 --- a/FModel/Methods/PakHelper/PakHelper.cs +++ b/FModel/Methods/PakHelper/PakHelper.cs @@ -40,6 +40,7 @@ namespace FModel catch (Exception ex) { if (!string.Equals(ex.Message, "Extraction failed")) { new UpdateMyConsole("Message: " + ex.Message + "\nSource: " + ex.Source + "\nTarget: " + ex.TargetSite + "\n\nContact me: @AsvalFN on Twitter or open an issue on GitHub", Color.Red, true).AppendToConsole(); return; } + else { new UpdateMyConsole("0x" + Settings.Default.AESKey + " doesn't work with the main pak files", Color.Red, true).AppendToConsole(); } if (theExtractor != null) { theExtractor.Dispose(); } break; //if one of the main pak file doesn't work, all the other doesn't work either diff --git a/FModel/Methods/Serializer/LocRes/LocResSerializer.cs b/FModel/Methods/Serializer/LocRes/LocResSerializer.cs index 431df047..bd59b1b3 100644 --- a/FModel/Methods/Serializer/LocRes/LocResSerializer.cs +++ b/FModel/Methods/Serializer/LocRes/LocResSerializer.cs @@ -20,12 +20,12 @@ namespace FModel private static string[] _localizedStringArray { get; set; } private static string _namespacesString { get; set; } private static string _myKey { get; set; } - public static Dictionary> LocResDict { get; set; } + public static Dictionary LocResDict { get; set; } public static void setLocRes(string filepath, bool addToCurrent = false) { - if (!addToCurrent) { LocResDict = new Dictionary>(); } - _myKey = "LocResText"; + if (!addToCurrent) { LocResDict = new Dictionary(); } + _myKey = ""; _namespacesString = ""; _localizedStringArrayOffset = -1; @@ -119,7 +119,7 @@ namespace FModel if (!LocResDict.ContainsKey(_namespacesString)) { LocResDict[_namespacesString] = new Dictionary(); - LocResDict[_namespacesString][_myKey] = _localizedStringArray[stringIndex]; + LocResDict[_namespacesString] = _localizedStringArray[stringIndex]; } } } diff --git a/README.md b/README.md index 47710f16..b8b775ac 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ - _I'm sure the key is correct but opening the file with this key isn't working_ - First, make sure `C:\Windows\System32\vcruntime140.dll` isn't missing. If it's missing you can download it by installing [Microsoft Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads). - - If it's not missing you can open on issue on GitHub or contact us on Twitter [@AsvalFN](https://twitter.com/AsvalFN) [@MaikyMOficial](https://twitter.com/MaikyMOficial) [@iFireMonkey](https://twitter.com/iFireMonkey) + - If it's not missing you can open on issue on GitHub or contact us on Twitter [@AsvalFN](https://twitter.com/AsvalFN) [@MaikyMOficial](https://twitter.com/MaikyMOficial) - _I can't compile the solution on Visual Studio_