public static Ignores FromFile(string path, Logger log) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (path.Trim() == string.Empty) { throw new ArgumentException("Cannot be empty or whitespace.", nameof(path)); } string[] lines; try { lines = File.ReadAllLines(path); } catch (IOException ex) { log.Verbose("Error loading ignores from {0} ({1})", path, ex.Message); return(new Ignores()); } var tmp = new List <string>(lines.Length); foreach (string line in lines) { var trimmed = line.Trim(); if (!string.IsNullOrEmpty(trimmed)) { tmp.Add(trimmed); } } var ignores = new Ignores(tmp); log.Message("Loaded {0} ignores from {1}", ignores.Count, path); return(ignores); }
void LoadIgnores(string path) { dispatch.Ignore = Ignores.FromFile(path, log); }