Пример #1
0
        public XBN_RootElement(XBN_Header header)
        {
            Header = header;

            Elements   = new List <XBN_Element>();
            Childs     = new List <XBN_RootElement>();
            Properties = new List <XBN_Property>();
        }
Пример #2
0
        public XBN_RootElement(XBN_Header header)
        {
            this.Header = header;

            this.Elements   = new List <XBN_Element>();
            this.Childs     = new List <XBN_RootElement>();
            this.Properties = new List <XBN_Property>();
        }
Пример #3
0
        public static XBN_RootElement Deserialize(BinaryReader reader, XBN_Header header)
        {
            if (reader == null)
            {
                throw new Exception("Reader is null");
            }

            if (header == null)
            {
                throw new Exception("Header is null");
            }

            var mainTag = header.Tags[reader.ReadInt16()];
            var unk1    = reader.ReadInt16();
            var unk2    = reader.ReadInt16();

            var totalElements = reader.ReadInt16();

            List <XBN_Element>     elements   = new List <XBN_Element>();
            List <XBN_Property>    properties = new List <XBN_Property>();
            List <XBN_RootElement> childs     = new List <XBN_RootElement>();

            if (unk1 > 0)
            {
                for (int i = 0; i < totalElements; i++)
                {
                    properties.Add(XBN_Property.Deserialize(reader, header));
                }

                //Testing
                for (int i = 0; i < unk1; i++)
                {
                    childs.Add(Deserialize(reader, header));
                }
            }
            else
            {
                for (int i = 0; i < totalElements; i++)
                {
                    elements.Add(XBN_Element.Deserialize(reader, header));
                }
            }

            return(new XBN_RootElement(header)
            {
                Name = mainTag,
                Unk1 = unk1,
                Unk2 = unk2,
                Childs = childs,
                Elements = elements,
                Properties = properties
            });
        }
Пример #4
0
        public static XBN_RootElement Deserialize(BinaryReader reader, XBN_Header header)
        {
            if (reader == null)
            {
                throw new Exception("Reader is null");
            }

            if (header == null)
            {
                throw new Exception("Header is null");
            }

            string mainTag = header.Tags[reader.ReadInt16()];
            short  unk1    = reader.ReadInt16();
            short  unk2    = reader.ReadInt16();

            short totalElements = reader.ReadInt16();

            var elements   = new List <XBN_Element>();
            var properties = new List <XBN_Property>();
            var childs     = new List <XBN_RootElement>();

            if (unk1 > 0)
            {
                for (int i = 0; i < totalElements; i++)
                {
                    var element = XBN_Property.Deserialize(reader, header);
                    properties.Add(element);
                }

                childs.Add(XBN_RootElement.Deserialize(reader, header));
            }
            else
            {
                for (int i = 0; i < totalElements; i++)
                {
                    var element = XBN_Element.Deserialize(reader, header);
                    elements.Add(element);
                }
            }

            return(new XBN_RootElement(header)
            {
                Name = mainTag,
                Unk1 = unk1,
                Unk2 = unk2,
                Childs = childs,
                Elements = elements,
                Properties = properties
            });
        }
Пример #5
0
        public static XBN_Property Deserialize(BinaryReader reader, XBN_Header header)
        {
            if (reader == null)
            {
                throw new Exception("Reader is null");
            }

            if (header == null)
            {
                throw new Exception("Header is null");
            }

            var propertyKey   = header.Properties[reader.ReadInt16()];
            var propertyValue = reader.ReadXBNStr();

            return(new XBN_Property(header, propertyKey, propertyValue));
        }
Пример #6
0
        public static XBN_Element Deserialize(BinaryReader reader, XBN_Header header)
        {
            if (reader == null)
            {
                throw new Exception("Reader is null");
            }

            if (header == null)
            {
                throw new Exception("Header is null");
            }

            string name          = header.Tags[reader.ReadInt16()];
            short  propertyCount = reader.ReadInt16();
            short  unk3          = reader.ReadInt16();
            short  tagCount      = reader.ReadInt16();

            var properties = new List <XBN_Property>();

            for (int i = 0; i < propertyCount; i++)
            {
                properties.Add(XBN_Property.Deserialize(reader, header));
            }

            var elements = new List <XBN_Element>();

            for (int i = 0; i < tagCount; i++)
            {
                elements.Add(XBN_Element.Deserialize(reader, header));
            }

            return(new XBN_Element(header)
            {
                Name = name,
                Unk3 = unk3,
                Properties = properties,
                Childs = elements
            });
        }
Пример #7
0
 public XBN_Property(XBN_Header header, string key, string value)
     : this(header)
 {
     this.Key   = key;
     this.Value = value;
 }
Пример #8
0
 public XBN_Property(XBN_Header header)
 {
     this.Header = header;
 }
Пример #9
0
 public XBN_Property(XBN_Header header)
 {
     Header = header;
 }