@manhnguyenv

Welcome to my blog!

List Files

July 22, 2019 17:04

List Files (edit)

 string[] allFilePaths = Directory.GetFiles(@"D:\6.5.22\", "*.cs", SearchOption.AllDirectories);

List<string> filePaths = new List<string>();

for (int i = 0; i < allFilePaths.Length; i++)
{
string filePath = allFilePaths[i];
string filePathLower = filePath.ToLower();
string contents = File.ReadAllText(filePath);
if (!filePathLower.Contains(@"\obj\") && !filePathLower.Contains(@"\bin\")
&& (contents.Contains(".Send") || contents.Contains(".SendAsync"))
&& contents.Contains("using MySolution.Framework"))
{
filePaths.Add(filePath);
}
}

var nppExePath = @"C:\Program Files\Notepad++\notepad++.exe";
var sb = new StringBuilder();
for (int i = 0; i < filePaths.Count; i++)
{
var filePath = filePaths[i];
Process.Start(nppExePath, string.Format("\"{0}\"", filePath));
}

Categories

Recent posts