just testing

This commit is contained in:
Asval
2019-05-28 23:30:08 +02:00
parent 2b4b1bd347
commit e67e070632
13 changed files with 205 additions and 265 deletions

View File

@@ -7,10 +7,11 @@ using Newtonsoft.Json.Linq;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FModel
{
class DynamicPAKs
static class DynamicPAKs
{
/// <summary>
/// get url content as string with authentication
@@ -36,9 +37,6 @@ namespace FModel
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[ERROR] ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(ex.Message);
}
return content;
@@ -95,21 +93,19 @@ namespace FModel
/// <returns> the guid (ie 17722063-2246354315-4143272431-3887619937) </returns>
public static string getPakGuidFromKeychain(string[] KeychainPart)
{
StringBuilder sB = new StringBuilder();
IEnumerable<string> guid = SplitGuid(KeychainPart[0], 8);
int count = 0;
string pakguid = string.Empty;
foreach (string p in guid)
{
count += 1;
if (count != guid.Count())
pakguid += (uint)int.Parse(p, NumberStyles.HexNumber) + "-";
else
pakguid += (uint)int.Parse(p, NumberStyles.HexNumber);
if (count != guid.Count()) { sB.Append((uint)int.Parse(p, NumberStyles.HexNumber) + "-"); }
else { sB.Append((uint)int.Parse(p, NumberStyles.HexNumber)); }
}
return pakguid;
return sB.ToString();
}
}
}

View File

