public Icon GetIcon(string FileName) { System.Drawing.Icon icon = Icons.Default; if (string.IsNullOrEmpty(FileName)) { } else { if (FileName.StartsWith("http://")) { return(Icons.Browser); } else if (LPath.IsValid(FileName)) { var p = new LPath(FileName); if (p.IsDirectory) { icon = IconReader.GetFolderIcon(IconReader.IconSize.Large, IconReader.FolderType.Closed); } else if (p.IsFile) { var ext = p.Extension.ToLower(); return(GetOrAdd(byExtension, ext, () => { icon = IconReader.GetFileIcon(p, IconReader.IconSize.Large, false); return icon; })); } } } return(icon); }
public override System.Drawing.Icon GetIcon() { System.Drawing.Icon icon = null; if (String.IsNullOrEmpty(FileName)) { } else { if (FileName.StartsWith("http://")) { return(BrowserIcon); } else if (LPath.IsValid(FileName)) { var p = new LPath(FileName); if (p.IsDirectory) { icon = IconReader.GetFolderIcon(IconReader.IconSize.Large, IconReader.FolderType.Closed); } else if (p.IsFile) { icon = IconReader.GetFileIcon(p, IconReader.IconSize.Large, false); } } } return(icon); }
protected override IEnumerable <IResult> GetResults(IQuery query) { if (!String.IsNullOrEmpty(query.Text) && LPath.IsValid(query.Text)) { var path = new LPath(query.Text); if (path.IsFile) { yield return(new SimpleAction( query.Context.LastExecutedStore, path.ToString(), String.Format("Show {0} in Explorer", path.ToString()), () => { // show in explorer Process.Start("explorer.exe", ("/select," + path.ToString()).Quote()); }).ToResult(Priority.High)); } else if (path.IsDirectory) { yield return(new SimpleAction( query.Context.LastExecutedStore, path.ToString(), String.Format("Show {0} in Explorer", path.ToString()), () => { // show in explorer Process.Start("explorer.exe", ("/root," + path.ToString()).Quote()); }).ToResult(Priority.High)); } } }
static LPath GetPath(IAction a) { try { var sp = GetStartProcess(a); if (sp != null) { if (!String.IsNullOrEmpty(sp.FileName) && LPath.IsValid(sp.FileName)) { return(new LPath(sp.FileName)); } } } catch { } return(null); }