Пример #1
0
        protected ElementBase(Xml.SubrecordElement node)
        {
            if (node.name.StartsWith("&#x"))
            {
                string[] val = node.name.Split(new[] { ';' }, 2, StringSplitOptions.None);
                var      c   = (char)int.Parse(val[0].Substring(3), NumberStyles.HexNumber, null);
                this.name = c + val[1];
            }
            else
            {
                this.name = node.name;
            }

            this.repeat   = node.repeat;
            this.optional = node.optional;
            this.desc     = node.desc;
        }
Пример #2
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;
            }
        }
Пример #3
0
 public SubrecordElement CreateType(string name, string type)
 {
     var elem = new SubrecordElement();
     elem.name = string.IsNullOrEmpty(name) ? "Unknown" : name;
     elem.type = type;
     return elem;
 }