@@ -9,7 +9,7 @@ using System.IO;
namespace FModel
{
class ItemIcon
static class ItemIcon
{
public static string ItemIconPath { get; set; }
@@ -31,11 +31,11 @@ namespace FModel
if (theItem.DisplayAssetPath != null && theItem.DisplayAssetPath.AssetPathName.Contains("/Game/Catalog/DisplayAssets/"))
{
string catalogName = theItem.DisplayAssetPath.AssetPathName;
SearchFeaturedIcon(theItem, catalogName);
SearchFeaturedIcon(theItem, catalogName.Substring(catalogName.LastIndexOf('.') + 1));
}
else if (theItem.DisplayAssetPath == null)
{
SearchFeaturedIcon(theItem, "DA_Featured_" + ThePak.CurrentUsedItem, true);
SearchFeaturedIcon(theItem, "DA_Featured_" + ThePak.CurrentUsedItem);
}
else
{
@@ -93,9 +93,13 @@ namespace FModel
{
//MANUAL FIX
if (theItem.WeaponDefinition == "WID_Harvest_Pickaxe_NutCracker")
{
theItem.WeaponDefinition = "WID_Harvest_Pickaxe_Nutcracker";
}
if (theItem.WeaponDefinition == "WID_Harvest_Pickaxe_Wukong")
{
theItem.WeaponDefinition = "WID_Harvest_Pickaxe_WuKong";
}
string weaponFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
@@ -159,133 +163,95 @@ namespace FModel
}
/// <summary>
/// With GetItemIcon we already know if manualSeach is True or False
/// manualSearch False: extract, serialize the catalogFile and parse to get and convert the featured file to a png image
/// manualSearch True: if the catalogFile is in AllpaksDictionary (is known) do same thing as manualSearch False
/// thank to epic, this is needed
/// do not load featured icon for these files
/// </summary>
/// <param name="theItem"></param>
/// <param name="catName"></param>
/// <param name="manualSearch"></param>
public static void SearchFeaturedIcon(ItemsIdParser theItem, string catName, bool manualSearch = false)
public static void SearchFeaturedIcon(ItemsIdParser theItem, string catName)
{
if (manualSearch == false)
switch (catName)
{
ThePak.CurrentUsedItem = catName.Substring(catName.LastIndexOf('.') + 1);
if (ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_141_AshtonBoardwalk" ||
ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_150_TechOpsBlue" ||
ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_131_SpeedyMidnight" ||
ThePak.CurrentUsedItem == "DA_Featured_Pickaxe_ID_178_SpeedyMidnight")
case "DA_Featured_Glider_ID_141_AshtonBoardwalk":
case "DA_Featured_Glider_ID_150_TechOpsBlue":
case "DA_Featured_Glider_ID_131_SpeedyMidnight":
case "DA_Featured_Pickaxe_ID_178_SpeedyMidnight":
case "DA_Featured_Glider_ID_015_Brite":
case "DA_Featured_Glider_ID_016_Tactical":
case "DA_Featured_Glider_ID_017_Assassin":
case "DA_Featured_Pickaxe_ID_027_Scavenger":
case "DA_Featured_Pickaxe_ID_028_Space":
case "DA_Featured_Pickaxe_ID_029_Assassin":
case "DA_Featured_EID_Dunk":
GetItemIcon(theItem);
break;
default:
GetFeaturedItemIcon(theItem, catName);
break;
}
}
/// <summary>
/// if the catalogFile is in AllpaksDictionary (is known) extract, serialize the catalogFile and parse to get and convert the featured file to a png image
/// </summary>
/// <param name="theItem"></param>
/// <param name="catName"></param>
private static void GetFeaturedItemIcon(ItemsIdParser theItem, string catName)
{
if (ThePak.AllpaksDictionary.ContainsKey(catName))
{
ThePak.CurrentUsedItem = catName;
string catalogFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
{
catalogFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, catName);
}
else
{
string catalogFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
catalogFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, catName.Substring(catName.LastIndexOf('.') + 1));
else
catalogFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[catName.Substring(catName.LastIndexOf('.') + 1)], catName.Substring(catName.LastIndexOf('.') + 1));
catalogFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[catName], catName);
}
if (catalogFilePath != null)
if (catalogFilePath != null)
{
Checking.WasFeatured = true;
if (catalogFilePath.Contains(".uasset") || catalogFilePath.Contains(".uexp") || catalogFilePath.Contains(".ubulk"))
{
Checking.WasFeatured = true;
if (catalogFilePath.Contains(".uasset") || catalogFilePath.Contains(".uexp") || catalogFilePath.Contains(".ubulk"))
JohnWick.MyAsset = new PakAsset(catalogFilePath.Substring(0, catalogFilePath.LastIndexOf('.')));
try
{
JohnWick.MyAsset = new PakAsset(catalogFilePath.Substring(0, catalogFilePath.LastIndexOf('.')));
try
if (JohnWick.MyAsset.GetSerialized() != null)
{
if (JohnWick.MyAsset.GetSerialized() != null)
string parsedJson = JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString();
var featuredId = FeaturedParser.FromJson(parsedJson);
for (int i = 0; i < featuredId.Length; i++)
{
string parsedJson = JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString();
var featuredId = FeaturedParser.FromJson(parsedJson);
for (int i = 0; i < featuredId.Length; i++)
switch (catName)
{
//Thanks EPIC
if (ThePak.CurrentUsedItem == "DA_Featured_CID_319_Athena_Commando_F_Nautilus")
{
case "DA_Featured_Glider_ID_070_DarkViking":
case "DA_Featured_CID_319_Athena_Commando_F_Nautilus":
if (featuredId[i].TileImage != null)
{
string textureFile = featuredId[i].TileImage.ResourceObject;
ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
}
}
else
{
break;
default:
if (featuredId[i].DetailsImage != null)
{
string textureFile = featuredId[i].DetailsImage.ResourceObject;
ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
}
}
break;
}
}
}
catch (JsonSerializationException) { }
}
catch (JsonSerializationException) { }
}
}
}
if (manualSearch)
{
//Thanks EPIC
if (catName == "DA_Featured_Glider_ID_015_Brite" ||
catName == "DA_Featured_Glider_ID_016_Tactical" ||
catName == "DA_Featured_Glider_ID_017_Assassin" ||
catName == "DA_Featured_Pickaxe_ID_027_Scavenger" ||
catName == "DA_Featured_Pickaxe_ID_028_Space" ||
catName == "DA_Featured_Pickaxe_ID_029_Assassin" ||
catName == "DA_Featured_EID_Dunk")
GetItemIcon(theItem);
else if (ThePak.AllpaksDictionary.ContainsKey(catName))
{
ThePak.CurrentUsedItem = catName;
string catalogFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
catalogFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, catName);
else
catalogFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[catName], catName);
if (catalogFilePath != null)
{
Checking.WasFeatured = true;
if (catalogFilePath.Contains(".uasset") || catalogFilePath.Contains(".uexp") || catalogFilePath.Contains(".ubulk"))
{
JohnWick.MyAsset = new PakAsset(catalogFilePath.Substring(0, catalogFilePath.LastIndexOf('.')));
try
{
if (JohnWick.MyAsset.GetSerialized() != null)
{
string parsedJson = JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString();
var featuredId = FeaturedParser.FromJson(parsedJson);
for (int i = 0; i < featuredId.Length; i++)
{
//Thanks EPIC
if (ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_070_DarkViking")
{
if (featuredId[i].TileImage != null)
{
string textureFile = featuredId[i].TileImage.ResourceObject;
ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
}
}
else
{
if (featuredId[i].DetailsImage != null)
{
string textureFile = featuredId[i].DetailsImage.ResourceObject;
ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
}
}
}
}
}
catch (JsonSerializationException) { }
}
}
}
else
GetItemIcon(theItem);
}
else { GetItemIcon(theItem); }
}
/// <summary>

View File

