Add minimum size check for opening files

0bytes -> exception, just use pk2 stored (min size)
This commit is contained in:
Kurt
2017-02-15 08:29:47 -08:00
parent f001d4d384
commit f860bd31c7

View File

@@ -691,7 +691,9 @@ private void openQuick(string path, bool force = false)
string ext = Path.GetExtension(path);
FileInfo fi = new FileInfo(path);
if (fi.Length > 0x10009C && fi.Length != 0x380000)
WinFormsUtil.Error("Input file is too large.", path);
WinFormsUtil.Error("Input file is too large." + Environment.NewLine + $"Size: {fi.Length} bytes", path);
else if (fi.Length < 32)
WinFormsUtil.Error("Input file is too small." + Environment.NewLine + $"Size: {fi.Length} bytes", path);
else
{
byte[] input; try { input = File.ReadAllBytes(path); }