Example #1
0
        public List <DirConfig> LoadLegacyConfig(string configPath)
        {
            _logger.Trace("Loading legacy config file: {0}", configPath);

            var rules = new List <MatchRule>();

            using (var sr = new StreamReader(configPath)) {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    line = Regex.Replace(line, @"^\s*#.*", "");
                    if (String.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }

                    string[] s = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (s[0] != "include" && s[0] != "exclude")
                    {
                        throw new Exception("Invalid config line: " + line);
                    }

                    rules.Add(new MatchRule(s[0] == "include", s[1]));
                }
            }

            var ret = new DirConfig(configPath, ".", rules);

            _logger.Trace(ret.ToString());
            return(new List <DirConfig>()
            {
                ret
            });
        }
Example #2
0
 public GrepMatcher(DirConfig config) : base(config)
 {
     _contents = Settings.Compress
         ? new CompressedFileStore()
         : (IFileStore) new FileStore();
 }
Example #3
0
 public PathMatcher(DirConfig config) : base(config)
 {
 }
Example #4
0
 public Matcher(DirConfig config)
 {
     this.Config  = config;
     _pathmatcher = new PathMatcher(config);
     _grepmatcher = new GrepMatcher(config);
 }
Example #5
0
 public AbstractMatcher(DirConfig config)
 {
     this.Config = config;
 }