UltimateZoneBuilder/Source/Data/PatchNames.cs
2007-10-08 14:29:31 +00:00

79 lines
1.7 KiB
C#

#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
{
internal sealed class PatchNames
{
#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
// 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);
pnames[i] = Lump.MakeNormalName(bytes, WAD.ENCODING);
}
}
#endregion
#region ================== Methods
#endregion
}
}