mirror of
https://github.com/4sval/FModel.git
synced 2026-04-01 14:45:45 -05:00
FModel 3.1.0.3
This commit is contained in:
parent
a0f2bb5229
commit
2c3a9b7ec3
|
|
@ -8,8 +8,8 @@
|
|||
<StartupObject>FModel.App</StartupObject>
|
||||
<Authors>Asval</Authors>
|
||||
<Company></Company>
|
||||
<AssemblyVersion>3.1.0.2</AssemblyVersion>
|
||||
<FileVersion>3.1.0.2</FileVersion>
|
||||
<AssemblyVersion>3.1.0.3</AssemblyVersion>
|
||||
<FileVersion>3.1.0.3</FileVersion>
|
||||
<PackageIcon>FModel.ico</PackageIcon>
|
||||
<PackageIconUrl />
|
||||
<PackageProjectUrl>https://github.com/iAmAsval/FModel</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ namespace FModel.Grabber.Aes
|
|||
if (NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
(_, string fortniteVersion, string _) = Utils.Paks.GetFortnitePakFilesPath();
|
||||
BenResponse data = !string.IsNullOrEmpty(fortniteVersion)
|
||||
? await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES, fortniteVersion)
|
||||
.ConfigureAwait(false)
|
||||
: await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES).ConfigureAwait(false);
|
||||
BenResponse data = await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES, fortniteVersion).ConfigureAwait(false);
|
||||
return data;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
Style="{StaticResource {x:Type Window}}"
|
||||
Title="FModel"
|
||||
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={utils:Screens}, ConverterParameter='0.80' }"
|
||||
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.75' }"
|
||||
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.70' }"
|
||||
WindowStartupLocation="CenterScreen" Icon="FModel.ico"
|
||||
Loaded="OnLoaded" Closing="OnClosing">
|
||||
<Window.CommandBindings>
|
||||
|
|
|
|||
|
|
@ -443,11 +443,11 @@ namespace PakReader.Pak
|
|||
{
|
||||
if (!string.IsNullOrEmpty(path) && Entries.TryGetValue(CaseSensitive ? path : path.ToLowerInvariant(), out var entry))
|
||||
{
|
||||
ret1 = entry.GetData(Stream, AesKey);
|
||||
ret1 = entry.GetData(Stream, AesKey, Info.CompressionMethods);
|
||||
if (entry.HasUexp())
|
||||
{
|
||||
ret2 = entry.Uexp.GetData(Stream, AesKey);
|
||||
ret3 = entry.HasUbulk() ? entry.Ubulk.GetData(Stream, AesKey) : null;
|
||||
ret2 = entry.Uexp.GetData(Stream, AesKey, Info.CompressionMethods);
|
||||
ret3 = entry.HasUbulk() ? entry.Ubulk.GetData(Stream, AesKey, Info.CompressionMethods) : null;
|
||||
return true;
|
||||
}
|
||||
else // return a fail but keep the uasset data
|
||||
|
|
@ -479,7 +479,7 @@ namespace PakReader.Pak
|
|||
return false;
|
||||
}
|
||||
|
||||
public ReadOnlyMemory<byte> GetFile(string path) => Entries[CaseSensitive ? path : path.ToLowerInvariant()].GetData(Stream, AesKey);
|
||||
public ReadOnlyMemory<byte> GetFile(string path) => Entries[CaseSensitive ? path : path.ToLowerInvariant()].GetData(Stream, AesKey, Info.CompressionMethods);
|
||||
|
||||
// IReadOnlyDictionary implementation (to prevent writing to the Entries dictionary
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace PakReader.Parsers.Objects
|
|||
StructSize = (int)GetSize(EPakVersion.LATEST, compressionMethodIndex, compressionBlocks != null ? (uint)compressionBlocks.Length : 0);
|
||||
}
|
||||
|
||||
public ArraySegment<byte> GetData(Stream stream, byte[] key)
|
||||
public ArraySegment<byte> GetData(Stream stream, byte[] key, string[] compressionMethods)
|
||||
{
|
||||
lock (stream)
|
||||
{
|
||||
|
|
@ -140,27 +140,42 @@ namespace PakReader.Parsers.Objects
|
|||
if (Encrypted)
|
||||
{
|
||||
var data = new byte[(Size & 15) == 0 ? Size : ((Size / 16) + 1) * 16];
|
||||
stream.Read(data);
|
||||
stream.Read(data, 0, data.Length);
|
||||
byte[] decrypted = AESDecryptor.DecryptAES(data, key);
|
||||
|
||||
if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_ZLIB) // zlib and pray
|
||||
decrypted = ZlibStream.UncompressBuffer(decrypted);
|
||||
if (CompressionMethodIndex != 0U) Decompress(stream, compressionMethods, decrypted);
|
||||
return new ArraySegment<byte>(decrypted, 0, (int)UncompressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
var data = new byte[UncompressedSize];
|
||||
stream.Read(data);
|
||||
|
||||
if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_ZLIB) // zlib and pray
|
||||
return new ArraySegment<byte>(ZlibStream.UncompressBuffer(data));
|
||||
else if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_None)
|
||||
return new ArraySegment<byte>(data);
|
||||
if (CompressionMethodIndex == 0U)
|
||||
stream.Read(data, 0, data.Length);
|
||||
else
|
||||
Decompress(stream, compressionMethods, data);
|
||||
|
||||
return new ArraySegment<byte>(data);
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException("Decompression not yet implemented");
|
||||
}
|
||||
|
||||
private void Decompress(Stream stream, string[] compressionMethods, byte[] outData)
|
||||
{
|
||||
if (compressionMethods == null || compressionMethods.Length == 0)
|
||||
throw new IndexOutOfRangeException("CompressionMethods are null or empty");
|
||||
|
||||
var compressionMethod = compressionMethods[CompressionMethodIndex - 1]; // -1 because we dont have 'NAME_None' in the array
|
||||
Stream compressionStream = compressionMethod.ToLower() switch
|
||||
{
|
||||
"zlib" => new ZlibStream(stream, CompressionMode.Decompress, true),
|
||||
"gzip" => new GZipStream(stream, CompressionMode.Decompress, true),
|
||||
_ => throw new NotImplementedException($"Decompression not yet implemented ({compressionMethod})")
|
||||
};
|
||||
compressionStream.Read(outData, 0, outData.Length);
|
||||
compressionStream.Dispose();
|
||||
}
|
||||
|
||||
public static long GetSize(EPakVersion version, uint CompressionMethodIndex = 0, uint CompressionBlocksCount = 0)
|
||||
{
|
||||
long SerializedSize = sizeof(long) + sizeof(long) + sizeof(long) + 20;
|
||||
|
|
|
|||
5
FModel/Properties/Resources.Designer.cs
generated
5
FModel/Properties/Resources.Designer.cs
generated
|
|
@ -768,8 +768,9 @@ namespace FModel.Properties {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une chaîne localisée semblable à • Yanteh • FunGames
|
||||
///• HYPEX • Alexander.
|
||||
/// Recherche une chaîne localisée semblable à • Yanteh • Maiky
|
||||
///• FunGames • HYPEX
|
||||
///• Alexander.
|
||||
/// </summary>
|
||||
public static string DonatorsFDetails {
|
||||
get {
|
||||
|
|
|
|||
|
|
@ -361,8 +361,9 @@ It's now the most used free software to leak on Fortnite.</value>
|
|||
<value>Donators</value>
|
||||
</data>
|
||||
<data name="DonatorsFDetails" xml:space="preserve">
|
||||
<value>• Yanteh • FunGames
|
||||
• HYPEX • Alexander</value>
|
||||
<value>• Yanteh • Maiky
|
||||
• FunGames • HYPEX
|
||||
• Alexander</value>
|
||||
<comment>Do not translate</comment>
|
||||
</data>
|
||||
<data name="DownloadError" xml:space="preserve">
|
||||
|
|
|
|||
|
|
@ -252,22 +252,19 @@ namespace FModel.ViewModels.MenuItem
|
|||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[PakMenuItemViewModel]", "[Loader]", $"Backup file is {n}");
|
||||
|
||||
var oldFilesTemp = new Dictionary<string, FPakEntry>();
|
||||
using FileStream fileStream = new FileStream(ofd.FileName, FileMode.Open);
|
||||
BinaryReader checkReader = new BinaryReader(fileStream);
|
||||
bool isLz4 = checkReader.ReadUInt32() == 0x184D2204u;
|
||||
fileStream.Seek(0, SeekOrigin.Begin);
|
||||
var target = new MemoryStream();
|
||||
if (isLz4)
|
||||
{
|
||||
using LZ4DecoderStream compressionStream = LZ4Stream.Decode(fileStream);
|
||||
compressionStream.CopyTo(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileStream.CopyTo(target);
|
||||
}
|
||||
using (target)
|
||||
using (FileStream fileStream = new FileStream(ofd.FileName, FileMode.Open))
|
||||
using (BinaryReader checkReader = new BinaryReader(fileStream))
|
||||
using (MemoryStream target = new MemoryStream())
|
||||
{
|
||||
bool isLz4 = checkReader.ReadUInt32() == 0x184D2204u;
|
||||
fileStream.Seek(0, SeekOrigin.Begin);
|
||||
if (isLz4)
|
||||
{
|
||||
using LZ4DecoderStream compressionStream = LZ4Stream.Decode(fileStream);
|
||||
compressionStream.CopyTo(target);
|
||||
}
|
||||
else fileStream.CopyTo(target);
|
||||
|
||||
target.Position = 0;
|
||||
using BinaryReader reader = new BinaryReader(target);
|
||||
while (reader.BaseStream.Position < reader.BaseStream.Length)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user