mirror of
https://github.com/4sval/FModel.git
synced 2026-03-24 10:44:51 -05:00
auto resize qDescription + translated reload time + save locres
This commit is contained in:
parent
3a1b11102a
commit
1538dbb45c
40
FModel/MainWindow.Designer.cs
generated
40
FModel/MainWindow.Designer.cs
generated
|
|
@ -71,6 +71,10 @@
|
|||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
|
||||
this.locResToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveCurrentLocResToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.getDifferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
|
|
@ -205,7 +209,9 @@
|
|||
//
|
||||
this.filesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.searchToolStripMenuItem,
|
||||
this.copySelectedFilePathToolStripMenuItem});
|
||||
this.copySelectedFilePathToolStripMenuItem,
|
||||
this.toolStripSeparator4,
|
||||
this.locResToolStripMenuItem});
|
||||
this.filesToolStripMenuItem.Name = "filesToolStripMenuItem";
|
||||
this.filesToolStripMenuItem.Size = new System.Drawing.Size(42, 20);
|
||||
this.filesToolStripMenuItem.Text = "Files";
|
||||
|
|
@ -472,6 +478,34 @@
|
|||
this.backgroundWorker2.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker2_DoWork);
|
||||
this.backgroundWorker2.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker2_RunWorkerCompleted);
|
||||
//
|
||||
// locResToolStripMenuItem
|
||||
//
|
||||
this.locResToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveCurrentLocResToolStripMenuItem,
|
||||
this.getDifferenceToolStripMenuItem});
|
||||
this.locResToolStripMenuItem.Name = "locResToolStripMenuItem";
|
||||
this.locResToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
||||
this.locResToolStripMenuItem.Text = "LocRes";
|
||||
//
|
||||
// saveCurrentLocResToolStripMenuItem
|
||||
//
|
||||
this.saveCurrentLocResToolStripMenuItem.Name = "saveCurrentLocResToolStripMenuItem";
|
||||
this.saveCurrentLocResToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
|
||||
this.saveCurrentLocResToolStripMenuItem.Text = "Save Current LocRes";
|
||||
this.saveCurrentLocResToolStripMenuItem.Click += new System.EventHandler(this.SaveCurrentLocResToolStripMenuItem_Click);
|
||||
//
|
||||
// getDifferenceToolStripMenuItem
|
||||
//
|
||||
this.getDifferenceToolStripMenuItem.Name = "getDifferenceToolStripMenuItem";
|
||||
this.getDifferenceToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
|
||||
this.getDifferenceToolStripMenuItem.Text = "Get Difference";
|
||||
this.getDifferenceToolStripMenuItem.Click += new System.EventHandler(this.GetDifferenceToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(213, 6);
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -546,6 +580,10 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.ToolStripMenuItem copySelectedFilePathToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem locResToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveCurrentLocResToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem getDifferenceToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ namespace FModel
|
|||
private static List<string> _itemsToDisplay { get; set; }
|
||||
public static string ExtractedFilePath { get; set; }
|
||||
public static string[] SelectedItemsArray { get; set; }
|
||||
private bool bIsLocres { get; set; }
|
||||
private bool differenceFileExists = false;
|
||||
#endregion
|
||||
|
||||
|
|
@ -296,6 +297,7 @@ namespace FModel
|
|||
ThePak.CurrentUsedPak = null;
|
||||
ThePak.CurrentUsedPakGuid = null;
|
||||
bool bMainKeyWorking = false;
|
||||
bIsLocres = false;
|
||||
|
||||
for (int i = 0; i < ThePak.mainPaksList.Count; i++)
|
||||
{
|
||||
|
|
@ -1168,6 +1170,7 @@ namespace FModel
|
|||
|
||||
if (ExtractedFilePath != null)
|
||||
{
|
||||
bIsLocres = false;
|
||||
UpdateConsole(ThePak.CurrentUsedItem + " successfully extracted", Color.FromArgb(255, 66, 244, 66), "Success");
|
||||
if (ExtractedFilePath.Contains(".uasset") || ExtractedFilePath.Contains(".uexp") || ExtractedFilePath.Contains(".ubulk"))
|
||||
{
|
||||
|
|
@ -1370,8 +1373,13 @@ namespace FModel
|
|||
{
|
||||
BundleDesign.theY += 140;
|
||||
|
||||
//in case you wanna make some changes
|
||||
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(107, BundleDesign.theY + 7, 2000, 93)); //rectangle that resize the font -> used for "Font goodFont = "
|
||||
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Green)), new Rectangle(107, BundleDesign.theY + 7, 2000, 75)); //rectangle the font needs to be fit with
|
||||
|
||||
//draw quest description
|
||||
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, new Font(FontUtilities.pfc.Families[1], isFortbyte ? (BundleInfos.BundleData[i].questDescr.Length > 80 ? 33 : 40) : 50), new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
|
||||
Font goodFont = FontUtilities.FindFont(BundleDesign.toDrawOn, BundleInfos.BundleData[i].questDescr, new Rectangle(107, BundleDesign.theY + 7, 2000, 93).Size, new Font(FontUtilities.pfc.Families[1], 50)); //size in "new Font()" is never check
|
||||
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, goodFont, new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
|
||||
|
||||
//draw slider + quest count
|
||||
Image slider = Resources.Challenges_Slider;
|
||||
|
|
@ -1437,10 +1445,12 @@ namespace FModel
|
|||
string filePath = App.DefaultOutputPath + "\\Extracted\\" + treeviewPath + "\\" + listBox1.SelectedItem;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
bIsLocres = true;
|
||||
scintilla1.Text = LocResSerializer.StringFinder(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
bIsLocres = false;
|
||||
AppendText("Error while searching " + listBox1.SelectedItem, Color.DarkRed, true);
|
||||
}
|
||||
}));
|
||||
|
|
@ -1621,5 +1631,32 @@ namespace FModel
|
|||
AppendText("Copied!", Color.Green, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveCurrentLocResToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (bIsLocres)
|
||||
{
|
||||
SaveFileDialog saveTheDialog = new SaveFileDialog();
|
||||
saveTheDialog.Title = @"Save LocRes";
|
||||
saveTheDialog.Filter = @"JSON Files (*.json)|*.json";
|
||||
saveTheDialog.InitialDirectory = App.DefaultOutputPath + "\\LocRes\\";
|
||||
saveTheDialog.FileName = ThePak.CurrentUsedItem.Substring(0, ThePak.CurrentUsedItem.LastIndexOf('.'));
|
||||
if (saveTheDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
File.WriteAllText(saveTheDialog.FileName, scintilla1.Text);
|
||||
AppendText(ThePak.CurrentUsedItem, Color.DarkRed);
|
||||
AppendText(" successfully saved", Color.Black, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendText("Please load a .locres file first.\t\t\t", Color.Black);
|
||||
AppendText(@"FortniteGame\Content\Localization\ - pakchunk0-WindowsClient.pak", Color.DarkRed, true);
|
||||
}
|
||||
}
|
||||
private void GetDifferenceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAATgBAQE4AQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAUABAQFAAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
|
|
|||
|
|
@ -349,11 +349,33 @@ namespace FModel
|
|||
|
||||
Image reload = Resources.reload64;
|
||||
myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
|
||||
myGraphic.DrawString(statParsed.ReloadTime + " seconds", new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
myGraphic.DrawString(statParsed.ReloadTime + getSecondsWithLanguage(), new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
|
||||
DrawToRight(weaponName, myGraphic);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// manual translation to improve speed and in case the key is deleted
|
||||
/// that's just 1 word so /shrug
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string getSecondsWithLanguage()
|
||||
{
|
||||
switch (Settings.Default.IconLanguage)
|
||||
{
|
||||
case "French":
|
||||
return " secondes";
|
||||
case "German":
|
||||
return " Sekunden";
|
||||
case "Italian":
|
||||
return " secondi";
|
||||
case "Spanish":
|
||||
case "Spanish (LA)":
|
||||
return " segundos";
|
||||
default:
|
||||
return " seconds";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is only triggered for heroes and defenders
|
||||
|
|
|
|||
|
|
@ -40,5 +40,28 @@ namespace FModel
|
|||
centeredStringLine.LineAlignment = StringAlignment.Center;
|
||||
centeredStringLine.Alignment = StringAlignment.Center;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// https://stackoverflow.com/questions/19674743/dynamically-resizing-font-to-fit-space-while-using-graphics-drawstring/19674954
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="longString"></param>
|
||||
/// <param name="Room"></param>
|
||||
/// <param name="PreferedFont"></param>
|
||||
/// <returns></returns>
|
||||
public static Font FindFont(Graphics g, string longString, Size Room, Font PreferedFont)
|
||||
{
|
||||
SizeF RealSize = g.MeasureString(longString, PreferedFont);
|
||||
float HeightScaleRatio = Room.Height / RealSize.Height;
|
||||
float WidthScaleRatio = Room.Width / RealSize.Width;
|
||||
|
||||
float ScaleRatio = (HeightScaleRatio < WidthScaleRatio)
|
||||
? ScaleRatio = HeightScaleRatio
|
||||
: ScaleRatio = WidthScaleRatio;
|
||||
|
||||
float ScaleFontSize = PreferedFont.Size * ScaleRatio;
|
||||
|
||||
return new Font(PreferedFont.FontFamily, ScaleFontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ namespace FModel
|
|||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Icons\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Sounds\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\LocRes\\");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user