All pastes #117478 Raw Edit

Mine

public text v1 · immutable
#117478 ·published 2006-08-05 23:32 UTC
rendered paste body
public 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;
        }