示例#1
0
        public void Read(Stream input, BinaryXmlStringTable table)
        {
            this.Name       = table[input.ReadPackedS32()];
            this.Attributes = new Dictionary <string, string>();
            this.Children   = new List <BinaryXmlNode>();
            this.Value      = null;
            byte b = input.ReadU8();

            if ((b & 1) == 1)
            {
                this.Value = table[input.ReadPackedS32()];
            }
            if ((b & 2) == 2)
            {
                int num = input.ReadPackedS32();
                for (int i = 0; i < num; i++)
                {
                    string key   = table[input.ReadPackedS32()];
                    string value = table[input.ReadPackedS32()];
                    this.Attributes[key] = value;
                }
            }
            if ((b & 4) == 4)
            {
                int num2 = input.ReadPackedS32();
                for (int j = 0; j < num2; j++)
                {
                    BinaryXmlNode binaryXmlNode = new BinaryXmlNode();
                    binaryXmlNode.Read(input, table);
                    this.Children.Add(binaryXmlNode);
                }
            }
        }
示例#2
0
        public void Read(Stream input)
        {
            if (input.ReadU8() != 128)
            {
                throw new InvalidDataException("not a binary XML file");
            }
            BinaryXmlStringTable binaryXmlStringTable = new BinaryXmlStringTable();

            binaryXmlStringTable.Read(input, input.ReadPackedS32());
            this.Root = new BinaryXmlNode();
            this.Root.Read(input, binaryXmlStringTable);
        }