mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-28 06:42:13 +00:00
Reject ZWADs with an error message.
This commit is contained in:
parent
93fc8fb78f
commit
9aba68db7b
3 changed files with 11 additions and 7 deletions
|
@ -32,6 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
// WAD types
|
// WAD types
|
||||||
public const string TYPE_IWAD = "IWAD";
|
public const string TYPE_IWAD = "IWAD";
|
||||||
public const string TYPE_PWAD = "PWAD";
|
public const string TYPE_PWAD = "PWAD";
|
||||||
|
public const string TYPE_ZWAD = "ZWAD";
|
||||||
|
|
||||||
// Encoder
|
// Encoder
|
||||||
public static readonly Encoding ENCODING = Encoding.ASCII;
|
public static readonly Encoding ENCODING = Encoding.ASCII;
|
||||||
|
@ -195,6 +196,9 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
// Read WAD type
|
// Read WAD type
|
||||||
type = ENCODING.GetString(reader.ReadBytes(4));
|
type = ENCODING.GetString(reader.ReadBytes(4));
|
||||||
|
|
||||||
|
if (type == TYPE_ZWAD)
|
||||||
|
throw new IOException("Sorry, can't open ZWADs. Please decompress first.");
|
||||||
|
|
||||||
// Number of lumps
|
// Number of lumps
|
||||||
numlumps = reader.ReadInt32();
|
numlumps = reader.ReadInt32();
|
||||||
if(numlumps < 0) throw new IOException("Invalid number of lumps in wad file.");
|
if(numlumps < 0) throw new IOException("Invalid number of lumps in wad file.");
|
||||||
|
|
|
@ -45,11 +45,11 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Open the WAD file
|
// Open the WAD file
|
||||||
wadfile = new WAD(filepathname, true);
|
wadfile = new WAD(filepathname, true);
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
// Unable to open WAD file (or its config)
|
// 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);
|
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.DialogResult = DialogResult.Cancel;
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,10 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Open the WAD file
|
// Open the WAD file
|
||||||
wadfile = new WAD(filepathname, true);
|
wadfile = new WAD(filepathname, true);
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
// Unable to open WAD file (or its config)
|
// 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);
|
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();
|
if(wadfile != null) wadfile.Dispose();
|
||||||
this.DialogResult = DialogResult.Cancel;
|
this.DialogResult = DialogResult.Cancel;
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
Loading…
Reference in a new issue