1
0
mirror of synced 2024-11-27 17:00:50 +01:00

Adjust file loading so error exceptions can properly be viewed.

This commit is contained in:
KillzXGaming 2022-03-25 16:48:45 -04:00
parent 488b689c27
commit c67be3b5bd

View File

@ -185,34 +185,26 @@ namespace Toolbox.Library.IO
if (stream.Length < 8) return null;
//Try catch incase it fails, continute to load the file anyways if the check may be false
try
//Check all supported compression formats and decompress. Then loop back
if (!Compressed)
{
//Check all supported compression formats and decompress. Then loop back
if (!Compressed)
foreach (ICompressionFormat compressionFormat in FileManager.GetCompressionFormats())
{
foreach (ICompressionFormat compressionFormat in FileManager.GetCompressionFormats())
stream.Position = streamStartPos;
if (compressionFormat.Identify(stream, FileName))
{
stream.Position = streamStartPos;
if (compressionFormat.Identify(stream, FileName))
{
stream.Position = streamStartPos;
Stream decompStream = compressionFormat.Decompress(stream);
stream.Close();
Stream decompStream = compressionFormat.Decompress(stream);
stream.Close();
CompressedSize = decompStream.Length;
CompressedSize = decompStream.Length;
return OpenFileFormat(decompStream, FileName, LeaveStreamOpen, InArchive,
return OpenFileFormat(decompStream, FileName, LeaveStreamOpen, InArchive,
true, compressionFormat, DecompressedSize, CompressedSize);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
stream.Position = streamStartPos;
foreach (IFileFormat fileFormat in FileManager.GetFileFormats())