bigger display name if Russian + no more "LocResText" for locres stuff

This commit is contained in:
Asval 2019-08-20 20:52:27 +02:00
parent 6a810bb940
commit 90c0202c42
8 changed files with 64 additions and 43 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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<string>(), sourceString.Value<string>());
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
);
}

View File

@ -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;
}
}

View File

@ -4,25 +4,17 @@ namespace FModel
{
static class SearchResource
{
/// <summary>
/// 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
/// </summary>
/// <param name="theNamespace"></param>
/// <param name="theKey"></param>
/// <returns></returns>
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;
}

View File

@ -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

View File

@ -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<string, Dictionary<string, string>> LocResDict { get; set; }
public static Dictionary<string, dynamic> LocResDict { get; set; }
public static void setLocRes(string filepath, bool addToCurrent = false)
{
if (!addToCurrent) { LocResDict = new Dictionary<string, Dictionary<string, string>>(); }
_myKey = "LocResText";
if (!addToCurrent) { LocResDict = new Dictionary<string, dynamic>(); }
_myKey = "";
_namespacesString = "";
_localizedStringArrayOffset = -1;
@ -119,7 +119,7 @@ namespace FModel
if (!LocResDict.ContainsKey(_namespacesString))
{
LocResDict[_namespacesString] = new Dictionary<string, string>();
LocResDict[_namespacesString][_myKey] = _localizedStringArray[stringIndex];
LocResDict[_namespacesString] = _localizedStringArray[stringIndex];
}
}
}

View File

@ -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_