Ejemplo n.º 1
0
        /// <summary>
        /// On a new/uncommitted entry, check for any in-queue Add / Replace operations on 'propName'
        /// and remove 'value' if present.  On a regular existing entry, queue a deletion of the
        /// specified value.
        /// </summary>
        /// <param name="propName"></param>
        /// <param name="value"></param>
        public void RemoveAttrValue(string attrName, string value)
        {
            CheckForDeletion();

            string propName = attrName.ToLowerInvariant();

            if (this.IsNewEntry)
            {
                if (_changes.ContainsKey(propName))
                {
                    DirectoryAttributeModification dam = _changes[propName];
                    if (dam.Contains(value))
                    {
                        dam.Remove(value);
                    }
                }
            }
            else
            {
                string key = propName + "*d";

                if (_changes.ContainsKey(key))
                {
                    DirectoryAttributeModification dam = _changes[key];
                    if (!dam.Contains(value))
                    {
                        dam.Add(value);
                    }
                }
                else
                {
                    DirectoryAttributeModification dam = new DirectoryAttributeModification();
                    dam.Operation = DirectoryAttributeOperation.Delete;
                    dam.Name      = propName;
                    dam.Add(value);
                    _changes[key] = dam;
                }
            }
        }