Beispiel #1
0
        /// <summary>
        /// Creates a Filter instance based on the supplied filter syntax value.
        /// </summary>
        /// <param name="value">A value in the format of filter syntax.</param>
        /// <returns></returns>
        public static Filter FromString(string value)
        {
            bool isRelative  = value.StartsWith(string.Format(".{0}", Path.DirectorySeparatorChar));
            bool isDirectory = value.EndsWith(Path.DirectorySeparatorChar.ToString());

            string filterValue = StripIdentifiers(value);

            if (isDirectory)
            {
                if (isRelative)
                {
                    return(RelativeDirectoryFilter.Create(filterValue));
                }
                else
                {
                    return(GlobalDirectoryFilter.Create(filterValue));
                }
            }
            else
            {
                if (isRelative)
                {
                    return(RelativeFileFilter.Create(filterValue));
                }
                return(GlobalFileFilter.Create(filterValue));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds a filter for a global directory name.
 /// </summary>
 /// <param name="dirName"></param>
 public void AddGlobalDirFilter(string dirName)
 {
     this.Add(GlobalDirectoryFilter.Create(dirName));
 }