Example #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));
                    }
                }
            }
        }
Example #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));
                    }
                }
            }
        }