diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj
index 4bc02648..609cf788 100644
--- a/FModel/FModel.csproj
+++ b/FModel/FModel.csproj
@@ -128,6 +128,7 @@
+
diff --git a/FModel/Forms/IconGeneratorAssets.cs b/FModel/Forms/IconGeneratorAssets.cs
index 8aa18332..142c8b73 100644
--- a/FModel/Forms/IconGeneratorAssets.cs
+++ b/FModel/Forms/IconGeneratorAssets.cs
@@ -1,10 +1,5 @@
using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.IO;
using System.Windows.Forms;
-using FModel.Properties;
namespace FModel.Forms
{
diff --git a/FModel/MainWindow.Designer.cs b/FModel/MainWindow.Designer.cs
index 73598e66..edcd39b1 100644
--- a/FModel/MainWindow.Designer.cs
+++ b/FModel/MainWindow.Designer.cs
@@ -105,7 +105,7 @@
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(963, 17);
+ this.toolStripStatusLabel2.Size = new System.Drawing.Size(994, 17);
this.toolStripStatusLabel2.Spring = true;
//
// toolStripStatusLabel3
@@ -445,7 +445,6 @@
this.scintilla1.ScrollWidth = 496;
this.scintilla1.Size = new System.Drawing.Size(517, 304);
this.scintilla1.TabIndex = 0;
- this.scintilla1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.scintilla1_KeyDown);
//
// pictureBox1
//
diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs
index e57b96a4..1bdacf56 100644
--- a/FModel/MainWindow.cs
+++ b/FModel/MainWindow.cs
@@ -20,8 +20,6 @@ using FModel.Parser.Items;
using FModel.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using ScintillaNET;
-using ScintillaNET_FindReplaceDialog;
using Image = System.Drawing.Image;
using Settings = FModel.Properties.Settings;
@@ -29,36 +27,29 @@ namespace FModel
{
public partial class MainWindow : Form
{
- #region EVERYTHING WE NEED
- FindReplace _myFindReplace;
- public Stopwatch StopWatch;
- private static string[] _paksArray;
- public static string[] PakAsTxt;
- private static Dictionary _diffToExtract;
- private static string _backupFileName;
- private static string[] _backupDynamicKeys;
- private static List _itemsToDisplay;
- public static string ExtractedFilePath;
- public static string[] SelectedItemsArray;
- #endregion
+ private static Stopwatch StopWatch { get; set; }
+ private static string[] _paksArray { get; set; }
+ public static string[] PakAsTxt { get; set; }
+ private static Dictionary _diffToExtract { get; set; }
+ private static string _backupFileName { get; set; }
+ private static string[] _backupDynamicKeys { get; set; }
+ private static List _itemsToDisplay { get; set; }
+ public static string ExtractedFilePath { get; set; }
+ public static string[] SelectedItemsArray { get; set; }
public MainWindow()
{
InitializeComponent();
+ //FModel version
toolStripStatusLabel1.Text += @" " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, 5);
treeView1.Sort();
- //REMOVE SPACE CAUSED BY SIZING GRIP
+
+ //Remove space caused by SizingGrip
statusStrip1.Padding = new Padding(statusStrip1.Padding.Left, statusStrip1.Padding.Top, statusStrip1.Padding.Left, statusStrip1.Padding.Bottom);
- // Create instance of FindReplace with reference to a ScintillaNET control.
- _myFindReplace = new FindReplace(scintilla1); // For WinForms
- _myFindReplace.Window.StartPosition = FormStartPosition.CenterScreen;
- // Tie in FindReplace event
- _myFindReplace.KeyPressed += MyFindReplace_KeyPressed;
- // Tie in Scintilla event
- scintilla1.KeyDown += scintilla1_KeyDown;
+ MyScintilla.ScintillaInstance(scintilla1);
}
#region USEFUL METHODS
@@ -136,33 +127,6 @@ namespace FModel
}
AESKeyTextBox.Text = @"0x" + Settings.Default.AESKey;
}
- private void SetScintillaStyle()
- {
- if (InvokeRequired)
- {
- BeginInvoke(new Action(SetScintillaStyle));
- return;
- }
-
- scintilla1.Styles[Style.Json.Default].ForeColor = Color.Silver;
- scintilla1.Styles[Style.Json.BlockComment].ForeColor = Color.FromArgb(0, 128, 0);
- scintilla1.Styles[Style.Json.LineComment].ForeColor = Color.FromArgb(0, 128, 0);
- scintilla1.Styles[Style.Json.Number].ForeColor = Color.Green;
- scintilla1.Styles[Style.Json.PropertyName].ForeColor = Color.SteelBlue;
- scintilla1.Styles[Style.Json.String].ForeColor = Color.OrangeRed;
- scintilla1.Styles[Style.Json.StringEol].BackColor = Color.OrangeRed;
- scintilla1.Styles[Style.Json.Operator].ForeColor = Color.Black;
- scintilla1.Styles[Style.LineNumber].ForeColor = Color.DarkGray;
- var nums = scintilla1.Margins[1];
- nums.Width = 30;
- nums.Type = MarginType.Number;
- nums.Sensitive = true;
- nums.Mask = 0;
-
- scintilla1.ClearCmdKey(Keys.Control | Keys.F);
- scintilla1.ClearCmdKey(Keys.Control | Keys.Z);
- scintilla1.Lexer = Lexer.Json;
- }
//EVENTS
private async void MainWindow_Load(object sender, EventArgs e)
@@ -170,6 +134,7 @@ namespace FModel
AutoUpdater.Start("https://dl.dropbox.com/s/3kv2pukqu6tj1r0/FModel.xml?dl=0");
DLLImport.SetTreeViewTheme(treeView1.Handle);
+
_backupFileName = "\\FortniteGame_" + DateTime.Now.ToString("MMddyyyy") + ".txt";
// Copy user settings from previous application version if necessary
@@ -187,9 +152,10 @@ namespace FModel
Utilities.SetFolderPermission(App.DefaultOutputPath);
Utilities.JohnWickCheck();
Utilities.CreateDefaultFolders();
- SetScintillaStyle();
FontUtilities.SetFont();
});
+
+ MyScintilla.SetScintillaStyle(scintilla1);
}
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -236,44 +202,6 @@ namespace FModel
loadAllToolStripMenuItem.Text = @"Load Difference";
}
}
- private void scintilla1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Control && e.KeyCode == Keys.F)
- {
- _myFindReplace.ShowFind();
- e.SuppressKeyPress = true;
- }
- else if (e.Shift && e.KeyCode == Keys.F3)
- {
- _myFindReplace.Window.FindPrevious();
- e.SuppressKeyPress = true;
- }
- else if (e.KeyCode == Keys.F3)
- {
- _myFindReplace.Window.FindNext();
- e.SuppressKeyPress = true;
- }
- else if (e.Control && e.KeyCode == Keys.H)
- {
- _myFindReplace.ShowReplace();
- e.SuppressKeyPress = true;
- }
- else if (e.Control && e.KeyCode == Keys.I)
- {
- _myFindReplace.ShowIncrementalSearch();
- e.SuppressKeyPress = true;
- }
- else if (e.Control && e.KeyCode == Keys.G)
- {
- GoTo myGoTo = new GoTo((Scintilla)sender);
- myGoTo.ShowGoToDialog();
- e.SuppressKeyPress = true;
- }
- }
- private void MyFindReplace_KeyPressed(object sender, KeyEventArgs e)
- {
- scintilla1_KeyDown(sender, e);
- }
//FORMS
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
diff --git a/FModel/MainWindow.resx b/FModel/MainWindow.resx
index d7ba534c..93186364 100644
--- a/FModel/MainWindow.resx
+++ b/FModel/MainWindow.resx
@@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa
- CAAAAk1TRnQBSQFMAgEBAgEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ CAAAAk1TRnQBSQFMAgEBAgEAAcgBAAHIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
diff --git a/FModel/Methods/ChallengeGenerator/BundleDesign.cs b/FModel/Methods/ChallengeGenerator/BundleDesign.cs
index eaf49855..b7c0d5cf 100644
--- a/FModel/Methods/ChallengeGenerator/BundleDesign.cs
+++ b/FModel/Methods/ChallengeGenerator/BundleDesign.cs
@@ -125,14 +125,7 @@ namespace FModel
DrawingRewards.getRewards(myBundle.BundleCompletionRewards[x].Rewards[i].TemplateId, itemQuantity);
- if (compCount == "-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));
- }
- else
- {
- toDrawOn.DrawString("Complete ANY " + compCount + " CHALLENGES to earn the reward item", new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22));
- }
+ drawCompletionText(compCount);
}
else
{
@@ -152,20 +145,24 @@ namespace FModel
drawUnknownReward();
}
- if (compCount == "-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));
- }
- else
- {
- toDrawOn.DrawString("Complete ANY " + compCount + " CHALLENGES to earn the reward item", new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, theY + 22));
- }
+ drawCompletionText(compCount);
}
}
}
}
}
}
+ private static void drawCompletionText(string count)
+ {
+ 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));
+ }
+ 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));
+ }
+ }
///
/// draw the watermark at the bottom of the bundle of challenges icon
diff --git a/FModel/Methods/ChallengeGenerator/BundleInfos.cs b/FModel/Methods/ChallengeGenerator/BundleInfos.cs
index 308c3b41..7c5eeeaa 100644
--- a/FModel/Methods/ChallengeGenerator/BundleInfos.cs
+++ b/FModel/Methods/ChallengeGenerator/BundleInfos.cs
@@ -142,13 +142,17 @@ namespace FModel
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
catch (KeyNotFoundException)
{
- Console.WriteLine("Can't extract " + questFile);
+ //do not stop when questFile doesn't exist
+ //Console.WriteLine("Can't extract " + questFile);
}
}
}
diff --git a/FModel/Methods/ChallengeGenerator/DrawingRewards.cs b/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
index 89a4a86c..a58fc51e 100644
--- a/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
+++ b/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
@@ -75,6 +75,14 @@ namespace FModel
}
}
}
+
+ ///
+ /// "BannerIcons" contains all banners id, their image path and more
+ /// so basically we export and serialize "BannerIcons", locate where our banner id is, with FindTokens
+ /// after that we only have what we want with token.ToString() -> "SmallImage", "LargeImage", "asset_path_name", "CategoryRowName", "DisplayName", "DisplayDescription"
+ /// so we can just parse token.ToString() to properly get the LargeImage's asset_path_name or SmallImage's asset_path_name and draw
+ ///
+ ///
public static void DrawRewardBanner(string bannerName)
{
ItemIcon.ItemIconPath = string.Empty;
@@ -146,12 +154,7 @@ namespace FModel
BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));
GraphicsPath p = new GraphicsPath();
- Pen myPen = new Pen(Color.FromArgb(255, 143, 74, 32), 5);
- myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
- p.AddString(quantity, FontUtilities.pfc.Families[1], (int)FontStyle.Regular, 60, new Point(2322, BundleDesign.theY + 25), FontUtilities.rightString);
- BundleDesign.toDrawOn.DrawPath(myPen, p);
-
- BundleDesign.toDrawOn.FillPath(new SolidBrush(Color.FromArgb(255, 255, 219, 103)), p);
+ drawPathAndFill(p, quantity, Color.FromArgb(255, 143, 74, 32), Color.FromArgb(255, 255, 219, 103));
}
private static void drawSeasonalXp(string quantity)
{
@@ -159,12 +162,7 @@ namespace FModel
BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));
GraphicsPath p = new GraphicsPath();
- Pen myPen = new Pen(Color.FromArgb(255, 81, 131, 15), 5);
- myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
- p.AddString(quantity, FontUtilities.pfc.Families[1], (int)FontStyle.Regular, 60, new Point(2322, BundleDesign.theY + 25), FontUtilities.rightString);
- BundleDesign.toDrawOn.DrawPath(myPen, p);
-
- BundleDesign.toDrawOn.FillPath(new SolidBrush(Color.FromArgb(255, 230, 253, 177)), p);
+ drawPathAndFill(p, quantity, Color.FromArgb(255, 81, 131, 15), Color.FromArgb(255, 230, 253, 177));
}
private static void drawMtxGiveaway(string quantity)
{
@@ -172,12 +170,24 @@ namespace FModel
BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));
GraphicsPath p = new GraphicsPath();
- Pen myPen = new Pen(Color.FromArgb(255, 100, 160, 175), 5);
+ drawPathAndFill(p, quantity, Color.FromArgb(255, 100, 160, 175), Color.FromArgb(255, 220, 230, 255));
+ }
+
+ ///
+ /// define a pen to draw the outlines of a string with a color and fill with another color
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void drawPathAndFill(GraphicsPath p, string quantity, Color border, Color filled)
+ {
+ Pen myPen = new Pen(border, 5);
myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
p.AddString(quantity, FontUtilities.pfc.Families[1], (int)FontStyle.Regular, 60, new Point(2322, BundleDesign.theY + 25), FontUtilities.rightString);
BundleDesign.toDrawOn.DrawPath(myPen, p);
- BundleDesign.toDrawOn.FillPath(new SolidBrush(Color.FromArgb(255, 220, 230, 255)), p);
+ BundleDesign.toDrawOn.FillPath(new SolidBrush(filled), p);
}
}
}
diff --git a/FModel/Methods/DLLImport.cs b/FModel/Methods/DLLImport.cs
index 32849d24..845d726d 100644
--- a/FModel/Methods/DLLImport.cs
+++ b/FModel/Methods/DLLImport.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace FModel
{
- class DLLImport
+ static class DLLImport
{
///
/// used to check if internet is turned on or off
diff --git a/FModel/Methods/IconGenerator/ItemIcon.cs b/FModel/Methods/IconGenerator/ItemIcon.cs
index c3bd6fe6..bbdaf39a 100644
--- a/FModel/Methods/IconGenerator/ItemIcon.cs
+++ b/FModel/Methods/IconGenerator/ItemIcon.cs
@@ -85,7 +85,10 @@ namespace FModel
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
@@ -103,9 +106,13 @@ namespace FModel
string weaponFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
+ {
weaponFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, theItem.WeaponDefinition);
+ }
else
+ {
weaponFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[theItem.WeaponDefinition], theItem.WeaponDefinition);
+ }
if (weaponFilePath != null)
{
@@ -132,12 +139,14 @@ namespace FModel
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
- else
- SearchLargeSmallIcon(theItem);
+ else { SearchLargeSmallIcon(theItem); }
}
///
@@ -247,7 +256,10 @@ namespace FModel
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
diff --git a/FModel/Methods/ImagesMerger/ImagesMerger.cs b/FModel/Methods/ImagesMerger/ImagesMerger.cs
index 710f2848..bd9ec347 100644
--- a/FModel/Methods/ImagesMerger/ImagesMerger.cs
+++ b/FModel/Methods/ImagesMerger/ImagesMerger.cs
@@ -8,7 +8,7 @@ using System.Windows.Forms;
namespace FModel
{
- class ImagesMerger
+ static class ImagesMerger
{
///
/// open a FileDialog to choose our images to merge, add them to the list of images
diff --git a/FModel/Methods/Scintilla/MyScintilla.cs b/FModel/Methods/Scintilla/MyScintilla.cs
new file mode 100644
index 00000000..cb94b749
--- /dev/null
+++ b/FModel/Methods/Scintilla/MyScintilla.cs
@@ -0,0 +1,95 @@
+using ScintillaNET_FindReplaceDialog;
+using ScintillaNET;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace FModel
+{
+ static class MyScintilla
+ {
+ private static FindReplace _myFindReplace { get; set; }
+ private static GoTo _myGoTo { get; set; }
+
+ ///
+ /// Create instance of FindReplace with reference to a ScintillaNET control.
+ ///
+ ///
+ public static void ScintillaInstance(Scintilla theBox)
+ {
+ _myFindReplace = new FindReplace(theBox);
+ _myFindReplace.Window.StartPosition = FormStartPosition.CenterScreen;
+ _myGoTo = new GoTo(theBox);
+
+ theBox.KeyDown += KeyDown;
+ }
+
+ ///
+ /// just the allowed keybinds and what they have to do
+ ///
+ ///
+ ///
+ private static void KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Control && e.KeyCode == Keys.F)
+ {
+ _myFindReplace.ShowFind();
+ e.SuppressKeyPress = true;
+ }
+ else if (e.Shift && e.KeyCode == Keys.F3)
+ {
+ _myFindReplace.Window.FindPrevious();
+ e.SuppressKeyPress = true;
+ }
+ else if (e.KeyCode == Keys.F3)
+ {
+ _myFindReplace.Window.FindNext();
+ e.SuppressKeyPress = true;
+ }
+ else if (e.Control && e.KeyCode == Keys.H)
+ {
+ _myFindReplace.ShowReplace();
+ e.SuppressKeyPress = true;
+ }
+ else if (e.Control && e.KeyCode == Keys.I)
+ {
+ _myFindReplace.ShowIncrementalSearch();
+ e.SuppressKeyPress = true;
+ }
+ else if (e.Control && e.KeyCode == Keys.G)
+ {
+ _myGoTo.ShowGoToDialog();
+ e.SuppressKeyPress = true;
+ }
+ }
+ private static void KeyPressed(object sender, KeyEventArgs e)
+ {
+ KeyDown(sender, e);
+ }
+
+ ///
+ /// Set styles to a ScintillaNET control and disable some keybinds
+ ///
+ ///
+ public static void SetScintillaStyle(Scintilla theBox)
+ {
+ theBox.Styles[Style.Json.Default].ForeColor = Color.Silver;
+ theBox.Styles[Style.Json.BlockComment].ForeColor = Color.FromArgb(0, 128, 0);
+ theBox.Styles[Style.Json.LineComment].ForeColor = Color.FromArgb(0, 128, 0);
+ theBox.Styles[Style.Json.Number].ForeColor = Color.Green;
+ theBox.Styles[Style.Json.PropertyName].ForeColor = Color.SteelBlue;
+ theBox.Styles[Style.Json.String].ForeColor = Color.OrangeRed;
+ theBox.Styles[Style.Json.StringEol].BackColor = Color.OrangeRed;
+ theBox.Styles[Style.Json.Operator].ForeColor = Color.Black;
+ theBox.Styles[Style.LineNumber].ForeColor = Color.DarkGray;
+ var nums = theBox.Margins[1];
+ nums.Width = 30;
+ nums.Type = MarginType.Number;
+ nums.Sensitive = true;
+ nums.Mask = 0;
+
+ theBox.ClearCmdKey(Keys.Control | Keys.F);
+ theBox.ClearCmdKey(Keys.Control | Keys.Z);
+ theBox.Lexer = Lexer.Json;
+ }
+ }
+}