Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
 public SubrecordElement CreateType(string name, string type)
 {
     var elem = new SubrecordElement();
     elem.name = string.IsNullOrEmpty(name) ? "Unknown" : name;
     elem.type = type;
     return elem;
 }