mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-07 22:43:48 +00:00
Added proper handling of the file type exception
This commit is contained in:
@@ -25,6 +25,7 @@ namespace PckStudio.Classes.IO.PCK
|
||||
int pck_type = ReadInt(stream);
|
||||
if (pck_type > 0xf0_00_00) // 03 00 00 00 == true
|
||||
throw new OverflowException(nameof(pck_type));
|
||||
else if (pck_type < 3) throw new Exception(pck_type.ToString());
|
||||
_file = new PCKFile(pck_type);
|
||||
ReadLookUpTable(stream);
|
||||
ReadFileEntries(stream);
|
||||
|
||||
@@ -171,8 +171,14 @@ namespace PckStudio
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Failed to open pck\n" +
|
||||
"If this is an Audio/Music Cues pck, please use the specialized editor while inside of the parent pck.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Debug.WriteLine("Can't open pck file of type: " + pck?.type.ToString());
|
||||
}
|
||||
}
|
||||
if (pck?.type < 3) throw new Exception("Can't open pck file of type: " + pck.type.ToString());
|
||||
return pck;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user