Ejemplo n.º 1
0
        /// <summary>
        /// Adds the specified path to a exclude list, as determined by the <paramref name="option"/> argument.
        /// </summary>
        /// <param name="path">The path to ignore.</param>
        /// <param name="option">How the path should be ignored.</param>
        /// <returns>The <see cref="ExcludeRule"/> object added to the ignore list.</returns>
        public ExcludeRule Exclude(string path, ExcludeRuleOptions option)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            var relative = this.GetRelativePath(path);

            if (option == ExcludeRuleOptions.Global)
            {
                return(this.GlobalExcludeRules.Add(relative));
            }
            else if (this.CurrentProfile != null)
            {
                return(this.CurrentProfile.Excludes.Add(relative));
            }
            else
            {
                throw new InvalidOperationException("Cannot add the path to the current profile's ignore list as no profile is currently selected.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the specified path to a exclude list, as determined by the <paramref name="option"/> argument.
        /// </summary>
        /// <param name="path">The path to ignore.</param>
        /// <param name="option">How the path should be ignored.</param>
        /// <returns>The <see cref="ExcludeRule"/> object added to the ignore list.</returns>
        public ExcludeRule Exclude(string path, ExcludeRuleOptions option)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            var relative = this.GetRelativePath(path);

            if (option == ExcludeRuleOptions.Global)
            {
                return this.GlobalExcludeRules.Add(relative);
            }
            else if (this.CurrentProfile != null)
            {
                return this.CurrentProfile.Excludes.Add(relative);
            }
            else
            {
                throw new InvalidOperationException("Cannot add the path to the current profile's ignore list as no profile is currently selected.");
            }
        }