Пример #1
0
        public static ISelector Create(Context context, string mask, bool recursive = false, bool fromoutput = false)
        {
            FileFilter filter = new FileFilter();
            filter.Context = context;
            filter.Filter = mask;
            filter.Recursive = recursive;
            filter.FromOutput = fromoutput;

            return filter;
        }
Пример #2
0
        public static ISelector Create(Context context, params string[] args)
        {
            string p1 = args.FirstOrDefault();
            string mask = args.Skip(1).Where(a => !a.StartsWith("-")).FirstOrDefault(); // first non option parameter 

            if (p1 == null)
                throw new Exception("No parameters for filter");

            if (p1.StartsWith(STASHPREFIX))
            {
                return new StashFilter(p1, mask);
            }
            else
            {
                FileFilter filter = new FileFilter();
                filter.Filter = p1;
                filter.Recursive = args.Contains("-recursive");
                filter.FromOutput = args.Contains("-output");
                filter.Context = context.Clone();
                filter.Mask = mask;
                return filter;
            }
        }