public void AddData(ConfigNode node) { int count = node.Values.Count; for (int i = 0; i < count; i++) { ConfigValue value = node.Values[i]; this.AddValue(value.name, value.value, value.comment); } int count2 = node.Nodes.Count; for (int j = 0; j < count2; j++) { ConfigNode node2 = this.AddNode(node.Nodes[j].name); node.Nodes[j].CopyTo(node2); } }
private void CopyToRecursive(ConfigNode node, bool overwrite = false) { if (node.name == string.Empty) { node.name = this.name; } if (node.id == string.Empty) { node.id = this.id; } if (!string.IsNullOrEmpty(this.comment)) { node.comment = this.comment; } int count = this._values.Count; for (int i = 0; i < count; i++) { ConfigValue value = this._values[i]; if (overwrite) { node.SetValue(value.name, value.value, value.comment, true); } else { node.AddValue(value.name, value.value, value.comment); } } int count2 = this._nodes.Count; for (int j = 0; j < count2; j++) { ConfigNode node2 = this._nodes[j]; if (overwrite) { node.RemoveNode(node2.name); } node2.CopyToRecursive(node.AddNode(node2.name), false); } }
public void AddValue(string name, string value) { ConfigValue v = new ConfigValue(name, ConfigNode.CleanupInput(value)); this._values.Add(v); }
public void AddValue(string name, object value) { ConfigValue v = new ConfigValue(name, ConfigNode.CleanupInput(KPUtil.WriteObject(value))); this._values.Add(v); }