Plugins
Posted: Thu Feb 21, 2008 12:49 pm
Well I have every nodetype done except enums, bitmasks, and structs. The only problem im having is getting my xmltextreader to read the contense, ex options etc. Can any one help me?
Visit remnantmods.com for more information
http://www.halomods.info/
Code: Select all
case "enum8":
{
ItemTag += 1;
string Name = XR.GetAttribute("name");
int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
bool Visible = bool.Parse(XR.GetAttribute("visible"));
List<string> Temp = new List<string>(0);
while (XR.Read())
{
switch (XR.NodeType)
{
case XmlNodeType.Element:
{
do
{
Temp.Capacity += 1;
Temp.Add(XR.GetAttribute("name"));
}
while (XR.Name.ToLower() == "option");
break;
}
case XmlNodeType.EndElement:
{
break;
}
default:
{
break;
}
}
}
string[] Options = Temp.ToArray();
Map.BR.BaseStream.Position = Offset;
int Value = Map.BR.ReadByte();
Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, (int)Value, Options, typeof(byte), ItemTag));
break;
}
case "enum16":
{
ItemTag += 1;
string Name = XR.GetAttribute("name");
int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
bool Visible = bool.Parse(XR.GetAttribute("visible"));
List<string> Temp = new List<string>();
while (XR.Name.ToLower() == "option")
{
Temp.Add(XR.GetAttribute("name"));
}
string[] Options = Temp.ToArray();
Map.BR.BaseStream.Position = Offset;
int Value = Map.BR.ReadInt16();
Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, (int)Value, Options, typeof(short), ItemTag));
break;
}
case "enum32":
{
ItemTag += 1;
string Name = XR.GetAttribute("name");
int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
bool Visible = bool.Parse(XR.GetAttribute("visible"));
List<string> Temp = new List<string>();
while (XR.Name.ToLower() == "option")
{
Temp.Add(XR.GetAttribute("name"));
}
string[] Options = Temp.ToArray();
Map.BR.BaseStream.Position = Offset;
int Value = Map.BR.ReadInt32();
Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, Value, Options, typeof(int), ItemTag));
break;
}