コード例 #1
0
        public static void Fill()
        {
            labels = new Dictionary <string, RomLabel>();

            foreach (XmlNode node in XML.GetLabelNodes())
            {
                RomLabel label = new RomLabel();
                label.Name  = node.Attributes["Name"].Value;
                label.Color = Color.FromArgb((Convert.ToInt32(node.Attributes["Color"].Value)));
                labels.Add(label.Name.ToLower(), label);
            }
        }
コード例 #2
0
        public static bool Set(RomLabel label)
        {
            XmlNode node = XML.GetLabelNode(label.Name);

            if (node == null)
            {
                node = XML.xmlLabels.CreateNode(XmlNodeType.Element, "Label", "");
                node.Attributes.Append(XML.xmlLabels.CreateAttribute("Name"));
                node.Attributes.Append(XML.xmlLabels.CreateAttribute("Color"));
                XML.GetParentNode(XML.xmlLabels, "Labels").AppendChild(node);
                labels.Add(label.Name.ToLower(), label);
            }

            labels[label.Name.ToLower()]   = label;
            node.Attributes["Name"].Value  = label.Name;
            node.Attributes["Color"].Value = label.Color.ToArgb().ToString();
            XML.SaveXmlLabels();
            return(true);
        }