private void ParseAnimations(XmlNode xmlNode)
        {
            var animation = new Animation();

            XmlFileBuddy.ReadChildNodes(xmlNode, animation.ParseXmlNode);
            Animations.Add(animation);
        }
Esempio n. 2
0
        public void ParseCardXmlNodes(XmlNode xmlNode)
        {
            //create a new translation
            var translation = new Translation();

            //read it in
            XmlFileBuddy.ReadChildNodes(xmlNode, translation.ParseChildNode);

            //If there was no translation in the card, don't store it
            if (!string.IsNullOrEmpty(translation.Language) && !string.IsNullOrEmpty(translation.Word))
            {
                //store the card
                Translations.Add(translation);
            }
        }
Esempio n. 3
0
        private void ParseCardXmlNodes(XmlNode xmlNode)
        {
            //create a new flash card
            var card = new FlashCard()
            {
                Language1 = this.Language1,
                Language2 = this.Language2
            };

            //read it in
            XmlFileBuddy.ReadChildNodes(xmlNode, card.ParseChildNode);

            //store the card
            Cards.Add(card);
        }
        public void ParseXml(XmlNode xmlNode)
        {
            string name  = xmlNode.Name;
            string value = xmlNode.InnerText;

            switch (name)
            {
            case "AssetName":
            {
                //AssetName = value;
            }
            break;

            case "TextureName":
            {
                var sb = new StringBuilder();
                sb.Append(@"Textures\");
                sb.Append(value);
                sb.Append(@".png");
                TextureFilename = new Filename(sb.ToString());
            }
            break;

            case "FrameDimensions":
            {
                FrameDimensions = value.ToPoint();
            }
            break;

            case "FramesPerRow":
            {
                FramesPerRow = Convert.ToInt32(value);
            }
            break;

            case "SourceOffset":
            {
                SourceOffset = value.ToVector2();
            }
            break;

            case "Animations":
            {
                XmlFileBuddy.ReadChildNodes(xmlNode, ParseAnimations);
            }
            break;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Read in all each individual peice of data for this content entry
        /// </summary>
        /// <param name="xmlNode"></param>
        public void ParseChildNode(XmlNode xmlNode)
        {
            string name  = xmlNode.Name;
            string value = xmlNode.InnerText;

            switch (name.ToLower())
            {
            case "words":
            {
                XmlFileBuddy.ReadChildNodes(xmlNode, ParseCardXmlNodes);
            }
            break;

            case "word":
            {
                //add a translation with language1
                Translations.Add(new Translation
                    {
                        Language = Language1,
                        Word     = value
                    }
                                 );
            }
            break;

            case "translation":
            {
                //add a translation with language1
                Translations.Add(new Translation
                    {
                        Language = Language2,
                        Word     = value
                    }
                                 );
            }
            break;

            default:
            {
                throw new Exception(string.Format("bad xml name passed to flash card: {0}", name));
            }
            }
        }