@@ -4,7 +4,7 @@ using System.Drawing;
namespace FModel
{
class Rarity
static class Rarity
{
/// <summary>
/// check the rarity and return the right image

View File

@@ -9,7 +9,7 @@ using System.Linq;
namespace FModel
{
class JohnWick
static class JohnWick
{
public static PakAsset MyAsset;
public static PakExtractor MyExtractor;
@@ -25,10 +25,14 @@ namespace FModel
/// <returns> the mount point as string, used to create subfolders when extracting or create the tree when loading all paks </returns>
private static string GetMountPointFromDict(string currentItem, bool DynamicPak = false)
{
if (DynamicPak == true)
return ThePak.PaksMountPoint[ThePak.CurrentUsedPak ?? throw new InvalidOperationException()];
if (DynamicPak)
{
return ThePak.PaksMountPoint[ThePak.CurrentUsedPak];
}
else
return ThePak.PaksMountPoint[ThePak.AllpaksDictionary[currentItem ?? throw new InvalidOperationException()] ?? throw new InvalidOperationException()];
{
return ThePak.PaksMountPoint[ThePak.AllpaksDictionary[currentItem]];
}
}
/// <summary>
@@ -74,9 +78,13 @@ namespace FModel
string[] results;
if (currentItem.Contains("."))
{
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem));
}
else
{
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + "."));
}
string AssetPath = string.Empty;
for (int i = 0; i < results.Length; i++)
@@ -102,9 +110,13 @@ namespace FModel
{
string textureFilePath;
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
{
textureFilePath = ExtractAsset(ThePak.CurrentUsedPak, AssetName);
}
else
textureFilePath = ExtractAsset(ThePak.AllpaksDictionary[AssetName ?? throw new InvalidOperationException()], AssetName);
{
textureFilePath = ExtractAsset(ThePak.AllpaksDictionary[AssetName], AssetName);
}
string TexturePath = string.Empty;

View File

@@ -6,12 +6,12 @@ using System.Runtime.InteropServices;
namespace FModel
{
class FontUtilities
static class FontUtilities
{
public static PrivateFontCollection _pfc = new PrivateFontCollection();
public static StringFormat _centeredString = new StringFormat();
public static StringFormat _rightString = new StringFormat();
public static StringFormat _centeredStringLine = new StringFormat();
public static PrivateFontCollection pfc = new PrivateFontCollection();
public static StringFormat centeredString = new StringFormat();
public static StringFormat rightString = new StringFormat();
public static StringFormat centeredStringLine = new StringFormat();
private static int _fontLength { get; set; }
private static byte[] _fontdata { get; set; }
@@ -24,18 +24,18 @@ namespace FModel
_fontdata = Resources.BurbankBigCondensed_Bold;
IntPtr weirdData = Marshal.AllocCoTaskMem(_fontLength);
Marshal.Copy(_fontdata, 0, weirdData, _fontLength);
_pfc.AddMemoryFont(weirdData, _fontLength);
pfc.AddMemoryFont(weirdData, _fontLength);
_fontLength = Resources.BurbankBigCondensed_Black.Length;
_fontdata = Resources.BurbankBigCondensed_Black;
IntPtr weirdData2 = Marshal.AllocCoTaskMem(_fontLength);
Marshal.Copy(_fontdata, 0, weirdData2, _fontLength);
_pfc.AddMemoryFont(weirdData2, _fontLength);
pfc.AddMemoryFont(weirdData2, _fontLength);
_centeredString.Alignment = StringAlignment.Center;
_rightString.Alignment = StringAlignment.Far;
_centeredStringLine.LineAlignment = StringAlignment.Center;
_centeredStringLine.Alignment = StringAlignment.Center;
centeredString.Alignment = StringAlignment.Center;
rightString.Alignment = StringAlignment.Far;
centeredStringLine.LineAlignment = StringAlignment.Center;
centeredStringLine.Alignment = StringAlignment.Center;
}
}
}

View File

@@ -4,7 +4,7 @@ using System.Drawing.Imaging;
namespace FModel
{
class ImageUtilities
static class ImageUtilities
{
/// <summary>
/// Set the opacity of an Image -> convert Image to Bitmap, create a graphic object of the Bitmap, create a color matrix object to set the opacity

View File

@@ -7,7 +7,7 @@ using System.Security.Principal;
namespace FModel
{
class Utilities
static class Utilities
{
/// <summary>
/// OpenWithDefaultProgramAndNoFocus is used to automatically open sound file once they are converted
@@ -26,14 +26,10 @@ namespace FModel
/// </summary>
public static void CreateDefaultFolders()
{
if (!Directory.Exists(App.DefaultOutputPath + "\\Backup\\"))
Directory.CreateDirectory(App.DefaultOutputPath + "\\Backup\\");
if (!Directory.Exists(App.DefaultOutputPath + "\\Extracted\\"))
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\");
if (!Directory.Exists(App.DefaultOutputPath + "\\Icons\\"))
Directory.CreateDirectory(App.DefaultOutputPath + "\\Icons\\");
if (!Directory.Exists(App.DefaultOutputPath + "\\Sounds\\"))
Directory.CreateDirectory(App.DefaultOutputPath + "\\Sounds\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Backup\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Icons\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Sounds\\");
}
/// <summary>

View File

@@ -3,7 +3,7 @@ using System.IO;
namespace FModel
{
class ThePak
static class ThePak
{
public static string CurrentUsedPak { get; set; }
public static string CurrentUsedPakGuid { get; set; }
@@ -54,12 +54,12 @@ namespace FModel
}
}
class App
static class App
{
public static string DefaultOutputPath { get; set; }
}
class Checking
static class Checking
{
public static bool WasFeatured { get; set; }
public static int YAfterLoop { get; set; }