private static string Evaluate(string data) { return(PropertiesReader.Evaluate(data, GetByKey, ContainsKey)); }
private static void ApplyStyle(Lexer lexerType, SortedDictionary <int, ILexerStyle> styles, Queue <string> keyQueue, string var) { int styleIndex; if (keyQueue.Count == 1) { string strIndex = keyQueue.Dequeue(); if (!int.TryParse(strIndex, out styleIndex)) { if (lexerType != Lexer.Null) { object lexStyle = lexerType; styleIndex = (int)lexStyle; } else { styleIndex = 0; } } } else { styleIndex = 0; } ILexerStyle style = new LexerStyle(styleIndex); string styleData = Evaluate(var); Dictionary <string, string> dict = PropertiesReader.GetKeyValuePairs(styleData); foreach (string styleKey in dict.Keys) { styleData = dict[styleKey]; switch (styleKey) { case "font": style.FontName = styleData; break; case "size": style.FontSize = Convert.ToInt32(styleData); break; case "fore": style.ForeColor = ColorTranslator.FromHtml(styleData); break; case "back": style.BackColor = ColorTranslator.FromHtml(styleData); break; case "italics": style.Italics = true; break; case "notitalics": style.Italics = false; break; case "bold": style.Bold = true; break; case "notbold": style.Bold = false; break; case "eolfilled": style.EOLFilled = true; break; case "noteolfilled": style.EOLFilled = false; break; case "underlined": style.Underline = true; break; case "notunderlined": style.Underline = false; break; case "case": style.CaseVisibility = ((styleData == "m") ? StyleCase.Mixed : ((styleData == "u") ? StyleCase.Upper : StyleCase.Lower)); break; } } styles[styleIndex] = style; }