mirror of
https://github.com/4sval/FModel.git
synced 2026-08-25 02:44:29 -05:00
speed improvements especially for switch pak file
This commit is contained in:
@@ -468,29 +468,12 @@ namespace FModel
|
||||
|
||||
#region PAKLIST & FILL TREE
|
||||
//METHODS
|
||||
private string ReadPakGuid(string pakPath)
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(pakPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 61 - 160, SeekOrigin.Begin);
|
||||
uint g1 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 57 - 160, SeekOrigin.Begin);
|
||||
uint g2 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 53 - 160, SeekOrigin.Begin);
|
||||
uint g3 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 49 - 160, SeekOrigin.Begin);
|
||||
uint g4 = reader.ReadUInt32();
|
||||
|
||||
var guid = g1 + "-" + g2 + "-" + g3 + "-" + g4;
|
||||
return guid;
|
||||
}
|
||||
}
|
||||
private void RegisterPaKsinDict(string[] allYourPaKs, ToolStripItemClickedEventArgs theSinglePak = null, bool loadAllPaKs = false)
|
||||
{
|
||||
for (int i = 0; i < allYourPaKs.Length; i++)
|
||||
{
|
||||
string arCurrentUsedPak = allYourPaKs[i]; //SET CURRENT PAK
|
||||
string arCurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak); //SET CURRENT PAK GUID
|
||||
string arCurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak); //SET CURRENT PAK GUID
|
||||
|
||||
if (arCurrentUsedPakGuid == "0-0-0-0") //NO DYNAMIC PAK IN DICTIONARY
|
||||
{
|
||||
@@ -546,16 +529,16 @@ namespace FModel
|
||||
if (theSinglePak != null)
|
||||
{
|
||||
ThePak.CurrentUsedPak = theSinglePak.ClickedItem.Text;
|
||||
ThePak.CurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak);
|
||||
ThePak.CurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak);
|
||||
|
||||
if (arCurrentUsedPak == theSinglePak.ClickedItem.Text && JohnWick.MyExtractor.GetFileList() != null)
|
||||
PakAsTxt = JohnWick.MyExtractor.GetFileList().ToArray();
|
||||
}
|
||||
}
|
||||
if (theSinglePak != null && ReadPakGuid(Settings.Default.PAKsPath + "\\" + theSinglePak.ClickedItem.Text) != "0-0-0-0") //LOADING DYNAMIC PAK
|
||||
if (theSinglePak != null && ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + theSinglePak.ClickedItem.Text) != "0-0-0-0") //LOADING DYNAMIC PAK
|
||||
{
|
||||
ThePak.CurrentUsedPak = theSinglePak.ClickedItem.Text;
|
||||
ThePak.CurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak);
|
||||
ThePak.CurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -774,7 +757,7 @@ namespace FModel
|
||||
for (int i = 0; i < allYourPaKs.Length; i++)
|
||||
{
|
||||
string arCurrentUsedPak = allYourPaKs[i]; //SET CURRENT PAK
|
||||
string arCurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak); //SET CURRENT PAK GUID
|
||||
string arCurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak); //SET CURRENT PAK GUID
|
||||
|
||||
if (arCurrentUsedPakGuid == "0-0-0-0") //NO DYNAMIC PAK
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace FModel
|
||||
{
|
||||
public static PakAsset MyAsset;
|
||||
public static PakExtractor MyExtractor;
|
||||
private static string[] myArray { get; set; }
|
||||
private static string currentPakToCheck { get; set; }
|
||||
|
||||
private static string GetMountPointFromDict(string currentItem, bool DynamicPak = false)
|
||||
{
|
||||
@@ -41,8 +43,11 @@ namespace FModel
|
||||
|
||||
public static string ExtractAsset(string currentPak, string currentItem)
|
||||
{
|
||||
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
|
||||
string[] myArray = MyExtractor.GetFileList().ToArray();
|
||||
if (currentPak != currentPakToCheck)
|
||||
{
|
||||
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
|
||||
myArray = MyExtractor.GetFileList().ToArray();
|
||||
}
|
||||
|
||||
string[] results;
|
||||
if (currentItem.Contains("."))
|
||||
@@ -60,6 +65,8 @@ namespace FModel
|
||||
|
||||
AssetPath = WriteFile(currentItem, results[i], b).Replace("/", "\\");
|
||||
}
|
||||
|
||||
currentPakToCheck = currentPak;
|
||||
return AssetPath;
|
||||
}
|
||||
public static string AssetToTexture2D(string AssetName)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
@@ -10,6 +11,34 @@ namespace FModel
|
||||
|
||||
public static Dictionary<string, string> PaksMountPoint { get; set; }
|
||||
public static Dictionary<string, string> AllpaksDictionary { get; set; }
|
||||
|
||||
public static string ReadPakGuid(string pakPath)
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(pakPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 61 - 160, SeekOrigin.Begin);
|
||||
uint g1 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 57 - 160, SeekOrigin.Begin);
|
||||
uint g2 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 53 - 160, SeekOrigin.Begin);
|
||||
uint g3 = reader.ReadUInt32();
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 49 - 160, SeekOrigin.Begin);
|
||||
uint g4 = reader.ReadUInt32();
|
||||
|
||||
var guid = g1 + "-" + g2 + "-" + g3 + "-" + g4;
|
||||
return guid;
|
||||
}
|
||||
}
|
||||
public static string ReadPakVersion(string pakPath)
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(pakPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
reader.BaseStream.Seek(reader.BaseStream.Length - 40 - 160, SeekOrigin.Begin);
|
||||
uint guid = reader.ReadUInt32();
|
||||
|
||||
return guid.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class App
|
||||
|
||||
@@ -67,7 +67,7 @@ Also if you find this project useful, feel free to give it a :star: thank you :k
|
||||
8. Load difference between current .PAK files and backup file
|
||||
9. Load, Extract and Save Assets automatically between current .PAK files and backup file
|
||||
### What i'm using
|
||||
- [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse) - Custom Version With Output Control And No `key.txt`
|
||||
- C# bindings for the [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse)
|
||||
- [AutoUpdater.NET](https://github.com/ravibpatel/AutoUpdater.NET)
|
||||
- [JSON Parser](https://app.quicktype.io/)
|
||||
- [ScintillaNET](https://www.nuget.org/packages/jacobslusser.ScintillaNET)
|
||||
|
||||
Reference in New Issue
Block a user