public bool RemoveNameValueNode(string name) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); ChoIniNameValueNode nameValueNode = GetNameValueNode(name); return(Remove(nameValueNode)); }
public bool CommentNameValueNode(string name) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); ChoIniNameValueNode nameValueNode = GetNameValueNode(name); return(nameValueNode.Comment()); }
public string GetValue(string name) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); ChoIniNameValueNode nameValueNode = GetNameValueNode(name); return(nameValueNode != null ? nameValueNode.Value : null); }
public bool TryGetValue(string name, out string value) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); value = null; ChoIniNameValueNode nameValueNode = GetNameValueNode(name); value = nameValueNode != null ? nameValueNode.Value : null; return(nameValueNode != null); }
public ChoIniNameValueNode GetNameValueNode(string name) { ChoIniNameValueNode nameValueNode = null; if (TryGetNameValueNode(name, out nameValueNode)) { return(nameValueNode); } else { throw new ChoIniDocumentException(String.Format("Can't find namevalue node. [Name: {0}]", name)); } }
public ChoIniNameValueNode AddNameValueNode(string name, string value) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); //Check for duplicate name value node if (ContainsNameValueNode(name)) { throw new ChoIniDocumentException(String.Format("Failed to add `{0}` namevalue node. Found duplicate node.", name)); } ChoIniNameValueNode nameValueNode = new ChoIniNameValueNode(OwnerDocument, name, value); return(AddIniNode(nameValueNode) as ChoIniNameValueNode); }
public bool TryGetNameValueNode(string name, out ChoIniNameValueNode nameValueNode) { nameValueNode = null; foreach (ChoIniNode iniNode in _iniNodes) { if (!(iniNode is ChoIniNameValueNode)) { continue; } if (String.Compare(((ChoIniNameValueNode)iniNode).Name, name, false) == 0) { nameValueNode = iniNode as ChoIniNameValueNode; return(true); } } return(false); }