예제 #1
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc = xDoc;
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            NowLoading = this;
            try
            {
                _color = ValueParser.StringToColor(XmlGetter.Attribute(rootNode, "Color"));
            }
            catch
            {
                _color = Color.Black;
            }
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode child = rootNode.ChildNodes[i];

                if (child.Name.Equals("String"))
                {
                    _formatItems.Add(new FormatItem(FormatItem.FormatItemType.String, child.InnerText));
                }
                else if (child.Name.Equals("FieldItem"))
                {
                    String parser = XmlGetter.Attribute(child, "Parser");
                    if (parser.Length > 0)
                    {
                        string[] args = ValueParser.GetArgs(parser, XmlGetter.Attribute(child, "Args"));
                        _formatItems.Add(new FormatItem(FormatItem.FormatItemType.FieldItem, args));
                    }
                    else
                    {
                        _formatItems.Add(new FormatItem(FormatItem.FormatItemType.FieldItem));
                    }
                }
            }
        }