internal Element(ElementStructure es, ElementValueType vt, ArraySegment <byte> data, Tuple <ElementBase, int>[] indices) { this.Structure = es; this.Data = data; this.type = vt; this.Indices = indices; }
public ElementStructure() { this.name = "DATA"; this.desc = "Data"; this.@group = 0; this.hexview = true; this.notininfo = true; this.optional = false; this.options = null; this.flags = null; this.repeat = 0; this.CondID = 0; this.FormIDType = null; this.multiline = false; this.type = ElementValueType.Blob; }
public ElementStructure() : base() { this.@group = 0; this.hexview = true; this.hexviewwithdec = false; this.notininfo = true; this.options = null; this.flags = null; this.CondID = 0; this.FormIDType = null; this.multiline = false; this.funcr = string.Empty; this.funcw = string.Empty; this.type = ElementValueType.Blob; }
public ElementStructure() { name = "DATA"; desc = "Data"; @group = 0; hexview = true; notininfo = true; optional = false; options = null; flags = null; repeat = 0; CondID = 0; FormIDType = null; multiline = false; type = ElementValueType.Blob; }
public ElementStructure(SubrecordElement node) : base(node) { //this.name = node.name; //this.desc = node.desc; this.@group = node.group; this.hexview = node.hexview; this.hexviewwithdec = node.hexviewwithdec; this.notininfo = node.notininfo; //this.optional = node.optional != 0; this.options = node.options == null ? new string[0] : node.options.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); this.flags = node.flags == null ? new string[0] : node.flags.Split(new[] { ';' }); //this.repeat = node.repeat; this.funcr = node.funcr; this.funcw = node.funcw; this.CondID = node.condid; if (this.optional > 0 || this.repeat > 0) { if (this.@group != 0) { throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } } this.FormIDType = null; this.multiline = node.multiline; this.type = (ElementValueType)Enum.Parse(typeof(ElementValueType), node.type, true); switch (this.type) { case ElementValueType.FormID: this.FormIDType = node.reftype; break; case ElementValueType.Blob: if (this.repeat > 0 || this.optional > 0) { throw new RecordXmlException("blob type elements can't be marked with repeat or optional"); } break; } }
public ElementStructure(ElementStructure src, int optional = 0, int repeat = 0) : base(src, optional, repeat) { this.CondID = src.CondID; this.FormIDType = src.FormIDType; this.flags = src.flags; this.group = src.group; this.hexview = src.hexview; this.hexviewwithdec = src.hexviewwithdec; this.multiline = src.multiline; //this.name = src.name; this.notininfo = src.notininfo; //this.optional = @optional; this.options = src.options; //this.repeat = repeat; this.funcr = src.funcr; this.funcw = src.funcw; this.type = src.type; }
public ElementStructure(SubrecordElement node) { this.name = node.name; this.desc = node.desc; this.@group = node.group; this.hexview = node.hexview; this.hexviewwithdec = node.hexviewwithdec; this.notininfo = node.notininfo; this.optional = node.optional != 0; this.options = node.options == null ? new string[0] : node.options.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); this.flags = node.flags == null ? new string[0] : node.flags.Split(new[] { ';' }); this.repeat = node.repeat; this.funcr = node.funcr; this.funcw = node.funcw; this.CondID = node.condid; if (this.optional || this.repeat > 0) { if (this.@group != 0) { throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } } this.FormIDType = null; this.multiline = node.multiline; this.type = (ElementValueType)Enum.Parse(typeof(ElementValueType), node.type, true); switch (this.type) { case ElementValueType.FormID: this.FormIDType = node.reftype; break; case ElementValueType.Blob: if (this.repeat > 0 || this.optional) { throw new RecordXmlException("blob type elements can't be marked with repeat or optional"); } break; } }
public ElementStructure(SubrecordElement node) { name = node.name; desc = node.desc; @group = node.group; hexview = node.hexview; notininfo = node.notininfo; optional = node.optional != 0; options = node.options == null ? new string[0] : node.options.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); flags = node.flags == null ? new string[0] : node.flags.Split(new[] { ';' }); repeat = node.repeat; CondID = node.condid; if (optional || repeat > 0) { if (group != 0) { throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } } FormIDType = null; multiline = node.multiline; type = (ElementValueType)Enum.Parse(typeof(ElementValueType), node.type, true); switch (type) { case ElementValueType.FormID: FormIDType = node.reftype; break; case ElementValueType.Blob: if (repeat > 0 || optional) { throw new RecordXmlException( "blob type elements can't be marked with repeat or optional"); } break; } }
public ElementStructure(XmlNode node) { if (node.Name != "Element") { throw new RecordXmlException("Invalid node"); } name = node.Attributes.GetNamedItem("name").Value; var node2 = node.Attributes.GetNamedItem("group"); @group = node2 != null?int.Parse(node2.Value) : 0; node2 = node.Attributes.GetNamedItem("condid"); CondID = node2 != null?int.Parse(node2.Value) : 0; node2 = node.Attributes.GetNamedItem("notininfo"); if (node2 != null && node2.Value == "true") { notininfo = true; } else { notininfo = false; } node2 = node.Attributes.GetNamedItem("desc"); desc = node2 != null ? node2.Value : null; node2 = node.Attributes.GetNamedItem("hexview"); if (node2 != null && node2.Value == "true") { hexview = true; } else { hexview = false; } node2 = node.Attributes.GetNamedItem("flags"); flags = node2 != null?node2.Value.Split(';') : null; node2 = node.Attributes.GetNamedItem("options"); options = node2 != null?node2.Value.Split(';') : null; node2 = node.Attributes.GetNamedItem("repeat"); if (node2 != null && node2.Value == "1") { repeat = true; } else { repeat = false; } node2 = node.Attributes.GetNamedItem("optional"); if (node2 != null && node2.Value == "1") { optional = true; } else { optional = false; } if (optional || repeat) { if (group != 0) { throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } } FormIDType = null; multiline = false; switch (node.Attributes.GetNamedItem("type").Value) { case "float": type = ElementValueType.Float; break; case "int": type = ElementValueType.Int; break; case "short": type = ElementValueType.Short; break; case "byte": type = ElementValueType.Byte; break; case "formid": type = ElementValueType.FormID; node2 = node.Attributes.GetNamedItem("reftype"); if (node2 != null) { FormIDType = node2.Value; } break; case "string": type = ElementValueType.String; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") { multiline = true; } break; case "blob": if (repeat || optional) { throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); } type = ElementValueType.Blob; break; case "fstring": if (repeat || optional) { throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); } type = ElementValueType.fstring; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") { multiline = true; } break; default: throw new RecordXmlException("Invalid element type"); } }
public ElementStructure(XmlNode node) { if (node.Name != "Element") { throw new RecordXmlException("Invalid node"); } name = node.Attributes.GetNamedItem("name").Value; var node2 = node.Attributes.GetNamedItem("group"); @group = node2 != null ? int.Parse(node2.Value) : 0; node2 = node.Attributes.GetNamedItem("condid"); CondID = node2 != null ? int.Parse(node2.Value) : 0; node2 = node.Attributes.GetNamedItem("notininfo"); if (node2 != null && node2.Value == "true") { notininfo = true; } else { notininfo = false; } node2 = node.Attributes.GetNamedItem("desc"); desc = node2 != null ? node2.Value : null; node2 = node.Attributes.GetNamedItem("hexview"); if (node2 != null && node2.Value == "true") { hexview = true; } else { hexview = false; } node2 = node.Attributes.GetNamedItem("flags"); flags = node2 != null ? node2.Value.Split(';') : null; node2 = node.Attributes.GetNamedItem("options"); options = node2 != null ? node2.Value.Split(';') : null; node2 = node.Attributes.GetNamedItem("repeat"); if (node2 != null && node2.Value == "1") { repeat = true; } else { repeat = false; } node2 = node.Attributes.GetNamedItem("optional"); if (node2 != null && node2.Value == "1") { optional = true; } else { optional = false; } if (optional || repeat) { if (group != 0) { throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } } FormIDType = null; multiline = false; switch (node.Attributes.GetNamedItem("type").Value) { case "float": type = ElementValueType.Float; break; case "int": type = ElementValueType.Int; break; case "short": type = ElementValueType.Short; break; case "byte": type = ElementValueType.Byte; break; case "formid": type = ElementValueType.FormID; node2 = node.Attributes.GetNamedItem("reftype"); if (node2 != null) { FormIDType = node2.Value; } break; case "string": type = ElementValueType.String; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") { multiline = true; } break; case "blob": if (repeat || optional) { throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); } type = ElementValueType.Blob; break; case "fstring": if (repeat || optional) { throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); } type = ElementValueType.fstring; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") { multiline = true; } break; default: throw new RecordXmlException("Invalid element type"); } }
public ElementStructure(XmlNode node) { if (node.Name != "Element") throw new RecordXmlException("Invalid node"); name = node.Attributes.GetNamedItem("name").Value; XmlNode node2 = node.Attributes.GetNamedItem("group"); if (node2 != null) group = int.Parse(node2.Value); else group = 0; node2 = node.Attributes.GetNamedItem("condid"); if (node2 != null) CondID = int.Parse(node2.Value); else CondID = 0; node2 = node.Attributes.GetNamedItem("notininfo"); if (node2 != null && node2.Value == "true") notininfo = true; else notininfo = false; node2 = node.Attributes.GetNamedItem("desc"); if (node2 != null) desc = node2.Value; else desc = null; node2 = node.Attributes.GetNamedItem("hexview"); if (node2 != null && node2.Value == "true") hexview = true; else hexview = false; node2 = node.Attributes.GetNamedItem("flags"); if (node2 != null) flags = node2.Value.Split(';'); else flags = null; node2 = node.Attributes.GetNamedItem("options"); if (node2 != null) options = node2.Value.Split(';'); else options = null; node2 = node.Attributes.GetNamedItem("repeat"); if (node2 != null && node2.Value == "1") repeat = true; else repeat = false; node2 = node.Attributes.GetNamedItem("optional"); if (node2 != null && node2.Value == "1") optional = true; else optional = false; if (optional || repeat) { if (group != 0) throw new RecordXmlException("Elements with a group attribute cant be marked optional or repeat"); } FormIDType = null; multiline = false; switch (node.Attributes.GetNamedItem("type").Value) { case "float": type = ElementValueType.Float; break; case "int": type = ElementValueType.Int; break; case "short": type = ElementValueType.Short; break; case "byte": type = ElementValueType.Byte; break; case "formid": type = ElementValueType.FormID; node2 = node.Attributes.GetNamedItem("reftype"); if (node2 != null) FormIDType = node2.Value; break; case "string": type = ElementValueType.String; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") multiline = true; break; case "blob": if (repeat || optional) throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); type = ElementValueType.Blob; break; case "fstring": if (repeat || optional) throw new RecordXmlException("blob or fstring type elements can't be marked with repeat or optional"); type = ElementValueType.fstring; node2 = node.Attributes.GetNamedItem("multiline"); if (node2 != null && node2.Value == "true") multiline = true; break; default: throw new RecordXmlException("Invalid element type"); } }
public Element(ElementStructure es, ElementValueType vt, ArraySegment <byte> data) { Structure = es; Data = data; type = vt; }
public Conditional(ElementValueType type, object value) { this.type = type; this.value = value; }
/// <summary> /// Public constructor that can be used with python scripts /// </summary> /// <param name="vt"></param> /// <param name="value"></param> public Element(ElementValueType vt, object value) { this.type = vt; this.AssignValue(ElementAssignmentType.Set, value); }