public static string[] FileSearch(string strDir, string strMatch, bool bSubDir) { if (Directory.Exists(strDir) == false || strMatch.Length <= 0) { return(null); } using (FindFiles.FileSystemEnumerator fse = new FindFiles.FileSystemEnumerator(strDir, strMatch, bSubDir)) { IEnumerator <FileInfo> ien = fse.Matches().GetEnumerator(); ien.Dispose(); int nSearched = 0; int index = 0; string[] strResult = null; foreach (FileInfo fi in fse.Matches()) { nSearched++; } if (nSearched > 0) { strResult = new string[nSearched]; foreach (FileInfo fi in fse.Matches()) { strResult[index++] = fi.FullName; } } return(strResult); } }
private void ReadFiles() { if (!string.IsNullOrEmpty(txtOutputFolder.Text.Trim()) && Directory.Exists(txtOutputFolder.Text.Trim())) { ListViewItem thisItem = null; FileInfoEx thisInfo = null; lstFiles.BeginUpdate(); lstFiles.Items.Clear(); var enumerator = new FindFiles.FileSystemEnumerator(txtOutputFolder.Text.Trim(), "*.*", true); foreach (FileInfo fi in enumerator.Matches()) { string thisFile = fi.FullName; if ((!IsIgnorable(thisFile))) { thisInfo = new FileInfoEx(thisFile); var _with4 = thisInfo; thisItem = new ListViewItem(_with4.FileInfo.Name, GetImageIndex(_with4.FileInfo.Extension)); thisItem.SubItems.Add(_with4.FileVersion); thisItem.SubItems.Add(_with4.FileInfo.Length.ToString()); thisItem.SubItems.Add(_with4.FileInfo.LastWriteTime.ToString()); thisItem.SubItems.Add(_with4.Hash); thisItem.Checked = (!Settings.Default.IgnoreFiles.Contains(_with4.FileInfo.Name)); thisItem.Tag = thisInfo; lstFiles.Items.Add(thisItem); } } lstFiles.EndUpdate(); } }
private void ReadFiles() { if (!string.IsNullOrEmpty(txtOutputFolder.Text.Trim()) && Directory.Exists(txtOutputFolder.Text.Trim())) { ListViewItem thisItem = null; FileInfoEx thisInfo = null; lstFiles.BeginUpdate(); lstFiles.Items.Clear(); var enumerator = new FindFiles.FileSystemEnumerator(txtOutputFolder.Text.Trim(),"*.*", true); foreach (FileInfo fi in enumerator.Matches()) { string thisFile = fi.FullName; if ((!IsIgnorable(thisFile))) { thisInfo = new FileInfoEx(thisFile); var _with4 = thisInfo; thisItem = new ListViewItem(_with4.FileInfo.Name, GetImageIndex(_with4.FileInfo.Extension)); thisItem.SubItems.Add(_with4.FileVersion); thisItem.SubItems.Add(_with4.FileInfo.Length.ToString()); thisItem.SubItems.Add(_with4.FileInfo.LastWriteTime.ToString()); thisItem.SubItems.Add(_with4.Hash); thisItem.Checked = (!Settings.Default.IgnoreFiles.Contains(_with4.FileInfo.Name)); thisItem.Tag = thisInfo; lstFiles.Items.Add(thisItem); } } lstFiles.EndUpdate(); } }