/// <summary> /// 转换成枚举 /// </summary> public static int KeyWordTypeToValue(KeyWordTypeEnum enumOption) { try{ return((int)enumOption); }catch (Exception ex) { throw new ArgumentException("enumOption", ex); } }
public KeyWordInfo(KeyWordTypeEnum type, string name, Color color) { this.type = type; this.name = name; this.color = color; }
private void AddKeyword(KeyWordTypeEnum type, string name, Color color) { m_KeyWordColorList.Add(name, new KeyWordInfo(type, name, color)); }
public KeyWords(string ColorScheme, XmlDocument xml) { this.m_RegexColorList = new ArrayList(); this.m_KeyWordColorList = new Hashtable(); this.xml = xml; string strRegexSplitter = ""; foreach (XmlNode words in xml.SelectNodes("//Words")) { Color color = Color.FromArgb(int.Parse(words.Attributes[ColorScheme].InnerText.Replace("#", ""), System.Globalization.NumberStyles.HexNumber)); KeyWordTypeEnum type = KeyWordTypeEnum.Unknown; if (words.Attributes["icon"] != null) { switch (words.Attributes["icon"].InnerText) { case "Functions": type = KeyWordTypeEnum.Functions; break; case "Events": type = KeyWordTypeEnum.Events; break; case "Constants": type = KeyWordTypeEnum.Constants; break; case "Class": type = KeyWordTypeEnum.Class; break; case "Vars": type = KeyWordTypeEnum.Vars; break; case "States": type = KeyWordTypeEnum.States; break; case "Enum": if (!Properties.Settings.Default.CodeCompletionAnimation) { continue; } type = KeyWordTypeEnum.Properties; break; default: type = KeyWordTypeEnum.Unknown; break; } } foreach (XmlNode word in words.SelectNodes(".//Word")) { if (word.Attributes["name"].InnerText == "regex") { string strRegex = word.InnerText; AddRegex(strRegex, color); if (strRegexSplitter != "") { strRegexSplitter += "|"; } strRegexSplitter += strRegex; } else { AddKeyword(type, word.Attributes["name"].InnerText, color); } } } MakeSplitter(strRegexSplitter); }