Пример #1
0
 public FileSystemFinderOptions(
     SearchTarget searchTarget = SearchTarget.Files,
     bool recurseSubdirectories = true,
     bool returnSpecialDirectories = false,
     bool ignoreInaccessible = true,
     FileAttributes attributes = default,
     FileAttributes attributesToSkip = default,
     MatchType matchType = MatchType.Simple,
     MatchCasing matchCasing = MatchCasing.PlatformDefault,
     bool? empty = null,
     bool canEnumerate = true,
     bool partOnly = false)
 {
     SearchTarget = searchTarget;
     RecurseSubdirectories = recurseSubdirectories;
     ReturnSpecialDirectories = returnSpecialDirectories;
     IgnoreInaccessible = ignoreInaccessible;
     Attributes = attributes;
     AttributesToSkip = attributesToSkip;
     MatchType = matchType;
     MatchCasing = matchCasing;
     Empty = empty;
     CanEnumerate = canEnumerate;
     PartOnly = partOnly;
 }
Пример #2
0
    // 遍历原数组,如果当前区间和新区间没有交集,则直接存入答案;
    // 如果有交集,便和新区间合并,更新新区间的左右边界;
    // 如果当前区间和新区间无交集且大于新区间,则新区间和后面所有的区间都可存入答案。

    // 1.如果newInterval[0] > intervals[i][1],此区间和新区间无交集,直接存入答案
    // 2.如果newInterval[1] < intervals[i][0],从此区间起,所有区间都和新区间无交集,所有区间存入答案
    // 3.此区间和新区间有交集,合并区间
    public int[][] Insert(int[][] intervals, int[] newInterval)
    {
        List <int[]> res  = new List <int> (intervals.Length + 1);
        bool         flag = false;

        for (int i = 0; i < intervals.Length; i++)
        {
            // newinterval起始点大于当前区间的结束点,证明还未找到交集
            if (newInterval[0] > intervals[i][1])
            {
                res.Add(intervals[i][1]);
                continue;
            }

            // newinterval结束点大于当前区间的起始点,证明已经没有交集
            if (newInterval[1] > intervals[i][0])
            {
                res.Add(newInterval);
            }
            flag = !flag;
            for (; i < length; i++)
            {
                res.Add(intervals[i]);
            }
            break;

            //新区间处于目前区间范围 进行区间合并
            //最小值为目前区间和新区间最小值  最大值为他俩中的最大的
            newInterval[0] = Match.Min(newInterval[0], intervals[i][0]);
            newInterval[1] = MatchCasing.Max(newInterval[1], intervals[i][1]);
        }
        // 倘若找到了对应的交集
        if (!flag)
        {
            res.Add(newInterval);
        }
        return(res.ToArray());
    }
 public static ISetupActivity <EnumerateFiles> WithMatchCasing(this ISetupActivity <EnumerateFiles> setup, MatchCasing matchCasing) => setup.Set(x => x.MatchCasing, matchCasing);