public bool IsExcluded(FileInfo fi)
 {
     return(_excludes.Any((r) => r.IsMatch(fi.Name)) ||
            (ExcludeAttributes.Any((x) => fi.Attributes.HasFlag(x))) ||
            (ExcludeSize > 0 && fi.Length > ExcludeSize) ||
            fi.Attributes.HasFlag(FileAttributes.ReparsePoint));
 }
示例#2
0
        internal string Parse()
        {
            var options = new StringBuilder();

            #region Set Options

            if (OnlyCopyArchiveFiles)
            {
                options.Append(ONLY_COPY_ARCHIVE_FILES);
            }
            if (OnlyCopyArchiveFilesAndResetArchiveFlag)
            {
                options.Append(ONLY_COPY_ARCHIVE_FILES_AND_RESET_ARCHIVE_FLAG);
            }
            if (!string.IsNullOrWhiteSpace(IncludeAttributes))
            {
                options.Append(string.Format(INCLUDE_ATTRIBUTES, IncludeAttributes.CleanOptionInput()));
            }
            if (!string.IsNullOrWhiteSpace(ExcludeAttributes))
            {
                options.Append(string.Format(EXCLUDE_ATTRIBUTES, ExcludeAttributes.CleanOptionInput()));
            }
            if (!string.IsNullOrWhiteSpace(ExcludeFiles))
            {
                options.Append(string.Format(EXCLUDE_FILES, ExcludeFiles));
            }
            if (!string.IsNullOrWhiteSpace(ExcludeDirectories))
            {
                options.Append(string.Format(EXCLUDE_DIRECTORIES, ExcludeDirectories));
            }
            if (ExcludeChanged)
            {
                options.Append(EXCLUDE_CHANGED);
            }
            if (ExcludeNewer)
            {
                options.Append(EXCLUDE_NEWER);
            }
            if (ExcludeOlder)
            {
                options.Append(EXCLUDE_OLDER);
            }
            if (ExcludeExtra)
            {
                options.Append(EXCLUDE_EXTRA);
            }
            if (ExcludeLonely)
            {
                options.Append(EXCLUDE_LONELY);
            }
            if (IncludeSame)
            {
                options.Append(INCLUDE_SAME);
            }
            if (IncludeTweaked)
            {
                options.Append(INCLUDE_TWEAKED);
            }
            if (MaxFileSize > 0)
            {
                options.Append(string.Format(MAX_FILE_SIZE, MaxFileSize));
            }
            if (MinFileSize > 0)
            {
                options.Append(string.Format(MIN_FILE_SIZE, MinFileSize));
            }
            if (!string.IsNullOrWhiteSpace(MaxFileAge))
            {
                options.Append(string.Format(MAX_FILE_AGE, MaxFileAge.CleanOptionInput()));
            }
            if (!string.IsNullOrWhiteSpace(MinFileAge))
            {
                options.Append(string.Format(MIN_FILE_AGE, MinFileAge.CleanOptionInput()));
            }
            if (!string.IsNullOrWhiteSpace(MaxLastAccessDate))
            {
                options.Append(string.Format(MAX_LAST_ACCESS_DATE, MaxLastAccessDate.CleanOptionInput()));
            }
            if (!string.IsNullOrWhiteSpace(MinLastAccessDate))
            {
                options.Append(string.Format(MIN_LAST_ACCESS_DATE, MinLastAccessDate.CleanOptionInput()));
            }
            if (ExcludeJunctionPoints)
            {
                options.Append(EXCLUDE_JUNCTION_POINTS);
            }
            if (ExcludeJunctionPointsForDirectories)
            {
                options.Append(EXCLUDE_JUNCTION_POINTS_FOR_DIRECTORIES);
            }
            if (ExcludeJunctionPointsForFiles)
            {
                options.Append(EXCLUDE_JUNCTION_POINTS_FOR_FILES);
            }
            if (UseFatFileTimes)
            {
                options.Append(USE_FAT_FILE_TIMES);
            }
            if (CompensateForDstDifference)
            {
                options.Append(COMPENSATE_FOR_DST_DIFFERENCE);
            }

            #endregion Set Options

            return(options.ToString());
        }