2007-10-07 22:21:47 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Text;
|
|
|
|
using System.IO;
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Data
|
|
|
|
{
|
2008-01-02 21:49:43 +00:00
|
|
|
internal sealed class PatchNames
|
2007-10-07 22:21:47 +00:00
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
private string[] pnames;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public string this[int index] { get { return pnames[index]; } }
|
|
|
|
public int Length { get { return pnames.Length; } }
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
2007-10-26 13:17:20 +00:00
|
|
|
// Constructor for empty list
|
|
|
|
public PatchNames()
|
|
|
|
{
|
|
|
|
// Create array
|
|
|
|
pnames = new string[0];
|
|
|
|
}
|
|
|
|
|
2007-10-07 22:21:47 +00:00
|
|
|
// Constructor
|
|
|
|
public PatchNames(Stream stream)
|
|
|
|
{
|
|
|
|
BinaryReader reader = new BinaryReader(stream);
|
|
|
|
uint length;
|
|
|
|
|
|
|
|
// Read length of array
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
length = reader.ReadUInt32();
|
|
|
|
|
|
|
|
// Create array
|
|
|
|
pnames = new string[length];
|
|
|
|
|
|
|
|
// Read all patch names
|
|
|
|
for(uint i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
byte[] bytes = reader.ReadBytes(8);
|
2007-10-26 18:04:54 +00:00
|
|
|
pnames[i] = Lump.MakeNormalName(bytes, WAD.ENCODING).ToUpperInvariant();
|
2007-10-07 22:21:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|