private static ScintillaNet.Configuration.StyleConfigList GetStyles(XmlElement xDocEle)
        {
            ScintillaNet.Configuration.StyleConfigList styles = new ScintillaNet.Configuration.StyleConfigList();

            XmlElement xStyles = (XmlElement)xDocEle.GetElementsByTagName("Styles")[0];
            foreach (XmlElement xStyle in xStyles.GetElementsByTagName("Style"))
            {
                ScintillaNet.Configuration.StyleConfig style = new ScintillaNet.Configuration.StyleConfig();

                XmlAttributeCollection xAttribs = xStyle.Attributes;
                foreach (XmlAttribute xAttrib in xAttribs)
                {
                    if (xAttrib.Name == "Name")
                    {
                        style.Name = xAttrib.Value;
                    }
                    else if (xAttrib.Name == "ForeColor")
                    {
                        Color foreColor = Color.FromName(xAttrib.Value);
                        style.ForeColor = foreColor;
                    }
                    else if (xAttrib.Name == "BackColor")
                    {
                        Color backColor = Color.FromName(xAttrib.Value);
                        style.BackColor = backColor;
                    }
                    else if (xAttrib.Name == "FontName")
                    {
                        style.FontName = xAttrib.Value;
                    }
                    else if (xAttrib.Name == "Size")
                    {
                        int size = 10;
                        if (int.TryParse(xAttrib.Value, out size))
                        {
                            style.Size = size;
                        }
                    }
                    else if (xAttrib.Name == "Bold")
                    {
                        style.Bold = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "Italic")
                    {
                        style.Italic = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "Underline")
                    {
                        style.Underline = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "EolFilled")
                    {
                        style.IsSelectionEolFilled = xAttrib.Value.ToLower().Trim() == "true";
                    }
                }

                styles.Add(style);
            }

            return styles;
        }
Exemplo n.º 2
0
        private static ScintillaNet.Configuration.StyleConfigList GetStyles(XmlElement xDocEle)
        {
            ScintillaNet.Configuration.StyleConfigList styles = new ScintillaNet.Configuration.StyleConfigList();

            XmlElement xStyles = (XmlElement)xDocEle.GetElementsByTagName("Styles")[0];

            foreach (XmlElement xStyle in xStyles.GetElementsByTagName("Style"))
            {
                ScintillaNet.Configuration.StyleConfig style = new ScintillaNet.Configuration.StyleConfig();

                XmlAttributeCollection xAttribs = xStyle.Attributes;
                foreach (XmlAttribute xAttrib in xAttribs)
                {
                    if (xAttrib.Name == "Name")
                    {
                        style.Name = xAttrib.Value;
                    }
                    else if (xAttrib.Name == "ForeColor")
                    {
                        Color foreColor = Color.FromName(xAttrib.Value);
                        style.ForeColor = foreColor;
                    }
                    else if (xAttrib.Name == "BackColor")
                    {
                        Color backColor = Color.FromName(xAttrib.Value);
                        style.BackColor = backColor;
                    }
                    else if (xAttrib.Name == "FontName")
                    {
                        style.FontName = xAttrib.Value;
                    }
                    else if (xAttrib.Name == "Size")
                    {
                        int size = 10;
                        if (int.TryParse(xAttrib.Value, out size))
                        {
                            style.Size = size;
                        }
                    }
                    else if (xAttrib.Name == "Bold")
                    {
                        style.Bold = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "Italic")
                    {
                        style.Italic = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "Underline")
                    {
                        style.Underline = xAttrib.Value.ToLower().Trim() == "true";
                    }
                    else if (xAttrib.Name == "EolFilled")
                    {
                        style.IsSelectionEolFilled = xAttrib.Value.ToLower().Trim() == "true";
                    }
                }

                styles.Add(style);
            }

            return(styles);
        }