private void ReadSnippets(XmlReader reader)
        {
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    string attrName = reader.Name.ToLower();
                    switch (attrName)
                    {
                        case "activesnippetcolor":
                            this._snippetsConfigList.ActiveSnippetColor = this.getColor(reader.Value);
                            break;
                        case "activesnippetindicator":
                            this._snippetsConfigList.ActiveSnippetIndicator = this.getInt(reader.Value);
                            break;
                        case "inactivesnippetcolor":
                            this._snippetsConfigList.InactiveSnippetColor = this.getColor(reader.Value);
                            break;
                        case "inactivesnippetindicator":
                            this._snippetsConfigList.InactiveSnippetIndicator = this.getInt(reader.Value);
                            break;
                        case "activesnippetindicatorstyle":
                            this._snippetsConfigList.ActiveSnippetIndicatorStyle = (IndicatorStyle)Enum.Parse(typeof(IndicatorStyle), reader.Value, true);
                            break;
                        case "inactivesnippetindicatorstyle":
                            this._snippetsConfigList.InactiveSnippetIndicatorStyle = (IndicatorStyle)Enum.Parse(typeof(IndicatorStyle), reader.Value, true);
                            break;
                        case "defaultdelimeter":
                            this._snippetsConfigList.DefaultDelimeter = this.getChar(reader.Value);
                            break;
                        case "isenabled":
                            this._snippetsConfigList.IsEnabled = this.getBool(reader.Value);
                            break;
                        case "isonekeyselectionembedenabled":
                            this._snippetsConfigList.IsOneKeySelectionEmbedEnabled = this.getBool(reader.Value);
                            break;
                    }
                }

                reader.MoveToElement();
            }

            if (!reader.IsEmptyElement)
            {
                while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals("snippets", StringComparison.OrdinalIgnoreCase)))
                {
                    reader.Read();
                    if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("snippet", StringComparison.OrdinalIgnoreCase))
                    {
                        if (reader.HasAttributes)
                        {
                            var sc = new SnippetsConfig();
                            if (reader.HasAttributes)
                            {
                                while (reader.MoveToNextAttribute())
                                {
                                    string attrName = reader.Name.ToLower();
                                    switch (attrName)
                                    {

                                        case "shortcut":
                                            sc.Shortcut = reader.Value;
                                            break;
                                        case "delimeter":
                                            sc.Delimeter = this.getChar(reader.Value);
                                            break;
                                        case "issurroundswith":
                                            sc.IsSurroundsWith = this.getBool(reader.Value);
                                            break;
                                    }
                                }
                            }
                            reader.MoveToElement();
                            sc.Code = reader.ReadString();
                            this._snippetsConfigList.Add(sc);
                        }
                    }
                }
            }

            reader.Read();
        }
        public void Load(XmlDocument configDocument)
        {
            var langNode = configDocument.DocumentElement.SelectSingleNode("./Language[@Name='" + this._language + "']") as XmlElement;
            if (langNode == null)
                return;

            var autoCNode = langNode.SelectSingleNode("AutoComplete") as XmlElement;
            if (autoCNode != null)
            {
                this._autoComplete_AutoHide = this.getBool(autoCNode.GetAttribute("AutoHide"));
                this._autoComplete_AutomaticLengthEntered = this.getBool(autoCNode.GetAttribute("AutomaticLengthEntered"));
                this._autoComplete_cancelAtStart = this.getBool(autoCNode.GetAttribute("CancelAtStart"));
                this._autoComplete_DropRestOfWord = this.getBool(autoCNode.GetAttribute("DropRestOfWord"));
                this._autoComplete_fillUpCharacters = this.getString(autoCNode.GetAttributeNode("FillUpCharacters"));
                this._autoComplete_ImageSeperator = this.getChar(autoCNode.GetAttribute("AutomaticLengthEntered"));
                this._autoComplete_IsCaseSensitive = this.getBool(autoCNode.GetAttribute("IsCaseSensitive"));
                this._autoComplete_ListSeperator = this.getChar(autoCNode.GetAttribute("ListSeperator"));
                this._autoComplete_MaxHeight = this.getInt(autoCNode.GetAttribute("MaxHeight"));
                this._autoComplete_MaxWidth = this.getInt(autoCNode.GetAttribute("MaxWidth"));
                this._autoComplete_singleLineAccept = this.getBool(autoCNode.GetAttribute("SingleLineAccept"));
                this._autoComplete_StopCharacters = this.getString(autoCNode.GetAttributeNode("StopCharacters"));

                var listNode = autoCNode.SelectSingleNode("./List") as XmlElement;
                if (listNode != null)
                {
                    this._autoComplete_ListInherit = this.getBool(listNode.GetAttribute("Inherit"));
                    this._autoComplete_List = new Regex("\\s+").Replace(listNode.InnerText, " ").Trim();

                }
            }
            autoCNode = null;

            var callTipNode = langNode.SelectSingleNode("CallTip") as XmlElement;
            if (callTipNode != null)
            {
                this._callTip_BackColor = this.getColor(callTipNode.GetAttribute("BackColor"));
                this._callTip_ForeColor = this.getColor(callTipNode.GetAttribute("ForeColor"));
                this._callTip_HighlightTextColor = this.getColor(callTipNode.GetAttribute("HighlightTextColor"));
            }
            callTipNode = null;

            var caretNode = langNode.SelectSingleNode("Caret") as XmlElement;
            if (caretNode != null)
            {
                //	This guy is a bit of an oddball becuase null means "I don't Care"
                //	and we need some way of using the OS value.
                string blinkRate = caretNode.GetAttribute("BlinkRate");
                if (blinkRate.ToLower() == "system")
                    this._caret_BlinkRate = SystemInformation.CaretBlinkTime;
                else
                    this._caret_BlinkRate = this.getInt(blinkRate);

                this._caret_Color = this.getColor(caretNode.GetAttribute("Color"));
                this._caret_CurrentLineBackgroundAlpha = this.getInt(caretNode.GetAttribute("CurrentLineBackgroundAlpha"));
                this._caret_CurrentLineBackgroundColor = this.getColor(caretNode.GetAttribute("CurrentLineBackgroundColor"));
                this._caret_HighlightCurrentLine = this.getBool(caretNode.GetAttribute("HighlightCurrentLine"));
                this._caret_IsSticky = this.getBool(caretNode.GetAttribute("IsSticky"));
                try
                {
                    this._caret_Style = (CaretStyle)Enum.Parse(typeof(CaretStyle), caretNode.GetAttribute("Style"), true);
                }
                catch (ArgumentException) { }
                this._caret_Width = this.getInt(caretNode.GetAttribute("Width"));
            }
            caretNode = null;

            var clipboardNode = langNode.SelectSingleNode("Clipboard") as XmlElement;
            if (clipboardNode != null)
            {
                this._clipboard_ConvertLineBreaksOnPaste = this.getBool(clipboardNode.GetAttribute("ConvertLineBreaksOnPaste"));
            }
            clipboardNode = null;

            this._commands_KeyBindingList = new CommandBindingConfigList();
            var commandsNode = langNode.SelectSingleNode("Commands") as XmlElement;
            if (commandsNode != null)
            {
                this._commands_KeyBindingList.Inherit = this.getBool(commandsNode.GetAttribute("Inherit"));
                this._commands_KeyBindingList.AllowDuplicateBindings = this.getBool(commandsNode.GetAttribute("AllowDuplicateBindings"));
                foreach (XmlElement el in commandsNode.SelectNodes("./Binding"))
                {
                    var kb = new KeyBinding
                    {
                        KeyCode = Utilities.GetKeys(el.GetAttribute("Key"))
                    };

                    string modifiers = el.GetAttribute("Modifier");
                    if (modifiers != string.Empty)
                    {
                        foreach (string modifier in modifiers.Split(' '))
                            kb.Modifiers |= (Keys)Enum.Parse(typeof(Keys), modifier.Trim(), true);
                    }

                    var cmd = (BindableCommand)Enum.Parse(typeof(BindableCommand), el.GetAttribute("Command"), true);
                    var cfg = new CommandBindingConfig(kb, this.getBool(el.GetAttribute("ReplaceCurrent")), cmd);
                    this._commands_KeyBindingList.Add(cfg);
                }
            }
            commandsNode = null;

            var endOfLineNode = langNode.SelectSingleNode("EndOfLine") as XmlElement;
            if (endOfLineNode != null)
            {
                this._endOfLine_IsVisisble = this.getBool(endOfLineNode.GetAttribute("IsVisible"));

                try
                {
                    this._endOfLine_Mode = (EndOfLineMode)Enum.Parse(typeof(EndOfLineMode), endOfLineNode.GetAttribute("Mode"), true);
                }
                catch (ArgumentException) { }
            }
            endOfLineNode = null;

            var foldingNode = langNode.SelectSingleNode("Folding") as XmlElement;
            if (foldingNode != null)
            {
                string flags = foldingNode.GetAttribute("Flags").Trim();
                if (flags != string.Empty)
                {
                    FoldFlag? ff = flags.Split(' ').Aggregate<string, FoldFlag?>(null,
                        (current, flag) => current | (FoldFlag)Enum.Parse(typeof(FoldFlag), flag.Trim(), true));

                    if (ff.HasValue)
                        this._folding_Flags = ff;
                }

                this._folding_IsEnabled = this.getBool(foldingNode.GetAttribute("IsEnabled"));
                try
                {
                    this._folding_MarkerScheme = (FoldMarkerScheme)Enum.Parse(typeof(FoldMarkerScheme), foldingNode.GetAttribute("MarkerScheme"), true);
                }
                catch (ArgumentException) { }

                this._folding_UseCompactFolding = this.getBool(foldingNode.GetAttribute("UseCompactFolding"));
            }
            foldingNode = null;

            var hotSpotNode = langNode.SelectSingleNode("Hotspot") as XmlElement;
            if (hotSpotNode != null)
            {
                this._hotspot_ActiveBackColor = this.getColor(hotSpotNode.GetAttribute("ActiveBackColor"));
                this._hotspot_ActiveForeColor = this.getColor(hotSpotNode.GetAttribute("ActiveForeColor"));
                this._hotspot_ActiveUnderline = this.getBool(hotSpotNode.GetAttribute("ActiveUnderline"));
                this._hotspot_SingleLine = this.getBool(hotSpotNode.GetAttribute("SingleLine"));
                this._hotspot_UseActiveBackColor = this.getBool(hotSpotNode.GetAttribute("UseActiveBackColor"));
                this._hotspot_UseActiveForeColor = this.getBool(hotSpotNode.GetAttribute("UseActiveForeColor"));
            }
            hotSpotNode = null;

            var indentationNode = langNode.SelectSingleNode("Indentation") as XmlElement;
            if (indentationNode != null)
            {
                this._indentation_BackspaceUnindents = this.getBool(indentationNode.GetAttribute("BackspaceUnindents"));
                this._indentation_IndentWidth = this.getInt(indentationNode.GetAttribute("IndentWidth"));
                this._indentation_ShowGuides = this.getBool(indentationNode.GetAttribute("ShowGuides"));
                this._indentation_TabIndents = this.getBool(indentationNode.GetAttribute("TabIndents"));
                this._indentation_TabWidth = this.getInt(indentationNode.GetAttribute("TabWidth"));
                this._indentation_UseTabs = this.getBool(indentationNode.GetAttribute("UseTabs"));

                try
                {
                    this._indentation_SmartIndentType = (SmartIndent)Enum.Parse(typeof(SmartIndent), indentationNode.GetAttribute("SmartIndentType"), true);
                }
                catch (ArgumentException) { }

            }
            indentationNode = null;

            var indicatorNode = langNode.SelectSingleNode("Indicators") as XmlElement;
            if (indicatorNode != null)
            {
                this._indicator_List.Inherit = this.getBool(indicatorNode.GetAttribute("Inherit"));
                foreach (XmlElement el in indicatorNode.SelectNodes("Indicator"))
                {
                    var ic = new IndicatorConfig
                    {
                        Number = int.Parse(el.GetAttribute("Number")),
                        Color = this.getColor(el.GetAttribute("Color")),
                        Inherit = this.getBool(el.GetAttribute("Inherit")),
                        IsDrawnUnder = this.getBool(el.GetAttribute("IsDrawnUnder"))
                    };
                    try
                    {
                        ic.Style = (IndicatorStyle)Enum.Parse(typeof(IndicatorStyle), el.GetAttribute("Style"), true);
                    }
                    catch (ArgumentException) { }

                    this._indicator_List.Add(ic);
                }
            }

            this._lexing_Properties = new LexerPropertiesConfig();
            this._lexing_Keywords = new KeyWordConfigList();
            var lexerNode = langNode.SelectSingleNode("Lexer") as XmlElement;
            if (lexerNode != null)
            {
                this._lexing_WhitespaceChars = this.getString(lexerNode.GetAttributeNode("WhitespaceChars"));
                this._lexing_WordChars = this.getString(lexerNode.GetAttributeNode("WordChars"));
                this._lexing_Language = this.getString(lexerNode.GetAttributeNode("LexerName"));
                this._lexing_LineCommentPrefix = this.getString(lexerNode.GetAttributeNode("LineCommentPrefix"));
                this._lexing_StreamCommentPrefix = this.getString(lexerNode.GetAttributeNode("StreamCommentPrefix"));
                this._lexing_StreamCommentSuffix = this.getString(lexerNode.GetAttributeNode("StreamCommentSuffix"));

                var propNode = lexerNode.SelectSingleNode("Properties") as XmlElement;
                if (propNode != null)
                {
                    this._lexing_Properties.Inherit = this.getBool(propNode.GetAttribute("Inherit"));

                    foreach (XmlElement el in propNode.SelectNodes("Property"))
                        this._lexing_Properties.Add(el.GetAttribute("Name"), el.GetAttribute("Value"));
                }

                foreach (XmlElement el in lexerNode.SelectNodes("Keywords"))
                    this._lexing_Keywords.Add(new KeyWordConfig(this.getInt(el.GetAttribute("List")).Value, el.InnerText.Trim(), this.getBool(el.GetAttribute("Inherit"))));

            }
            lexerNode = null;

            var lineWrapNode = langNode.SelectSingleNode("LineWrapping") as XmlElement;
            if (lineWrapNode != null)
            {
                try
                {
                    this._lineWrapping_Mode = (LineWrappingMode)Enum.Parse(typeof(LineWrappingMode), lineWrapNode.GetAttribute("Mode"), true);
                }
                catch (ArgumentException) { }

                this._lineWrapping_IndentSize = this.getInt(lineWrapNode.GetAttribute("IndentSize"));

                try
                {
                    this._lineWrapping_IndentMode = (LineWrappingIndentMode)Enum.Parse(typeof(LineWrappingIndentMode), lineWrapNode.GetAttribute("IndentMode"), true);
                }
                catch (ArgumentException) { }

                string flags = lineWrapNode.GetAttribute("VisualFlags").Trim();
                if (flags != string.Empty)
                {
                    LineWrappingVisualFlags? wvf = null;
                    foreach (string flag in flags.Split(' '))
                        wvf |= (LineWrappingVisualFlags)Enum.Parse(typeof(LineWrappingVisualFlags), flag.Trim(), true);

                    if (wvf.HasValue)
                        this._lineWrapping_VisualFlags = wvf;
                }

                try
                {
                    this._lineWrapping_VisualFlagsLocations = (LineWrappingVisualFlagsLocations)Enum.Parse(typeof(LineWrappingVisualFlagsLocations), lineWrapNode.GetAttribute("VisualFlagsLocations"), true);
                }
                catch (ArgumentException) { }
            }
            lineWrapNode = null;

            var longLinesNode = langNode.SelectSingleNode("LongLines") as XmlElement;
            if (longLinesNode != null)
            {
                this._longLines_EdgeColor = this.getColor(longLinesNode.GetAttribute("EdgeColor"));
                this._longLines_EdgeColumn = this.getInt(longLinesNode.GetAttribute("EdgeColumn"));
                try
                {
                    this._longLines_EdgeMode = (EdgeMode)Enum.Parse(typeof(EdgeMode), longLinesNode.GetAttribute("EdgeMode"), true);
                }
                catch (ArgumentException) { }
            }
            longLinesNode = null;

            this._margin_List = new MarginConfigList();
            var marginNode = langNode.SelectSingleNode("Margins") as XmlElement;
            if (marginNode != null)
            {
                this._margin_List.FoldMarginColor = this.getColor(marginNode.GetAttribute("FoldMarginColor"));
                this._margin_List.FoldMarginHighlightColor = this.getColor(marginNode.GetAttribute("FoldMarginHighlightColor"));
                this._margin_List.Left = this.getInt(marginNode.GetAttribute("Left"));
                this._margin_List.Right = this.getInt(marginNode.GetAttribute("Right"));
                this._margin_List.Inherit = this.getBool(marginNode.GetAttribute("Inherit"));

                foreach (XmlElement el in marginNode.SelectNodes("./Margin"))
                {
                    var mc = new MarginConfig
                    {
                        Number = int.Parse(el.GetAttribute("Number")),
                        Inherit = this.getBool(el.GetAttribute("Inherit")),
                        AutoToggleMarkerNumber = this.getInt(el.GetAttribute("AutoToggleMarkerNumber")),
                        IsClickable = this.getBool(el.GetAttribute("IsClickable")),
                        IsFoldMargin = this.getBool(el.GetAttribute("IsFoldMargin")),
                        IsMarkerMargin = this.getBool(el.GetAttribute("IsMarkerMargin"))
                    };
                    try
                    {
                        mc.Type = (MarginType)Enum.Parse(typeof(MarginType), el.GetAttribute("Type"), true);
                    }
                    catch (ArgumentException) { }

                    mc.Width = this.getInt(el.GetAttribute("Width"));

                    this._margin_List.Add(mc);
                }
            }
            marginNode = null;

            var markersNode = langNode.SelectSingleNode("Markers") as XmlElement;
            this._markers_List = new MarkersConfigList();
            if (markersNode != null)
            {
                this._markers_List.Inherit = this.getBool(markersNode.GetAttribute("Inherit"));

                foreach (XmlElement el in markersNode.SelectNodes("Marker"))
                {
                    var mc = new MarkersConfig
                    {
                        Alpha = this.getInt(el.GetAttribute("Alpha")),
                        BackColor = this.getColor(el.GetAttribute("BackColor")),
                        ForeColor = this.getColor(el.GetAttribute("ForeColor")),
                        Name = this.getString(el.GetAttributeNode("Name")),
                        Number = this.getInt(el.GetAttribute("Number")),
                        Inherit = this.getBool(el.GetAttribute("Inherit"))
                    };
                    try
                    {
                        mc.Symbol = (MarkerSymbol)Enum.Parse(typeof(MarkerSymbol), el.GetAttribute("Symbol"), true);
                    }
                    catch (ArgumentException) { }
                    this._markers_List.Add(mc);
                }
            }

            var scrollingNode = langNode.SelectSingleNode("Scrolling") as XmlElement;
            if (scrollingNode != null)
            {
                this._scrolling_EndAtLastLine = this.getBool(scrollingNode.GetAttribute("EndAtLastLine"));
                this._scrolling_HorizontalWidth = this.getInt(scrollingNode.GetAttribute("HorizontalWidth"));

                string flags = scrollingNode.GetAttribute("ScrollBars").Trim();
                if (flags != string.Empty)
                {
                    ScrollBars? sb = null;
                    foreach (string flag in flags.Split(' '))
                        sb |= (ScrollBars)Enum.Parse(typeof(ScrollBars), flag.Trim(), true);

                    if (sb.HasValue)
                        this._scrolling_ScrollBars = sb;
                }

                this._scrolling_XOffset = this.getInt(scrollingNode.GetAttribute("XOffset"));
            }
            scrollingNode = null;

            var selectionNode = langNode.SelectSingleNode("Selection") as XmlElement;
            if (selectionNode != null)
            {
                this._selection_BackColor = this.getColor(selectionNode.GetAttribute("BackColor"));
                this._selection_BackColorUnfocused = this.getColor(selectionNode.GetAttribute("BackColorUnfocused"));
                this._selection_ForeColor = this.getColor(selectionNode.GetAttribute("ForeColor"));
                this._selection_ForeColorUnfocused = this.getColor(selectionNode.GetAttribute("ForeColorUnfocused"));
                this._selection_Hidden = this.getBool(selectionNode.GetAttribute("Hidden"));
                this._selection_HideSelection = this.getBool(selectionNode.GetAttribute("HideSelection"));
                try
                {
                    this._selection_Mode = (SelectionMode)Enum.Parse(typeof(SelectionMode), selectionNode.GetAttribute("Mode"), true);
                }
                catch (ArgumentException) { }
            }
            selectionNode = null;

            this._snippetsConfigList = new SnippetsConfigList();
            var snippetsNode = langNode.SelectSingleNode("Snippets") as XmlElement;
            if (snippetsNode != null)
            {
                this._snippetsConfigList.ActiveSnippetColor = this.getColor(snippetsNode.GetAttribute("ActiveSnippetColor"));
                this._snippetsConfigList.ActiveSnippetIndicator = this.getInt(snippetsNode.GetAttribute("ActiveSnippetIndicator"));
                this._snippetsConfigList.InactiveSnippetColor = this.getColor(snippetsNode.GetAttribute("InactiveSnippetColor"));
                this._snippetsConfigList.InactiveSnippetIndicator = this.getInt(snippetsNode.GetAttribute("InactiveSnippetIndicator"));

                try
                {
                    this._snippetsConfigList.ActiveSnippetIndicatorStyle = (IndicatorStyle)Enum.Parse(typeof(IndicatorStyle), snippetsNode.GetAttribute("ActiveSnippetIndicatorStyle"), true);
                }
                catch (ArgumentException) { }

                try
                {
                    this._snippetsConfigList.InactiveSnippetIndicatorStyle = (IndicatorStyle)Enum.Parse(typeof(IndicatorStyle), snippetsNode.GetAttribute("InactiveSnippetIndicatorStyle"), true);
                }
                catch (ArgumentException) { }

                this._snippetsConfigList.DefaultDelimeter = this.getChar(snippetsNode.GetAttribute("DefaultDelimeter"));
                this._snippetsConfigList.IsEnabled = this.getBool(snippetsNode.GetAttribute("IsEnabled"));
                this._snippetsConfigList.IsOneKeySelectionEmbedEnabled = this.getBool(snippetsNode.GetAttribute("IsOneKeySelectionEmbedEnabled"));

                foreach (XmlElement el in snippetsNode.SelectNodes("Snippet"))
                {
                    var sc = new SnippetsConfig
                    {
                        Shortcut = el.GetAttribute("Shortcut"),
                        Code = el.InnerText,
                        Delimeter = this.getChar(el.GetAttribute("Delimeter")),
                        IsSurroundsWith = this.getBool(el.GetAttribute("IsSurroundsWith"))
                    };
                    this._snippetsConfigList.Add(sc);
                }
            }
            snippetsNode = null;

            this._styles = new StyleConfigList();
            var stylesNode = langNode.SelectSingleNode("Styles") as XmlElement;
            if (stylesNode != null)
            {
                this._styles.Bits = this.getInt(stylesNode.GetAttribute("Bits"));
                foreach (XmlElement el in stylesNode.SelectNodes("Style"))
                {
                    var sc = new StyleConfig
                    {
                        Name = el.GetAttribute("Name"),
                        Number = this.getInt(el.GetAttribute("Number")),
                        BackColor = this.getColor(el.GetAttribute("BackColor")),
                        Bold = this.getBool(el.GetAttribute("Bold"))
                    };
                    try
                    {
                        sc.Case = (StyleCase)Enum.Parse(typeof(StyleCase), el.GetAttribute("Case"), true);
                    }
                    catch (ArgumentException) { }

                    try
                    {
                        sc.CharacterSet = (CharacterSet)Enum.Parse(typeof(CharacterSet), el.GetAttribute("CharacterSet"), true);
                    }
                    catch (ArgumentException) { }

                    sc.FontName = this.getString(el.GetAttributeNode("FontName"));
                    sc.ForeColor = this.getColor(el.GetAttribute("ForeColor"));
                    sc.IsChangeable = this.getBool(el.GetAttribute("IsChangeable"));
                    sc.IsHotspot = this.getBool(el.GetAttribute("IsHotspot"));
                    sc.IsSelectionEolFilled = this.getBool(el.GetAttribute("IsSelectionEolFilled"));
                    sc.IsVisible = this.getBool(el.GetAttribute("IsVisible"));
                    sc.Italic = this.getBool(el.GetAttribute("Italic"));
                    sc.Size = this.getInt(el.GetAttribute("Size"));
                    sc.Underline = this.getBool(el.GetAttribute("Underline"));
                    sc.Inherit = this.getBool(el.GetAttribute("Inherit"));

                    this._styles.Add(sc);
                }

                //	This is a nifty added on hack made specifically for HTML.
                //	Normally the style config elements are quite managable as there
                //	are typically less than 10 when you don't count common styles.
                //
                //	However HTML uses 9 different Sub languages that combined make
                //	use of all 128 styles (well there are some small gaps). In order
                //	to make this more managable I did added a SubLanguage element that
                //	basically just prepends the Language's name and "." to the Style
                //	Name definition.
                //
                //	So for example if you had the following
                //	<Styles>
                //		<SubLanguage Name="ASP JavaScript">
                //			<Style Name="Keyword" Bold="True" />
                //		</SubLanguage>
                //	</Styles>
                //	That style's name will get interpreted as "ASP JavaScript.Keyword".
                //	which if you look at the html.txt in LexerStyleNames you'll see it
                //	maps to Style # 62

                //	Yeah I copied and pasted from above. I know. Feel free to refactor
                //	this and check it in since you're so high and mighty.
                foreach (XmlElement subLanguage in stylesNode.SelectNodes("SubLanguage"))
                {
                    string subLanguageName = subLanguage.GetAttribute("Name");
                    foreach (XmlElement el in subLanguage.SelectNodes("Style"))
                    {
                        var sc = new StyleConfig
                        {
                            Name = subLanguageName + "." + el.GetAttribute("Name"),
                            Number = this.getInt(el.GetAttribute("Number")),
                            BackColor = this.getColor(el.GetAttribute("BackColor")),
                            Bold = this.getBool(el.GetAttribute("Bold"))
                        };
                        try
                        {
                            sc.Case = (StyleCase)Enum.Parse(typeof(StyleCase), el.GetAttribute("Case"), true);
                        }
                        catch (ArgumentException) { }

                        try
                        {
                            sc.CharacterSet = (CharacterSet)Enum.Parse(typeof(CharacterSet), el.GetAttribute("CharacterSet"), true);
                        }
                        catch (ArgumentException) { }

                        sc.FontName = this.getString(el.GetAttributeNode("FontName"));
                        sc.ForeColor = this.getColor(el.GetAttribute("ForeColor"));
                        sc.IsChangeable = this.getBool(el.GetAttribute("IsChangeable"));
                        sc.IsHotspot = this.getBool(el.GetAttribute("IsHotspot"));
                        sc.IsSelectionEolFilled = this.getBool(el.GetAttribute("IsSelectionEolFilled"));
                        sc.IsVisible = this.getBool(el.GetAttribute("IsVisible"));
                        sc.Italic = this.getBool(el.GetAttribute("Italic"));
                        sc.Size = this.getInt(el.GetAttribute("Size"));
                        sc.Underline = this.getBool(el.GetAttribute("Underline"));
                        sc.Inherit = this.getBool(el.GetAttribute("Inherit"));

                        this._styles.Add(sc);
                    }
                }
            }
            stylesNode = null;

            var undoRedoNode = langNode.SelectSingleNode("UndoRedo") as XmlElement;
            if (undoRedoNode != null)
            {
                this._undoRedoIsUndoEnabled = this.getBool(undoRedoNode.GetAttribute("IsUndoEnabled"));
            }
            undoRedoNode = null;

            var whitespaceNode = langNode.SelectSingleNode("Whitespace") as XmlElement;
            if (whitespaceNode != null)
            {
                this._whitespace_BackColor = this.getColor(whitespaceNode.GetAttribute("BackColor"));
                this._whitespace_ForeColor = this.getColor(whitespaceNode.GetAttribute("ForeColor"));
                this._whitespace_Mode = (WhitespaceMode)Enum.Parse(typeof(WhitespaceMode), whitespaceNode.GetAttribute("Mode"), true);
            }
            whitespaceNode = null;

            configDocument = null;
        }