private static List <DetectedFile> GatherFiles(Exclude save, DetectedLocationPathHolder location, Regex reg) { List <DetectedFile> files = new List <DetectedFile>(); foreach (string file in save.FindMatching(location.FullDirPath)) { string name = Path.GetFileName(file); string path = file.Substring(0, file.Length - name.Length).Trim(Path.DirectorySeparatorChar); if (!reg.IsMatch(file)) { continue; } DetectedFile detected = new DetectedFile(location, path, name, save.Type); files.Add(detected); } return(files); }