diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj
index ea713fbe..4bc02648 100644
--- a/FModel/FModel.csproj
+++ b/FModel/FModel.csproj
@@ -126,6 +126,8 @@
+
+
diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs
index 70fd5a5c..e57b96a4 100644
--- a/FModel/MainWindow.cs
+++ b/FModel/MainWindow.cs
@@ -6,21 +6,17 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
-using System.Globalization;
using System.IO;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using AutoUpdaterDotNET;
using csharp_wick;
using FModel.Converter;
using FModel.Forms;
-using FModel.Parser.Banners;
using FModel.Parser.Challenges;
using FModel.Methods.BackupPAKs.Parser.AESKeyParser;
using FModel.Parser.Items;
-using FModel.Parser.Quests;
using FModel.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -38,29 +34,12 @@ namespace FModel
public Stopwatch StopWatch;
private static string[] _paksArray;
public static string[] PakAsTxt;
- private static Dictionary _questStageDict;
private static Dictionary _diffToExtract;
private static string _backupFileName;
private static string[] _backupDynamicKeys;
private static List _itemsToDisplay;
public static string ExtractedFilePath;
public static string[] SelectedItemsArray;
- public static string[] SelectedChallengesArray;
- #endregion
-
- #region DLLIMPORT
- [DllImport("wininet.dll")]
- private extern static bool InternetGetConnectedState(out int description, int reservedValue);
- public static bool IsInternetAvailable()
- {
- return InternetGetConnectedState(description: out _, reservedValue: 0);
- }
- [DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
- private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);
- public static void SetTreeViewTheme(IntPtr treeHandle)
- {
- SetWindowTheme(treeHandle, "explorer", null);
- }
#endregion
public MainWindow()
@@ -190,7 +169,7 @@ namespace FModel
{
AutoUpdater.Start("https://dl.dropbox.com/s/3kv2pukqu6tj1r0/FModel.xml?dl=0");
- SetTreeViewTheme(treeView1.Handle);
+ DLLImport.SetTreeViewTheme(treeView1.Handle);
_backupFileName = "\\FortniteGame_" + DateTime.Now.ToString("MMddyyyy") + ".txt";
// Copy user settings from previous application version if necessary
@@ -613,8 +592,7 @@ namespace FModel
{
_backupDynamicKeys = null;
- bool connection = IsInternetAvailable();
- if (connection && (!string.IsNullOrWhiteSpace(Settings.Default.eEmail) || !string.IsNullOrWhiteSpace(Settings.Default.ePassword)))
+ if (DLLImport.IsInternetAvailable() && (!string.IsNullOrWhiteSpace(Settings.Default.eEmail) || !string.IsNullOrWhiteSpace(Settings.Default.ePassword)))
{
string myContent = DynamicPAKs.GetEndpoint("https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/storefront/v2/keychain", true);
@@ -715,7 +693,6 @@ namespace FModel
{
CreatePakList(null, false, true, true);
- _questStageDict = new Dictionary();
Invoke(new Action(() =>
{
ExtractButton.Enabled = false;
@@ -1726,7 +1703,6 @@ namespace FModel
{
scintilla1.Text = "";
pictureBox1.Image = null;
- _questStageDict = new Dictionary();
ExtractButton.Enabled = false;
OpenImageButton.Enabled = false;
StopButton.Enabled = true;
@@ -1750,104 +1726,6 @@ namespace FModel
#endregion
#region IMAGES SAVE & MERGE
- //METHODS
- private void AskMergeImages()
- {
- if (string.IsNullOrEmpty(Settings.Default.mergerFileName))
- {
- MessageBox.Show(@"Please, set a name to your Merger file before trying to merge images
-
-Steps:
- - Load
- - Settings", @"Merger File Name Missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- else
- {
- OpenFileDialog theDialog = new OpenFileDialog();
- theDialog.Multiselect = true;
- theDialog.InitialDirectory = App.DefaultOutputPath + "\\Icons\\";
- theDialog.Title = @"Choose your images";
- theDialog.Filter = @"PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*";
-
- Invoke(new Action(() =>
- {
- if (theDialog.ShowDialog() == DialogResult.OK)
- {
- List selectedImages = new List();
- foreach (var files in theDialog.FileNames)
- {
- selectedImages.Add(Image.FromFile(files));
- }
-
- MergeSelected(selectedImages);
- }
- }));
- }
- }
- private void MergeSelected(List mySelectedImages)
- {
- if (Settings.Default.mergerImagesRow == 0)
- {
- Settings.Default.mergerImagesRow = 7;
- Settings.Default.Save();
- }
-
- int numperrow = Settings.Default.mergerImagesRow;
- var w = 530 * numperrow;
- if (mySelectedImages.Count * 530 < 530 * numperrow)
- {
- w = mySelectedImages.Count * 530;
- }
-
- int h = int.Parse(Math.Ceiling(double.Parse(mySelectedImages.Count.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 530;
- Bitmap bmp = new Bitmap(w - 8, h - 8);
-
- var num = 1;
- var curW = 0;
- var curH = 0;
-
- for (int i = 0; i < mySelectedImages.Count; i++)
- {
- using (Graphics g = Graphics.FromImage(bmp))
- {
- g.DrawImage(ImageUtilities.ResizeImage(mySelectedImages[i], 522, 522), new PointF(curW, curH));
- if (num % numperrow == 0)
- {
- curW = 0;
- curH += 530;
- num += 1;
- }
- else
- {
- curW += 530;
- num += 1;
- }
- }
- }
- bmp.Save(App.DefaultOutputPath + "\\" + Settings.Default.mergerFileName + ".png", ImageFormat.Png);
-
- OpenMerged(bmp);
- }
- private void OpenMerged(Bitmap mergedImage)
- {
- if (mergedImage != null)
- {
- var newForm = new Form();
- PictureBox pb = new PictureBox();
- pb.Dock = DockStyle.Fill;
- pb.Image = mergedImage;
- pb.SizeMode = PictureBoxSizeMode.Zoom;
-
- newForm.WindowState = FormWindowState.Maximized;
- newForm.Size = mergedImage.Size;
- newForm.Icon = Resources.FModel;
- newForm.Text = App.DefaultOutputPath + @"\" + Settings.Default.mergerFileName + @".png";
- newForm.StartPosition = FormStartPosition.CenterScreen;
- newForm.Controls.Add(pb);
- newForm.Show();
- }
- }
-
//EVENTS
private void OpenImageButton_Click(object sender, EventArgs e)
{
@@ -1885,11 +1763,9 @@ Steps:
}
}
}
- private async void mergeImagesToolStripMenuItem_Click(object sender, EventArgs e)
+ private void mergeImagesToolStripMenuItem_Click(object sender, EventArgs e)
{
- await Task.Run(() => {
- AskMergeImages();
- });
+ ImagesMerger.AskMergeImages();
}
#endregion
}
diff --git a/FModel/Methods/ChallengeGenerator/BundleDesign.cs b/FModel/Methods/ChallengeGenerator/BundleDesign.cs
index edeec856..eaf49855 100644
--- a/FModel/Methods/ChallengeGenerator/BundleDesign.cs
+++ b/FModel/Methods/ChallengeGenerator/BundleDesign.cs
@@ -17,7 +17,22 @@ namespace FModel
public static ItemsIdParser myItem { get; set; }
///
- /// draw the pretty header if DisplayStyle exist, else the shitty background
+ /// get a random color in case DisplayStyle doesn't exist in drawBackground()
+ ///
+ ///
+ private static Color getRandomColor()
+ {
+ Random rnd = new Random();
+
+ int Red = rnd.Next(50, 200);
+ int Green = rnd.Next(50, 200);
+ int Blue = rnd.Next(50, 200);
+
+ return Color.FromArgb(255, Red, Green, Blue);
+ }
+
+ ///
+ /// draw the pretty header if DisplayStyle exist, else the pretty header but with random colors
///
///
///
@@ -49,7 +64,11 @@ namespace FModel
//image
string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.'));
- Image challengeIcon = new Bitmap(JohnWick.AssetToTexture2D(textureFile));
+ Image challengeIcon;
+ using (var bmpTemp = new Bitmap(JohnWick.AssetToTexture2D(textureFile)))
+ {
+ challengeIcon = new Bitmap(bmpTemp);
+ }
toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 282, 282), new Point(40, 0));
//fill the rest
@@ -57,13 +76,27 @@ namespace FModel
}
else
{
- toDrawOn.DrawImage(new Bitmap(Resources.Quest), new Point(0, 0));
+ Color myBaseColor = getRandomColor();
+
+ //main header
+ toDrawOn.FillRectangle(new SolidBrush(myBaseColor), new Rectangle(0, 0, myBitmap.Width, 281));
+
+ //gradient at left and right main header
+ LinearGradientBrush linGrBrush_left = new LinearGradientBrush(new Point(0, 282 / 2), new Point(282, 282 / 2),
+ ControlPaint.Light(myBaseColor, (float)0.3), myBaseColor);
+ toDrawOn.FillRectangle(linGrBrush_left, new Rectangle(0, 0, 282, 282));
+ LinearGradientBrush linGrBrush_right = new LinearGradientBrush(new Point(2500, 282 / 2), new Point(1500, 282 / 2),
+ ControlPaint.Light(myBaseColor, (float)0.3), myBaseColor);
+ toDrawOn.FillRectangle(linGrBrush_right, new Rectangle(1500, 0, 1000, 282));
+
+ //fill the rest
+ toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.1)), new Rectangle(0, 271, myBitmap.Width, myBitmap.Height));
//last folder
- toDrawOn.DrawString(BundleInfos.getLastFolder(BundlePath), new Font(FontUtilities.pfc.Families[1], 42), new SolidBrush(Color.FromArgb(255, 149, 213, 255)), new Point(340, 40));
+ toDrawOn.DrawString(BundleInfos.getLastFolder(BundlePath), new Font(FontUtilities.pfc.Families[1], 42), new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.05)), new Point(40, 40));
//name
- toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(325, 70));
+ toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(25, 70));
}
}
diff --git a/FModel/Methods/ChallengeGenerator/DrawingRewards.cs b/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
index 891ac5cf..89a4a86c 100644
--- a/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
+++ b/FModel/Methods/ChallengeGenerator/DrawingRewards.cs
@@ -63,24 +63,14 @@ namespace FModel
{
ItemIcon.SearchAthIteDefIcon(itemId[i]);
- if (File.Exists(ItemIcon.ItemIconPath))
- {
- Image itemIcon;
- using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
- {
- itemIcon = new Bitmap(bmpTemp);
- }
- BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
- }
- else
- {
- Image itemIcon = Resources.unknown512;
- BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
- }
+ drawIcon();
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
@@ -121,28 +111,35 @@ namespace FModel
ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
}
- if (File.Exists(ItemIcon.ItemIconPath))
- {
- Image itemIcon;
- using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
- {
- itemIcon = new Bitmap(bmpTemp);
- }
- BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
- }
- else
- {
- Image itemIcon = Resources.unknown512;
- BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
- }
+ drawIcon();
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
}
}
+ private static void drawIcon()
+ {
+ if (File.Exists(ItemIcon.ItemIconPath))
+ {
+ Image itemIcon;
+ using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
+ {
+ itemIcon = new Bitmap(bmpTemp);
+ }
+ BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
+ }
+ else
+ {
+ Image itemIcon = Resources.unknown512;
+ BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
+ }
+ }
private static void drawBattleStar(string quantity)
{
Image rewardIcon = Resources.T_FNBR_BattlePoints_L;
diff --git a/FModel/Methods/DLLImport.cs b/FModel/Methods/DLLImport.cs
new file mode 100644
index 00000000..32849d24
--- /dev/null
+++ b/FModel/Methods/DLLImport.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FModel
+{
+ class DLLImport
+ {
+ ///
+ /// used to check if internet is turned on or off
+ ///
+ ///
+ ///
+ /// boolean about the internet
+ [DllImport("wininet.dll")]
+ private extern static bool InternetGetConnectedState(out int description, int reservedValue);
+ public static bool IsInternetAvailable()
+ {
+ return InternetGetConnectedState(description: out _, reservedValue: 0);
+ }
+
+ ///
+ /// used to set the theme on the TreeView
+ ///
+ ///
+ ///
+ ///
+ [DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
+ private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);
+ public static void SetTreeViewTheme(IntPtr treeHandle)
+ {
+ SetWindowTheme(treeHandle, "explorer", null);
+ }
+ }
+}
diff --git a/FModel/Methods/IconGenerator/ItemIcon.cs b/FModel/Methods/IconGenerator/ItemIcon.cs
index 5c98e51c..c3bd6fe6 100644
--- a/FModel/Methods/IconGenerator/ItemIcon.cs
+++ b/FModel/Methods/IconGenerator/ItemIcon.cs
@@ -264,9 +264,13 @@ namespace FModel
{
string ammoFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
+ {
ammoFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));
+ }
else
+ {
ammoFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[ammoFile.Substring(ammoFile.LastIndexOf('.') + 1)], ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));
+ }
if (ammoFilePath != null)
{
@@ -300,7 +304,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
new file mode 100644
index 00000000..710f2848
--- /dev/null
+++ b/FModel/Methods/ImagesMerger/ImagesMerger.cs
@@ -0,0 +1,117 @@
+using FModel.Properties;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Globalization;
+using System.Windows.Forms;
+
+namespace FModel
+{
+ class ImagesMerger
+ {
+ ///
+ /// open a FileDialog to choose our images to merge, add them to the list of images
+ /// use this list to merge, with MergeSelected()
+ ///
+ public static void AskMergeImages()
+ {
+ if (string.IsNullOrEmpty(Settings.Default.mergerFileName))
+ {
+ Settings.Default.mergerFileName = "Merger";
+ Settings.Default.Save();
+ }
+
+ OpenFileDialog theDialog = new OpenFileDialog();
+ theDialog.Multiselect = true;
+ theDialog.InitialDirectory = App.DefaultOutputPath + "\\Icons\\";
+ theDialog.Title = @"Choose your images";
+ theDialog.Filter = @"PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|All Files (*.*)|*.*";
+
+ if (theDialog.ShowDialog() == DialogResult.OK)
+ {
+ List selectedImages = new List();
+ foreach (var files in theDialog.FileNames)
+ {
+ selectedImages.Add(Image.FromFile(files));
+ }
+
+ MergeSelected(selectedImages);
+ }
+ }
+
+ ///
+ /// take all the selected images and draw them one after the other depending on mergerImagesRow
+ /// at the end, save and open the generated image with OpenMerged()
+ ///
+ ///
+ private static void MergeSelected(List mySelectedImages)
+ {
+ if (Settings.Default.mergerImagesRow == 0)
+ {
+ Settings.Default.mergerImagesRow = 7;
+ Settings.Default.Save();
+ }
+
+ int numperrow = Settings.Default.mergerImagesRow;
+ var w = 530 * numperrow;
+ if (mySelectedImages.Count * 530 < 530 * numperrow)
+ {
+ w = mySelectedImages.Count * 530;
+ }
+
+ int h = int.Parse(Math.Ceiling(double.Parse(mySelectedImages.Count.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 530;
+ Bitmap bmp = new Bitmap(w - 8, h - 8);
+
+ var num = 1;
+ var curW = 0;
+ var curH = 0;
+
+ for (int i = 0; i < mySelectedImages.Count; i++)
+ {
+ using (Graphics g = Graphics.FromImage(bmp))
+ {
+ g.DrawImage(ImageUtilities.ResizeImage(mySelectedImages[i], 522, 522), new PointF(curW, curH));
+ if (num % numperrow == 0)
+ {
+ curW = 0;
+ curH += 530;
+ num += 1;
+ }
+ else
+ {
+ curW += 530;
+ num += 1;
+ }
+ }
+ }
+ bmp.Save(App.DefaultOutputPath + "\\" + Settings.Default.mergerFileName + ".png", ImageFormat.Png);
+
+ OpenMerged(bmp);
+ }
+
+ ///
+ /// if bitmap exist, open a new form in fullscreen and display the bitmap in a picturebox
+ ///
+ ///
+ private static void OpenMerged(Bitmap mergedImage)
+ {
+ if (mergedImage != null)
+ {
+ var newForm = new Form();
+ PictureBox pb = new PictureBox();
+ pb.Dock = DockStyle.Fill;
+ pb.Image = mergedImage;
+ pb.SizeMode = PictureBoxSizeMode.Zoom;
+
+ newForm.WindowState = FormWindowState.Maximized;
+ newForm.Size = mergedImage.Size;
+ newForm.Icon = Resources.FModel;
+ newForm.Text = App.DefaultOutputPath + @"\" + Settings.Default.mergerFileName + @".png";
+ newForm.StartPosition = FormStartPosition.CenterScreen;
+ newForm.Controls.Add(pb);
+ newForm.Show();
+ }
+ }
+ }
+}
diff --git a/FModel/Methods/JohnWick/JohnWick.cs b/FModel/Methods/JohnWick/JohnWick.cs
index 1bd0ce43..1aa142f1 100644
--- a/FModel/Methods/JohnWick/JohnWick.cs
+++ b/FModel/Methods/JohnWick/JohnWick.cs
@@ -161,7 +161,10 @@ namespace FModel
}
}
}
- catch (JsonSerializationException) { }
+ catch (JsonSerializationException)
+ {
+ //do not crash when JsonSerialization does weird stuff
+ }
}
return TexturePath;
}
diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs
index 951cb282..170fccad 100644
--- a/FModel/Properties/Resources.Designer.cs
+++ b/FModel/Properties/Resources.Designer.cs
@@ -200,16 +200,6 @@ namespace FModel.Properties {
}
}
- ///
- /// Recherche une ressource localisée de type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Quest {
- get {
- object obj = ResourceManager.GetObject("Quest", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
///
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
///
diff --git a/FModel/Properties/Resources.resx b/FModel/Properties/Resources.resx
index af9b14ea..3bb7f365 100644
--- a/FModel/Properties/Resources.resx
+++ b/FModel/Properties/Resources.resx
@@ -169,9 +169,6 @@
..\Resources\FModel_Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Quest.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\T-Icon-Adaptive-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
diff --git a/README.md b/README.md
index 6235541b..2590fafe 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@
- Asset is a **_Sound_**:
- Try to convert the Asset to OGG and play the sound
- Asset is a **_Bundle Of Challenges_**:
- - Try to create an [Icon](https://i.imgur.com/1Uzrlb0.png) with all **Challenges' Description**, **Count** and the **Reward**
+ - Try to create an [Icon](https://i.imgur.com/pUVxUih.png) with all **Challenges' Description**, **Count** and the **Reward**
- Asset is a **_Font_**:
- Try to convert the Asset to OTF