コード例 #1
0
        public EnvironmentNode(XmlElement el)
        {
            List <EditorHighlightColor> envColors = new List <EditorHighlightColor>();
            List <string> envColorNames           = new List <string>();
            List <string> envColorDescriptions    = new List <string>();

            if (el != null)
            {
                foreach (XmlNode node in el.ChildNodes)
                {
                    if (node is XmlElement)
                    {
                        if (node.Name == "Custom")
                        {
                            envColorNames.Add(CustomColorPrefix + (node as XmlElement).GetAttribute("name"));
                            envColorDescriptions.Add((node as XmlElement).GetAttribute("name"));
                        }
                        else
                        {
                            envColorNames.Add(node.Name);
                            envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + node.Name + "}");
                        }
                        envColors.Add(new EditorHighlightColor((XmlElement)node));
                    }
                }
            }

            foreach (KeyValuePair <string, HighlightColor> pair in new DefaultHighlightingStrategy().EnvironmentColors)
            {
                if (!envColorNames.Contains(pair.Key))
                {
                    envColorNames.Add(pair.Key);
                    envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + pair.Key + "}");
                    envColors.Add(EditorHighlightColor.FromTextEditor(pair.Value));
                }
            }

            this.ColorNames = envColorNames.ToArray();
            this.ColorDescs = envColorDescriptions.ToArray();
            this.Colors     = envColors.ToArray();
            StringParser.Parse(ColorDescs);

            Text = ResNodeName("EnvironmentColors");

            panel = new EnvironmentOptionPanel(this);
        }
コード例 #2
0
		public EnvironmentNode(XmlElement el)
		{
			List<EditorHighlightColor> envColors = new List<EditorHighlightColor>();
			List<string> envColorNames = new List<string>();
			List<string> envColorDescriptions = new List<string>();
			
			if (el != null) {
				foreach (XmlNode node in el.ChildNodes) {
					if (node is XmlElement) {
						if (node.Name == "Custom") {
							envColorNames.Add(CustomColorPrefix + (node as XmlElement).GetAttribute("name"));
							envColorDescriptions.Add((node as XmlElement).GetAttribute("name"));
						} else {
							envColorNames.Add(node.Name);
							envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + node.Name + "}");
						}
						envColors.Add(new EditorHighlightColor((XmlElement)node));
					}
				}
			}
			
			foreach (KeyValuePair<string, HighlightColor> pair in new DefaultHighlightingStrategy().EnvironmentColors) {
				if (!envColorNames.Contains(pair.Key)) {
					envColorNames.Add(pair.Key);
					envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + pair.Key + "}");
					envColors.Add(EditorHighlightColor.FromTextEditor(pair.Value));
				}
			}
			
			this.ColorNames = envColorNames.ToArray();
			this.ColorDescs = envColorDescriptions.ToArray();
			this.Colors = envColors.ToArray();
			StringParser.Parse(ColorDescs);
			
			Text = ResNodeName("EnvironmentColors");
			
			panel = new EnvironmentOptionPanel(this);
		}