Exemplo n.º 1
0
            public XmlRKContainer(XmlDocument xmlDoc)
                : base("caspPresetXML", null, "caspPresetXML", null)
            {
                this.xmlDocument = xmlDoc;
                int          i, foundIndex, length = CasRgbMaskWantedKeys.Length;
                XmlAttribute keyAttr, valueAttr;
                string       keyStr, valueStr;

                foreach (XmlElement elem in xmlDoc.GetElementsByTagName("value"))
                {
                    keyAttr = elem.Attributes["key"];
                    if (keyAttr != null)
                    {
                        keyStr = keyAttr.Value;
                        if (!string.IsNullOrEmpty(keyStr))
                        {
                            foundIndex = -1;
                            for (i = 0; i < length && foundIndex < 0; i++)
                            {
                                if (CasRgbMaskWantedKeys[i].Equals(keyStr))
                                {
                                    foundIndex = i;
                                }
                            }
                            if (foundIndex >= 0)
                            {
                                valueAttr = elem.Attributes["value"];
                                if (valueAttr != null)
                                {
                                    valueStr = valueAttr.Value;
                                    if (valueStr != null)
                                    {
                                        RK rk;
                                        if (TextRKContainer.ParseRK(valueStr.Substring(4), out rk))
                                        {
                                            this.oldToNewRKs.Add(new RKElem(keyStr, rk, elem));
                                            this.owners.Add(new DefaultConnection(rk, this,
                                                                                  ResourceDataActions.FindWrite,
                                                                                  "caspPresetXML{" + keyStr + "}"));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
Exemplo n.º 2
0
 public void Commit()
 {
     this.Element.SetAttribute("value",
                               "key:" + TextRKContainer.PrintRK(this.NewResourceKey));
 }