/// <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); }
/// <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> /// <param name="caseinvariant">true if you want a case Invariant List</param> void ParseListNode(XmlNode node, XmlRegistryKey key, bool caseinvariant) { XmlRegistryKey subkey = new XmlRegistryKey(); ArrayList names = new ArrayList(); foreach (XmlNode subnode in node) { if (subnode.Attributes == null) { continue; } names.Add(subnode.Attributes["name"].Value); ParseValues(subnode, subkey); } ArrayList list = null; if (!caseinvariant) { list = new ArrayList(); } else { list = new Ambertation.CaseInvariantArrayList(); } foreach (string s in names) { list.Add(subkey.GetValue(s)); } key.SetValue(node.Attributes["name"].Value, list); }
/// <summary> /// Add an Float Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseFloatValue(XmlNode node, XmlRegistryKey key) { float val = 0; try { val = Convert.ToSingle(node.InnerText); } catch {} key.SetValue(node.Attributes["name"].Value, val); }
/// <summary> /// Add an LongInteger Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseULongValue(XmlNode node, XmlRegistryKey key) { ulong val = 0; try { val = Convert.ToUInt64(node.InnerText); } catch {} key.SetValue(node.Attributes["name"].Value, val); }
/// <summary> /// Add an Integer Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseIntValue(XmlNode node, XmlRegistryKey key) { int val = 0; try { val = Convert.ToInt32(node.InnerText); } catch {} key.SetValue(node.Attributes["name"].Value, val); }
/// <summary> /// Add an Date Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseDateTimeValue(XmlNode node, XmlRegistryKey key) { DateTime val = DateTime.Now; try { val = Convert.ToDateTime(node.InnerText); } catch {} key.SetValue(node.Attributes["name"].Value, val); }
/// <summary> /// Add an Boolean Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseBoolValue(XmlNode node, XmlRegistryKey key) { bool val = false; try { string s = node.InnerText.Trim().ToLower(); if (s == "false" || s == "no" || s == "off" || s == "0") { val = false; } else { val = true; } } catch {} key.SetValue(node.Attributes["name"].Value, val); }
/// <summary> /// Add an String Value /// </summary> /// <param name="node">The current Node</param> /// <param name="key">The current SubTree</param> void ParseStringValue(XmlNode node, XmlRegistryKey key) { string val = node.InnerText; key.SetValue(node.Attributes["name"].Value, val); }