0
0
Fork 0
mirror of https://git.do.srb2.org/STJr/ZoneBuilder.git synced 2025-02-27 14:21:05 +00:00

Reject ZWADs with an error message.

This commit is contained in:
MascaraSnake 2017-07-11 21:06:04 +02:00
parent 93fc8fb78f
commit 9aba68db7b
3 changed files with 11 additions and 7 deletions

View file

@ -32,6 +32,7 @@ namespace CodeImp.DoomBuilder.IO
// WAD types
public const string TYPE_IWAD = "IWAD";
public const string TYPE_PWAD = "PWAD";
public const string TYPE_ZWAD = "ZWAD";
// Encoder
public static readonly Encoding ENCODING = Encoding.ASCII;
@ -194,6 +195,9 @@ namespace CodeImp.DoomBuilder.IO
// Read WAD type
type = ENCODING.GetString(reader.ReadBytes(4));
if (type == TYPE_ZWAD)
throw new IOException("Sorry, can't open ZWADs. Please decompress first.");
// Number of lumps
numlumps = reader.ReadInt32();

View file

@ -45,11 +45,11 @@ namespace CodeImp.DoomBuilder.Windows
// Open the WAD file
wadfile = new WAD(filepathname, true);
}
catch(Exception)
catch(Exception e)
{
// Unable to open WAD file (or its config)
MessageBox.Show(this, "Could not open the WAD file for reading. Please make sure the file you selected is valid and is not in use by any other application.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.Cancel;
// Unable to open WAD file (or its config)
MessageBox.Show(this, "Could not open the WAD file for reading.\n" + e.GetType().Name + ": " + e.Message + "\nPlease make sure the file you selected is valid and is not in use by any other application.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.Cancel;
this.Close();
return;
}

View file

@ -90,10 +90,10 @@ namespace CodeImp.DoomBuilder.Windows
// Open the WAD file
wadfile = new WAD(filepathname, true);
}
catch(Exception)
catch(Exception e)
{
// Unable to open WAD file (or its config)
MessageBox.Show(this, "Could not open the WAD file for reading. Please make sure the file you selected is valid and is not in use by any other application.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
// Unable to open WAD file (or its config)
MessageBox.Show(this, "Could not open the WAD file for reading.\n" + e.GetType().Name + ": " + e.Message + "\nPlease make sure the file you selected is valid and is not in use by any other application.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
if(wadfile != null) wadfile.Dispose();
this.DialogResult = DialogResult.Cancel;
this.Close();