コード例 #1
0
        public bool IsMatch(FileSystemInfo itemInfo)
        {
            string path = itemInfo.FullName;

            if (PathFilters.Any(reg => reg.IsMatch(path)))
            {
                return(true);
            }

            string name = itemInfo.Name;

            if (CommonFilters.Any(reg => reg.IsMatch(name)))
            {
                return(true);
            }

            if (itemInfo is FileInfo fileInfo)
            {
                return(FileFilters.Any(reg => reg.IsMatch(name)));
            }
            else if (itemInfo is DirectoryInfo directoryInfo)
            {
                return(DirectoryFilters.Any(reg => reg.IsMatch(name)));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public bool IsMatch(string name, string path, ItemType type)
        {
            if (PathFilters.Any(reg => reg.IsMatch(path)))
            {
                return(true);
            }

            if (CommonFilters.Any(reg => reg.IsMatch(name)))
            {
                return(true);
            }

            if (type == ItemType.File)
            {
                return(FileFilters.Any(reg => reg.IsMatch(name)));
            }
            else if (type == ItemType.Directory)
            {
                return(DirectoryFilters.Any(reg => reg.IsMatch(name)));
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: AbstractCommand.cs プロジェクト: pauk-slon/filecmd
        protected virtual void createFilesList()
        {
            IEnumerable <FileInfo> files =
                Destinations[SOURCE_DIRECTORY_TYPE_NAME].GetFiles();

            Files = files.Where(file =>
                                FileFilters.Any(filter => filter.isMatch(file)));
        }