rendered paste bodypublic static IList<string> ScanProgramFiles(string logicalPath, bool silent)
{
IList<string> foldersWithExecutables = new List<string>();
string tmp = "", dir = "";
foreach (string d in Directory.GetDirectories(logicalPath))
{
if (!silent)
{
Console.WriteLine("Now scanning " + d + " for executables.");
}
foreach (string dirWithExe in ScanProgramFiles(d, silent))
{
foldersWithExecutables.Add(dirWithExe);
}
dir = d;
}
foreach (string d in Directory.GetFiles(logicalPath))
{
tmp = ExtensionOf(d);
if (tmp == null)
{
continue;
}
if (tmp.ToLower() == "exe" || tmp.ToLower() == "bat" || tmp.ToLower() == "vbs")
{
foldersWithExecutables.Add(d);
}
}
return foldersWithExecutables;
}