Exemple #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));
                    }
                }
            }
        }
Exemple #2
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;
        }
Exemple #3
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));
                    }
                }
            }
        }
Exemple #4
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;
        }