mirror of
https://github.com/4sval/FModel.git
synced 2026-09-25 10:39:14 -05:00
speed improvements especially for switch pak file
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user