public static IEnumerable <Action> GetPathExecutables() { FileActionFactory f = new FileActionFactory(); var exeExtensions = new FileType("exe", "bat", "cmd", "msc", "cpl"); var path = Regex.Split(System.Environment.GetEnvironmentVariable("PATH"), @"\;") .SafeSelect(x => LPath.Parse(x)).ToList(); log.InfoFormat("Searching {0}", path); return(path.SelectMany(p => { return p.GetFiles().Where(x => exeExtensions.Is(x)) .SafeSelect(x => f.FromFile(x)); })); }
static IEnumerable <LPath> GetSelectedFiles(SHDocVw.InternetExplorer w) { if (w == null) { return(Enumerable.Empty <LPath>()); } // handle Explorer windows var view = w.Document as IShellFolderViewDual2; if (view != null) { var items = view.SelectedItems() .OfType <FolderItem>() .Select(i => new LPath(i.Path)) .ToList(); if (items.Any()) { return(items); } } var url = w.LocationURL; if (Uri.IsWellFormedUriString(url, UriKind.Absolute)) { var uri = new Uri(url); if (object.Equals(uri.Scheme, "file")) { return(new LPath[] { LPath.Parse(uri.LocalPath) }); } } return(Enumerable.Empty <LPath>()); }