mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Adjust file loading so error exceptions can properly be viewed.
This commit is contained in:
parent
488b689c27
commit
c67be3b5bd
1 changed files with 9 additions and 17 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue