private void BuscaArquivos(DirectoryInfo dir, FileInfo item, ref List<FileInfo> lista) { var dias = dateTimePicker2.Value.Subtract(dateTimePicker1.Value).Days; foreach (var file in dir.GetFiles()) { if (file.LastWriteTime < DateTime.Today.AddDays(-dias)) continue; var extensaoInvalida = new Extensoes()._listaComDll.Any(x => file.Extension.ToLower().Contains(x)); if (extensaoInvalida) continue; if (file.FullName.ToLower().Contains("resharper")) continue; var fileName = file.Name.Replace(file.Extension, ""); var itemName = item.Name.Replace(item.Extension, ""); if (item.Extension.ToLower().Equals(".cs")) { itemName = item.DirectoryName.Replace(@"\", "/").Split('/')[item.DirectoryName.Replace(@"\", "/").Split('/').Length - 1]; if (!itemName.Contains(".")) { itemName = item.FullName.Replace(@"\", "/").Split('/')[5];//diretorio do webui } } if (fileName != itemName) continue; lista.Add(file); } // busca arquivos do proximo sub-diretorio foreach (DirectoryInfo subDir in dir.GetDirectories()) { if (subDir.FullName.ToUpper().Contains("RESHARPER")) continue; BuscaArquivos(subDir, item, ref lista); } }
private void BuscaArquivos(DirectoryInfo dir) { var dias = dateTimePicker2.Value.Subtract(dateTimePicker1.Value).Days; foreach (var file in dir.GetFiles()) { if (file.LastWriteTime < DateTime.Today.AddDays(-dias)) continue; var extensaoInvalida = new Extensoes()._lista.Any(x => file.Extension.ToLower().Contains(x)); if (extensaoInvalida) continue; if (file.FullName.ToLower().Contains("resharper")) continue; checkedListBox1.Items.Add(file.FullName); } // busca arquivos do proximo sub-diretorio foreach (var subDir in dir.GetDirectories()) { if (subDir.FullName.ToUpper().Contains("RESHARPER")) continue; BuscaArquivos(subDir); } }