Ejemplo n.º 1
0
        public static FoxProperty ReadFoxProperty(Stream input)
        {
            FoxProperty property = new FoxProperty();

            property.Read(input);
            return(property);
        }
Ejemplo n.º 2
0
        public void ReadXml(XmlReader reader)
        {
            ClassName = reader.GetAttribute("class");
            Version   = short.Parse(reader.GetAttribute("classVersion"));
            string addr = reader.GetAttribute("addr");

            Address = addr.StartsWith("0x")
                ? uint.Parse(addr.Substring(2, addr.Length - 2), NumberStyles.AllowHexSpecifier)
                : uint.Parse(addr);
            Unknown1 = short.Parse(reader.GetAttribute("unknown1"));
            Unknown2 = int.Parse(reader.GetAttribute("unknown2"));

            var isEmptyElement = reader.IsEmptyElement;

            reader.ReadStartElement("entity");
            if (isEmptyElement)
            {
                return;
            }


            bool staticPropertiesElementEmpty = reader.IsEmptyElement;

            reader.ReadStartElement("staticProperties");
            if (staticPropertiesElementEmpty == false)
            {
                while (reader.LocalName == "property")
                {
                    FoxProperty staticProperty = new FoxProperty();
                    staticProperty.ReadXml(reader);
                    _staticProperties.Add(staticProperty);
                }
                reader.ReadEndElement();
            }

            bool dynamicPropertiesElementEmpty = reader.IsEmptyElement;

            reader.ReadStartElement("dynamicProperties");

            if (dynamicPropertiesElementEmpty == false)
            {
                while (reader.LocalName == "property")
                {
                    FoxProperty dynamicProperty = new FoxProperty();
                    dynamicProperty.ReadXml(reader);
                    _dynamicProperties.Add(dynamicProperty);
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
Ejemplo n.º 3
0
        private void Read(Stream input)
        {
            BinaryReader reader     = new BinaryReader(input, Encoding.Default, true);
            short        headerSize = reader.ReadInt16();

            Unknown1 = reader.ReadInt16();
            short padding1     = reader.ReadInt16();
            uint  magicNumber1 = reader.ReadUInt32();

            Address = reader.ReadUInt32();
            uint padding2 = reader.ReadUInt32();

            Unknown2 = reader.ReadInt32();
            int unknown5 = reader.ReadInt32();

            Version       = reader.ReadInt16();
            ClassNameHash = reader.ReadUInt64();
            ushort staticPropertyCount = reader.ReadUInt16();
            uint   dynamicPropetyCount = reader.ReadUInt16();
            int    offset         = reader.ReadInt32();
            int    staticDataSize = reader.ReadInt32();
            int    dataSize       = reader.ReadInt32();

            input.AlignRead(16);

            for (int i = 0; i < staticPropertyCount; i++)
            {
                FoxProperty property = FoxProperty.ReadFoxProperty(input);
                if (property.Container == null)
                {
                    property.Container = null;
                }
                _staticProperties.Add(property);
            }
            for (int i = 0; i < dynamicPropetyCount; i++)
            {
                FoxProperty property = FoxProperty.ReadFoxProperty(input);
                _dynamicProperties.Add(property);
            }
        }