diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index c96ec863..70a2527d 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -12,6 +12,8 @@ 512 true true + + x64 @@ -87,7 +89,7 @@ DLLs\csharp-wick.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll False diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 6d8d9d71..8089ed61 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -40,8 +40,8 @@ namespace FModel #region EVERYTHING WE NEED FindReplace _myFindReplace; public Stopwatch StopWatch; - public PakAsset MyAsset; - public PakExtractor MyExtractor; + public static PakAsset MyAsset; + public static PakExtractor MyExtractor; private static string[] _paksArray; public static string[] pakAsTxt; public static Dictionary AllpaksDictionary; @@ -1273,21 +1273,22 @@ namespace FModel #region EXTRACT BUTTON //METHODS - private string ExtractAsset(string currentPak, string currentItem) + public static string ExtractAsset(string currentPak, string currentItem) { string toReturn = string.Empty; MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey); + string[] myArray = MyExtractor.GetFileList().ToArray(); string[] results = null; if (currentItem.Contains(".")) - results = Array.FindAll(MyExtractor.GetFileList().ToArray(), s => s.Contains("/" + currentItem)); + results = Array.FindAll(myArray, s => s.Contains("/" + currentItem)); else - results = Array.FindAll(MyExtractor.GetFileList().ToArray(), s => s.Contains("/" + currentItem + ".")); + results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + ".")); for (int i = 0; i < results.Length; i++) { - int index = Array.IndexOf(MyExtractor.GetFileList().ToArray(), results[i]); + int index = Array.IndexOf(myArray, results[i]); uint y = (uint)index; byte[] b = MyExtractor.GetData(y); @@ -1296,12 +1297,14 @@ namespace FModel { Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i].Substring(0, results[i].LastIndexOf("/"))); File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i], b); + toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i]; } else { Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i].Substring(0, results[i].LastIndexOf("/"))); File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i], b); + toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i]; } } @@ -1365,7 +1368,7 @@ namespace FModel JsonParseFile(); } if (ExtractedFilePath.Contains(".ufont")) - ConvertToOtf(ExtractedFilePath); + ConvertToTtf(ExtractedFilePath); if (ExtractedFilePath.Contains(".ini")) { Invoke(new Action(() => @@ -1451,14 +1454,7 @@ namespace FModel Graphics g = Graphics.FromImage(bmp); g.TextRenderingHint = TextRenderingHint.AntiAlias; - if (theItem.Series != null) - Rarity.GetSeriesRarity(theItem, g); - else - // Special ammo force-rarity check - if (SpecialMode == "ammo") - Rarity.GetItemRarity(theItem, g, "ammo"); - else - Rarity.GetItemRarity(theItem, g); + Rarity.DrawRarity(theItem, g, SpecialMode); ItemIconPath = string.Empty; if (Settings.Default.loadFeaturedImage == false) @@ -3672,9 +3668,9 @@ namespace FModel OpenWithDefaultProgramAndNoFocus(UnrealEngineDataToOgg.ConvertToOgg(soundPathToConvert)); UpdateConsole("Opening " + CurrentUsedItem + ".ogg", Color.FromArgb(255, 66, 244, 66), "Success"); } - private void ConvertToOtf(string file) + private void ConvertToTtf(string file) { - File.Move(file, Path.ChangeExtension(file, ".otf") ?? throw new InvalidOperationException()); + File.Move(file, Path.ChangeExtension(file, ".ttf") ?? throw new InvalidOperationException()); UpdateConsole(CurrentUsedItem + " successfully converter to a font", Color.FromArgb(255, 66, 244, 66), "Success"); } diff --git a/FModel/Methods/IconGenerator/Rarity.cs b/FModel/Methods/IconGenerator/Rarity.cs index 3b7c95aa..1e469c75 100644 --- a/FModel/Methods/IconGenerator/Rarity.cs +++ b/FModel/Methods/IconGenerator/Rarity.cs @@ -6,52 +6,60 @@ namespace FModel { class Rarity { - public static void GetItemRarity(ItemsIdParser theItem, Graphics toDrawOn, string SpecialMode = null) + public static Image GetRarityImage(ItemsIdParser theItem) { - if (theItem.Rarity == "EFortRarity::Transcendent") + switch (theItem.Rarity) { - Image rarityBg = Resources.T512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else if (theItem.Rarity == "EFortRarity::Mythic") - { - Image rarityBg = Resources.M512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else if (theItem.Rarity == "EFortRarity::Legendary") - { - Image rarityBg = Resources.L512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else if (theItem.Rarity == "EFortRarity::Epic" || theItem.Rarity == "EFortRarity::Quality") - { - Image rarityBg = Resources.E512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else if (theItem.Rarity == "EFortRarity::Rare") - { - Image rarityBg = Resources.R512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else if (theItem.Rarity == "EFortRarity::Common" || SpecialMode == "ammo") // Force common rarity if ammo, as ammo is always common in FN - { - Image rarityBg = Resources.C512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); - } - else - { - Image rarityBg = Resources.U512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); + case "EFortRarity::Transcendent": + return Resources.T512; + case "EFortRarity::Mythic": + return Resources.M512; + case "EFortRarity::Legendary": + return Resources.L512; + case "EFortRarity::Epic": + return Resources.E512; + case "EFortRarity::Quality": + return Resources.E512; + case "EFortRarity::Rare": + return Resources.R512; + case "EFortRarity::Common": + return Resources.C512; + default: + return Resources.U512; } } - - public static void GetSeriesRarity(ItemsIdParser theItem, Graphics toDrawOn) + public static Image GetSeriesImage(ItemsIdParser theItem) { - if (theItem.Series == "MarvelSeries") + switch (theItem.Series) { - Image rarityBg = Resources.Marvel512; - toDrawOn.DrawImage(rarityBg, new Point(0, 0)); + case "MarvelSeries": + return Resources.Marvel512; + default: + return GetRarityImage(theItem); } } + public static Image GetSpecialModeImage(ItemsIdParser theItem, string SpecialMode) + { + switch (SpecialMode) + { + case "ammo": + return Resources.C512; + default: + return GetRarityImage(theItem); + } + } + public static void DrawRarity(ItemsIdParser theItem, Graphics toDrawOn, string SpecialMode = null) + { + Image rarityBg; + + if (theItem.Series != null) + rarityBg = GetSeriesImage(theItem); + else if (SpecialMode != null) + rarityBg = GetSpecialModeImage(theItem, SpecialMode); + else + rarityBg = GetRarityImage(theItem); + + toDrawOn.DrawImage(rarityBg, new Point(0, 0)); + } } } diff --git a/FModel/Resources/I512.png b/FModel/Resources/I512.png deleted file mode 100644 index 5cfa01dc..00000000 Binary files a/FModel/Resources/I512.png and /dev/null differ diff --git a/FModel/packages.config b/FModel/packages.config index 297ef202..75ac238e 100644 --- a/FModel/packages.config +++ b/FModel/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file