Example #1
0
            public void Save(TextWriter tw)
            {
                LogoScriptIDE.Config cfg = new LogoScriptIDE.Config();

                cfg.SetField(cfg_Comment, HighlightToString(HighlightSettings[cfg_Comment]));
                cfg.SetField(cfg_String, HighlightToString(HighlightSettings[cfg_String]));
                cfg.SetField(cfg_KeyWord, HighlightToString(HighlightSettings[cfg_KeyWord]));
                cfg.SetField(cfg_Function, HighlightToString(HighlightSettings[cfg_Function]));
                cfg.SetField(cfg_Digit, HighlightToString(HighlightSettings[cfg_Digit]));

                cfg.SetField(cfg_TextFont, TextFont);
                cfg.SetField(cfg_TextSize, TextSize.ToString());
                cfg.SetField(cfg_TextStyle, TextStyle == FontStyles.Italic ? "italic" : "normal");
                cfg.SetField(cfg_TextWeight, TextWeight == FontWeights.Bold ? "bold" : "normal");
                cfg.SetField(cfg_TextColor, ColorToString(TextColor));

                cfg.SetField(cfg_BackGroundColor, ColorToString(BackGroundColor));
                cfg.SetField(cfg_CurrentLineColor, ColorToString(CurrentLineColor));
                cfg.SetField(cfg_PauseArrowColor, ColorToString(PauseArrowColor));
                cfg.SetField(cfg_PauseLineColor, ColorToString(PauseLineColor));
                cfg.SetField(cfg_ErrorLineColor, ColorToString(ErrorLineColor));
                cfg.SetField(cfg_LineNumberColor, ColorToString(LineNumberColor));
                cfg.SetField(cfg_BreakpointColor, ColorToString(BreakpointColor));

                cfg.SetField(cfg_IndentionSize, IndentionSize.ToString());
                cfg.SetField(cfg_ShowLineNumber, ShowLineNumber ? "true" : "false");

                cfg.Save(tw);
            }
Example #2
0
            public void Load(TextReader tr)
            {
                LogoScriptIDE.Config cfg = new LogoScriptIDE.Config();
                cfg.Load(tr);

                HighlightSettings[cfg_Comment]  = StringToHighlight(cfg.GetField(cfg_Comment));
                HighlightSettings[cfg_String]   = StringToHighlight(cfg.GetField(cfg_String));
                HighlightSettings[cfg_KeyWord]  = StringToHighlight(cfg.GetField(cfg_KeyWord));
                HighlightSettings[cfg_Function] = StringToHighlight(cfg.GetField(cfg_Function));
                HighlightSettings[cfg_Digit]    = StringToHighlight(cfg.GetField(cfg_Digit));

                TextFont = cfg.GetField(cfg_TextFont);
                try { TextSize = Int32.Parse(cfg.GetField(cfg_TextSize)); }
                catch { TextSize = 16; }
                if (TextSize < 9 || TextSize > 100)
                {
                    TextSize = 16;
                }
                TextStyle = (cfg.GetField(cfg_TextStyle).ToLower() == "italic" ?
                             FontStyles.Italic : FontStyles.Normal);
                TextWeight = (cfg.GetField(cfg_TextWeight).ToLower() == "bold" ?
                              FontWeights.Bold : FontWeights.Normal);
                TextColor = StringToColor(cfg.GetField(cfg_TextColor));

                BackGroundColor  = StringToColor(cfg.GetField(cfg_BackGroundColor));
                CurrentLineColor = StringToColor(cfg.GetField(cfg_CurrentLineColor));
                PauseArrowColor  = StringToColor(cfg.GetField(cfg_PauseArrowColor));
                PauseLineColor   = StringToColor(cfg.GetField(cfg_PauseLineColor));
                ErrorLineColor   = StringToColor(cfg.GetField(cfg_ErrorLineColor));
                LineNumberColor  = StringToColor(cfg.GetField(cfg_LineNumberColor));
                BreakpointColor  = StringToColor(cfg.GetField(cfg_BreakpointColor));

                try { IndentionSize = Int32.Parse(cfg.GetField(cfg_IndentionSize)); }
                catch { IndentionSize = 4; }
                if (IndentionSize < 1 || IndentionSize > 8)
                {
                    IndentionSize = 4;
                }
                ShowLineNumber = (cfg.GetField(cfg_ShowLineNumber).ToLower() == "true" ? true : false);
            }