Ejemplo n.º 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));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a filter for a root relative directory.
 /// </summary>
 /// <param name="relativeDirPath"></param>
 public void AddRelativeDirFilter(string relativeDirPath)
 {
     this.Add(RelativeDirectoryFilter.Create(relativeDirPath));
 }