Exemple #1
0
 public virtual void CredentialModified(BuildCredential credential)
 {
     if (credential != null)
     {
         _isModified = true;
     }
 }
Exemple #2
0
        public virtual bool Contains(BuildCredential credential)
        {
            if (credential == null || _credentials.Count == 0)
            {
                return(false);
            }

            return(_credentials.Contains(credential));
        }
Exemple #3
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (reader.NodeType != XmlNodeType.Element)
            {
                return;
            }

            if (!String.Equals(reader.Name, TagName,
                               StringComparison.OrdinalIgnoreCase))
            {
                Debug.Assert(false, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            this.Clear();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, BuildCredential.TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        BuildCredential credential = new BuildCredential();
                        credential.Provider = this;
                        credential.ReadXml(reader);

                        if (!credential.IsEmpty)
                        {
                            this.Add(credential);
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Exemple #4
0
        public virtual void Insert(int index, BuildCredential credential)
        {
            BuildExceptions.NotNull(credential, "credential");

            if (credential.Provider != this)
            {
                credential.Provider = this;
            }

            _credentials.Insert(index, credential);

            if (this.IsLoaded)
            {
                _isModified = true;
            }
        }
Exemple #5
0
        public virtual bool Remove(BuildCredential credential)
        {
            BuildExceptions.NotNull(credential, "credential");

            if (_credentials.Count == 0)
            {
                return(false);
            }

            bool isRemoved = _credentials.Remove(credential);

            if (isRemoved && this.IsLoaded)
            {
                _isModified = true;
            }

            return(isRemoved);
        }