protected static void Load() { ArrayList list = new ArrayList(); XmlRegistryKey rk = Helper.WindowsRegistry.RegistryKey.CreateSubKey("ExtTools"); string[] names = rk.GetSubKeyNames(); foreach (string name in names) { string rname = ToolLoaderItemExt.SplitName(name); XmlRegistryKey srk = rk.CreateSubKey(name); ToolLoaderItemExt tli = new ToolLoaderItemExt(rname); tli.Type = Convert.ToUInt32(srk.GetValue("type")); //tli.Name = Convert.ToString(srk.GetValue("name")); tli.FileName = Convert.ToString(srk.GetValue("filename")); tli.Attributes = Convert.ToString(srk.GetValue("attributes")); list.Add(tli); } items = new ToolLoaderItemExt[list.Count]; list.CopyTo(items); }
/// <summary> /// Parse a certain SubNode Level of the XML File /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseSubNode(XmlNode node, XmlRegistryKey key) { XmlRegistryKey subkey = key; //Remember the Name of the Node if (node.Name == "key") { subkey = key.CreateSubKey(node.Attributes["name"].Value); } foreach (XmlNode subnode in node) { if (subnode.Name == "key") { ParseSubNode(subnode, subkey); } ParseValues(subnode, subkey); if (subnode.Name == "list") { ParseListNode(subnode, subkey, false); } if (subnode.Name == "cilist") { ParseListNode(subnode, subkey, true); } } }
/// <summary> /// Put the Settings to the Registry /// </summary> public void SaveSettings() { XmlRegistryKey rk = Helper.WindowsRegistry.RegistryKey.CreateSubKey("ExtTools"); rk = rk.CreateSubKey(Helper.HexString(type) + "-" + name); rk.SetValue("name", Name); rk.SetValue("type", Type); rk.SetValue("filename", FileName); rk.SetValue("attributes", Attributes); }