Ejemplo n.º 1
0
        private void readEndOfLine(XmlReader reader)
        {
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    string attrName = reader.Name.ToLower();
                    switch (attrName)
                    {
                        case "convertonpaste":
                            _endOfLine_ConvertOnPaste = getBool(reader.Value);
                            break;
                        case "isvisible":
                            _endOfLine_IsVisisble = getBool(reader.Value);
                            break;
                        case "mode":
                            _endOfLine_Mode = (EndOfLineMode)Enum.Parse(typeof(EndOfLineMode), reader.Value, true);
                            break;
                    }
                }

                reader.MoveToElement();
            }

            reader.Skip();
        }
Ejemplo n.º 2
0
        public void Load(XmlDocument configDocument)
        {
            XmlNode langNode = configDocument.DocumentElement.SelectSingleNode("./Language[@Name='" + _language + "']");
            if (langNode == null)
                return;

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

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

                }
            }
            autoCNode = null;

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

            XmlElement 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")
                    _caret_BlinkRate = SystemInformation.CaretBlinkTime;
                else
                    _caret_BlinkRate = getInt(blinkRate);

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

            XmlElement clipboardNode = langNode.SelectSingleNode("Clipboard") as XmlElement;
            if (clipboardNode != null)
            {
                _clipboard_ConvertEndOfLineOnPaste = getBool(clipboardNode.GetAttribute("ConvertEndOfLineOnPaste"));
            }
            clipboardNode = null;

            _commands_KeyBindingList = new CommandBindingConfigList();
            XmlElement commandsNode = langNode.SelectSingleNode("Commands") as XmlElement;
            if (commandsNode != null)
            {
                _commands_KeyBindingList.Inherit = getBool(commandsNode.GetAttribute("Inherit"));
                _commands_KeyBindingList.AllowDuplicateBindings = getBool(commandsNode.GetAttribute("AllowDuplicateBindings"));
                foreach (XmlElement el in commandsNode.SelectNodes("./Binding"))
                {
                    KeyBinding kb = new KeyBinding();
                    kb.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);
                    }

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

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

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

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

                    if (ff.HasValue)
                        _folding_Flags = ff;
                }

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

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

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

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

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

            }
            indentationNode = null;

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

                    _indicator_List.Add(ic);
                }
            }

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

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

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

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

            }
            lexerNode = null;

            XmlElement lineWrapNode = langNode.SelectSingleNode("LineWrap") as XmlElement;
            if (lineWrapNode != null)
            {
                try
                {
                    _lineWrap_LayoutCache = (LineCache)Enum.Parse(typeof(LineCache), lineWrapNode.GetAttribute("LayoutCache"), true);
                }
                catch (ArgumentException) { }

                try
                {
                    _lineWrap_Mode = (WrapMode)Enum.Parse(typeof(WrapMode), lineWrapNode.GetAttribute("Mode"), true);
                }
                catch (ArgumentException) { }

                _lineWrap_PositionCacheSize = getInt(lineWrapNode.GetAttribute("PositionCacheSize"));
                _lineWrap_StartIndent = getInt(lineWrapNode.GetAttribute("StartIndent"));

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

                    if (wvf.HasValue)
                        _lineWrap_VisualFlags = wvf;
                }

                try
                {
                    _lineWrap_VisualFlagsLocation = (WrapVisualLocation)Enum.Parse(typeof(WrapVisualLocation), lineWrapNode.GetAttribute("VisualFlagsLocation"), true);
                }
                catch (ArgumentException) { }
            }
            lineWrapNode = null;

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

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

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

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

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

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

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

            XmlElement scrollingNode = langNode.SelectSingleNode("Scrolling") as XmlElement;
            if (scrollingNode != null)
            {
                _scrolling_EndAtLastLine = getBool(scrollingNode.GetAttribute("EndAtLastLine"));
                _scrolling_HorizontalWidth = 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)
                        _scrolling_ScrollBars = sb;
                }

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

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

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

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

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

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

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

            _styles = new StyleConfigList();
            XmlElement stylesNode = langNode.SelectSingleNode("Styles") as XmlElement;
            if (stylesNode != null)
            {
                _styles.Bits = getInt(stylesNode.GetAttribute("Bits"));
                foreach (XmlElement el in stylesNode.SelectNodes("Style"))
                {
                    StyleConfig sc = new StyleConfig();
                    sc.Name = el.GetAttribute("Name");
                    sc.Number = getInt(el.GetAttribute("Number"));
                    sc.BackColor = getColor(el.GetAttribute("BackColor"));
                    sc.Bold = 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 = getString(el.GetAttributeNode("FontName"));
                    sc.ForeColor = getColor(el.GetAttribute("ForeColor"));
                    sc.IsChangeable = getBool(el.GetAttribute("IsChangeable"));
                    sc.IsHotspot = getBool(el.GetAttribute("IsHotspot"));
                    sc.IsSelectionEolFilled = getBool(el.GetAttribute("IsSelectionEolFilled"));
                    sc.IsVisible = getBool(el.GetAttribute("IsVisible"));
                    sc.Italic = getBool(el.GetAttribute("Italic"));
                    sc.Size = getInt(el.GetAttribute("Size"));
                    sc.Underline = getBool(el.GetAttribute("Underline"));
                    sc.Inherit = getBool(el.GetAttribute("Inherit"));

                    _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"))
                    {
                        StyleConfig sc = new StyleConfig();
                        sc.Name = subLanguageName + "." + el.GetAttribute("Name");
                        sc.Number = getInt(el.GetAttribute("Number"));
                        sc.BackColor = getColor(el.GetAttribute("BackColor"));
                        sc.Bold = 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 = getString(el.GetAttributeNode("FontName"));
                        sc.ForeColor = getColor(el.GetAttribute("ForeColor"));
                        sc.IsChangeable = getBool(el.GetAttribute("IsChangeable"));
                        sc.IsHotspot = getBool(el.GetAttribute("IsHotspot"));
                        sc.IsSelectionEolFilled = getBool(el.GetAttribute("IsSelectionEolFilled"));
                        sc.IsVisible = getBool(el.GetAttribute("IsVisible"));
                        sc.Italic = getBool(el.GetAttribute("Italic"));
                        sc.Size = getInt(el.GetAttribute("Size"));
                        sc.Underline = getBool(el.GetAttribute("Underline"));
                        sc.Inherit = getBool(el.GetAttribute("Inherit"));

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

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

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

            configDocument = null;
        }