Example #1
0
        public IDictionary <string, string> WorkOnElement(IAwareXmlTextReader xmlReader)
        {
            if (xmlReader.Name == "div" && xmlReader.GetAttribute("class") == "value")
            {
                string value = null;
                while (xmlReader.Read())
                {
                    if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "img")
                    {
                        string symbol = SymbolParser.Parse(xmlReader);
                        if (string.IsNullOrEmpty(value))
                        {
                            value = symbol;
                        }
                        else
                        {
                            value += " " + symbol;
                        }
                    }
                }
                if (string.IsNullOrEmpty(value))
                {
                    throw new ParserException("No Text element found in Element");
                }

                return(new Dictionary <string, string> {
                    { CardParserBase.ManaCostKey, value }
                });
            }
            return(new Dictionary <string, string>());
        }
Example #2
0
        private string WorkOnTextBox(IAwareXmlTextReader xmlReader)
        {
            string value = string.Empty;

            while (xmlReader.Read())
            {
                string text = null;
                if (xmlReader.NodeType == XmlNodeType.Text)
                {
                    text = xmlReader.Value.HtmlTrim();
                }
                else if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "img")
                {
                    text = SymbolParser.Parse(xmlReader);
                }

                if (!string.IsNullOrWhiteSpace(text))
                {
                    value += " " + text;
                }
            }

            return(value.HtmlTrim());
        }