Exemplo n.º 1
0
        public override void Unmarshal(string data, bool withV = true)
        {
            XmlNode xmlNode1 = this.GetRoot(data).SelectSingleNode("node");

            if (xmlNode1 == null)
            {
                throw new SerializingException("node tag not found");
            }
            HeroClassDef heroClassDef = this.Type.Id.Definition as HeroClassDef;

            for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
            {
                if (xmlNode2.Name == "f")
                {
                    string       name  = xmlNode2.Attributes["name"].Value;
                    HeroFieldDef field = heroClassDef.GetField(name);
                    if (field != null)
                    {
                        HeroAnyValue heroAnyValue = HeroAnyValue.Create(field.FieldType);
                        heroAnyValue.Unmarshal("<v>" + xmlNode2.InnerXml + "</v>", true);
                        this.Variables.Add(new Variable(new DefinitionId(field.Id), 0, heroAnyValue));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void Unmarshal(string data, bool withV = true)
        {
            XmlNode node = base.GetRoot(data).SelectSingleNode("node");

            if (node == null)
            {
                throw new SerializingException("node tag not found");
            }
            HeroClassDef definition = base.Type.Id.Definition as HeroClassDef;

            for (node = node.FirstChild; node != null; node = node.NextSibling)
            {
                if (node.Name == "f")
                {
                    string       name  = node.Attributes["name"].Value;
                    HeroFieldDef field = definition.GetField(name);
                    if (field != null)
                    {
                        HeroAnyValue value2 = HeroAnyValue.Create(field.FieldType);
                        value2.Unmarshal("<v>" + node.InnerXml + "</v>", true);
                        this.Variables.Add(new Variable(new DefinitionId(field.Id), 0, value2));
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void Unmarshal(string data, bool asXml = true)
        {
            XmlNode root = base.GetRoot(data);

            this.Data = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroAnyValue value2 = null;
            HeroAnyValue value3 = null;

            for (root = root.FirstChild; root != null; root = root.NextSibling)
            {
                if (root.Name == "k")
                {
                    value2 = HeroAnyValue.Create(base.Type.Indexer);
                    value2.Unmarshal("<v>" + root.InnerText + "</v>", true);
                }
                if (root.Name == "e")
                {
                    value3 = HeroAnyValue.Create(base.Type.Values);
                    value3.Unmarshal("<v>" + root.InnerText + "</v>", true);
                    this.Data[new HeroVarId(0, value2)] = value3;
                    value2 = null;
                }
            }
            base.hasValue = true;
        }
Exemplo n.º 4
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList deserializeList = new DeserializeList(stream, 1);

            if (this.Type.Values == null)
            {
                this.Type.SetValuesType(deserializeList.listType);
            }
            for (uint index1 = 0U; index1 < deserializeList.Count; ++index1)
            {
                uint index2;
                bool b;
                int  variableId;
                deserializeList.GetFieldIndex(out index2, out b, out variableId);
                HeroAnyValue heroAnyValue = HeroAnyValue.Create(this.Type.Values);
                heroAnyValue.Deserialize(stream);
                this.Data.Add(new HeroVarId(variableId, heroAnyValue));
                if (variableId > this.nextId)
                {
                    this.nextId = variableId;
                }
            }
        }
Exemplo n.º 5
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList list = new DeserializeList(stream, 1);

            if (base.Type.Values == null)
            {
                base.Type.SetValuesType(list.listType);
            }
            for (uint i = 0; i < list.Count; i++)
            {
                uint num2;
                bool flag;
                int  num3;
                list.GetFieldIndex(out num2, out flag, out num3);
                HeroAnyValue value2 = HeroAnyValue.Create(base.Type.Values);
                value2.Deserialize(stream);
                this.Data.Add(new HeroVarId(num3, value2));
                if (num3 > this.nextId)
                {
                    this.nextId = num3;
                }
            }
        }
Exemplo n.º 6
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass class2 = new DeserializeClass(stream, 1);

            for (uint i = 0; i < class2.Count; i++)
            {
                ulong        num2;
                int          num5;
                HeroFieldDef definition;
                HeroAnyValue value2;
                uint         num3       = 0;
                int          variableId = 0;
                class2.ReadFieldData(out num2, ref num3, ref variableId, out num5);
                if (num5 == 2)
                {
                    continue;
                }
                HeroType     type  = new HeroType((HeroTypes)num3);
                DefinitionId field = new DefinitionId(num2);
                if (field.Definition != null)
                {
                    definition = field.Definition as HeroFieldDef;
                    HeroTypes types = definition.FieldType.Type;
                    if (types != HeroTypes.Enum)
                    {
                        if (types == HeroTypes.LookupList)
                        {
                            goto Label_0096;
                        }
                        if (types != HeroTypes.ScriptRef)
                        {
                            goto Label_009F;
                        }
                    }
                    type.Id = definition.FieldType.Id;
                }
                goto Label_009F;
Label_0096:
                type = definition.FieldType;
Label_009F:
                value2 = HeroAnyValue.Create(type);
                value2.Deserialize(stream);
                this.Variables.Add(new Variable(field, variableId, value2));
            }
        }
Exemplo n.º 7
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue = true;
            this.Data     = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroType defaultIndexerType = new HeroType(HeroTypes.None);

            if (base.Type.Indexer != null)
            {
                defaultIndexerType = base.Type.Indexer;
            }
            DeserializeLookupList list = new DeserializeLookupList(stream, 1, defaultIndexerType);

            if ((base.Type.Indexer == null) || (base.Type.Indexer.Type == HeroTypes.None))
            {
                base.Type.Indexer = list.indexerType;
            }
            else
            {
                list.indexerType = base.Type.Indexer;
            }
            if (base.Type.Values == null)
            {
                base.Type.Values = list.valueType;
            }
            else
            {
                list.valueType = base.Type.Values;
            }
            for (ulong i = 0L; i < list.Count; i += (ulong)1L)
            {
                int          num2;
                HeroAnyValue value2;
                list.GetKey(out value2, out num2);
                HeroAnyValue value3 = HeroAnyValue.Create(base.Type.Values);
                value3.Deserialize(stream);
                this.Data[new HeroVarId(num2, value2)] = value3;
                if (num2 > this.nextId)
                {
                    this.nextId = num2;
                }
            }
        }
Exemplo n.º 8
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            this.Data     = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroType defaultIndexerType = new HeroType(HeroTypes.None);

            if (this.Type.Indexer != null)
            {
                defaultIndexerType = this.Type.Indexer;
            }
            DeserializeLookupList deserializeLookupList = new DeserializeLookupList(stream, 1, defaultIndexerType);

            if (this.Type.Indexer == null || this.Type.Indexer.Type == HeroTypes.None)
            {
                this.Type.Indexer = deserializeLookupList.indexerType;
            }
            else
            {
                deserializeLookupList.indexerType = this.Type.Indexer;
            }
            if (this.Type.Values == null)
            {
                this.Type.Values = deserializeLookupList.valueType;
            }
            else
            {
                deserializeLookupList.valueType = this.Type.Values;
            }
            for (ulong index = 0UL; index < (ulong)deserializeLookupList.Count; ++index)
            {
                HeroAnyValue key;
                int          variableId;
                deserializeLookupList.GetKey(out key, out variableId);
                HeroAnyValue heroAnyValue = HeroAnyValue.Create(this.Type.Values);
                heroAnyValue.Deserialize(stream);
                this.Data[new HeroVarId(variableId, key)] = heroAnyValue;
                if (variableId > this.nextId)
                {
                    this.nextId = variableId;
                }
            }
        }
Exemplo n.º 9
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass deserializeClass = new DeserializeClass(stream, 1);

            for (uint index = 0U; index < deserializeClass.Count; ++index)
            {
                uint  type1      = 0U;
                int   variableId = 0;
                ulong fieldId;
                int   d;
                deserializeClass.ReadFieldData(out fieldId, ref type1, ref variableId, out d);
                if (d != 2)
                {
                    HeroType     type2 = new HeroType((HeroTypes)type1);
                    DefinitionId field = new DefinitionId(fieldId);
                    if (field.Definition != null)
                    {
                        HeroFieldDef heroFieldDef = field.Definition as HeroFieldDef;
                        switch (heroFieldDef.FieldType.Type)
                        {
                        case HeroTypes.Enum:
                        case HeroTypes.ScriptRef:
                            type2.Id = heroFieldDef.FieldType.Id;
                            break;

                        case HeroTypes.LookupList:
                            type2 = heroFieldDef.FieldType;
                            break;
                        }
                    }
                    HeroAnyValue heroAnyValue = HeroAnyValue.Create(type2);
                    heroAnyValue.Deserialize(stream);
                    this.Variables.Add(new Variable(field, variableId, heroAnyValue));
                }
            }
        }
Exemplo n.º 10
0
        public override void Unmarshal(string data, bool asXml = true)
        {
            XmlNode root = this.GetRoot(data);

            this.Data = new Dictionary <HeroVarId, HeroAnyValue>();
            HeroAnyValue heroAnyValue1 = (HeroAnyValue)null;

            for (XmlNode xmlNode = root.FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
            {
                if (xmlNode.Name == "k")
                {
                    heroAnyValue1 = HeroAnyValue.Create(this.Type.Indexer);
                    heroAnyValue1.Unmarshal("<v>" + xmlNode.InnerText + "</v>", true);
                }
                if (xmlNode.Name == "e")
                {
                    HeroAnyValue heroAnyValue2 = HeroAnyValue.Create(this.Type.Values);
                    heroAnyValue2.Unmarshal("<v>" + xmlNode.InnerText + "</v>", true);
                    this.Data[new HeroVarId(0, heroAnyValue1)] = heroAnyValue2;
                    heroAnyValue1 = (HeroAnyValue)null;
                }
            }
            this.hasValue = true;
        }