Esempio n. 1
0
        public bool RemoveNameValueNode(string name)
        {
            ChoGuard.ArgumentNotNullOrEmpty(name, "Name");

            ChoIniNameValueNode nameValueNode = GetNameValueNode(name);

            return(Remove(nameValueNode));
        }
Esempio n. 2
0
        public bool CommentNameValueNode(string name)
        {
            ChoGuard.ArgumentNotNullOrEmpty(name, "Name");

            ChoIniNameValueNode nameValueNode = GetNameValueNode(name);

            return(nameValueNode.Comment());
        }
Esempio n. 3
0
        public string GetValue(string name)
        {
            ChoGuard.ArgumentNotNullOrEmpty(name, "Name");

            ChoIniNameValueNode nameValueNode = GetNameValueNode(name);

            return(nameValueNode != null ? nameValueNode.Value : null);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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));
            }
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 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);
 }