mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-10 23:25:17 -05:00
Add minimum size check for opening files
0bytes -> exception, just use pk2 stored (min size)
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user