/// <summary> /// Return a bitmap for a given path /// </summary> /// <param name="path"></param> /// <returns></returns> public Bitmap IconForPath(Path path, IconSize size) { if (path.getType().contains(AbstractPath.Type.decrypted)) { Bitmap overlay = IconForName("unlockedbadge", size); if (path.isDirectory()) { return(IconForFolder(overlay, size)); } Bitmap unlocked = IconForFilename(path.getName(), size); return(OverlayImages(unlocked, overlay)); } if (path.isSymbolicLink()) { Bitmap overlay = IconForName("aliasbadge", size); if (path.isDirectory()) { return(IconForFolder(overlay, size)); } Bitmap symlink = IconForFilename(path.getName(), size); return(OverlayImages(symlink, overlay)); } if (path.isFile()) { if (String.IsNullOrEmpty(path.getExtension())) { if (path.attributes().getPermission().isExecutable()) { return(IconForName("executable", size)); } } return(IconForFilename(path.getName(), size)); } if (path.isDirectory()) { if (!Permission.EMPTY.equals(path.attributes().getPermission())) { if (!path.attributes().getPermission().isExecutable()) { return(IconForFolder(IconForName("privatefolderbadge", size), size)); } if (!path.attributes().getPermission().isReadable()) { if (path.attributes().getPermission().isWritable()) { return(IconForFolder(IconForName("dropfolderbadge", size), size)); } } if (!path.attributes().getPermission().isWritable()) { return(IconForFolder(IconForName("readonlyfolderbadge", size), size)); } } return(IconForFolder(size)); } return(ResizeImage(IconForName("notfound", size), size)); }
/// <summary> /// Return a bitmap for a given path /// </summary> /// <param name="path"></param> /// <returns></returns> public Bitmap IconForPath(Path path, IconSize size) { if (path.attributes().isSymbolicLink()) { Bitmap overlay = IconForName("aliasbadge", size); if (path.attributes().isDirectory()) { return(IconForFolder(overlay, size)); } Bitmap symlink = IconForFilename(path.getName(), size); return(OverlayImages(symlink, overlay)); } if (path.attributes().isFile()) { if (String.IsNullOrEmpty(path.getExtension())) { if (path.attributes().getPermission().isExecutable()) { return(IconForName("executable", size)); } } return(IconForFilename(path.getName(), size)); } if (path.attributes().isVolume()) { return(IconForName(path.getHost().getProtocol().disk(), size)); } if (path.attributes().isDirectory()) { if (OverlayFolderImage) { if (!path.attributes().getPermission().isExecutable() || (path.isCached() && !path.cache().get(path.getReference()).attributes().isReadable())) { return(IconForFolder(IconForName("privatefolderbadge", size), size)); } if (!path.attributes().getPermission().isReadable()) { if (path.attributes().getPermission().isWritable()) { return(IconForFolder(IconForName("dropfolderbadge", size), size)); } } if (!path.attributes().getPermission().isWritable()) { return(IconForFolder(IconForName("readonlyfolderbadge", size), size)); } } return(IconForFolder(size)); } return(ResizeImage(IconForName("notfound", size), size)); }
/// <summary> /// Get file extension. Ignores OS specific special characters. Includes the dot if available. /// </summary> /// <param name="filename"></param> /// <returns></returns> public static string GetSafeExtension(string filename) { if (IsNotBlank(filename)) { //see http://windevblog.blogspot.com/2008/09/get-default-application-in-windows-xp.html string extension = Path.getExtension(filename); if (IsBlank(extension)) { return(String.Empty); } return("." + extension); } return(String.Empty); }
public void open(Host host, Path workdir) { if (!File.Exists(PreferencesFactory.get().getProperty("terminal.command.ssh"))) { OpenFileDialog selectDialog = new OpenFileDialog(); selectDialog.Filter = "PuTTY executable (.exe)|*.exe"; selectDialog.FilterIndex = 1; DialogResult result = DialogResult.None; Thread thread = new Thread(() => result = selectDialog.ShowDialog()); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); if (result == DialogResult.OK) { PreferencesFactory.get().setProperty("terminal.command.ssh", selectDialog.FileName); } else { return; } } string tempFile = System.IO.Path.GetTempFileName(); bool identity = host.getCredentials().isPublicKeyAuthentication(); TextWriter tw = new StreamWriter(tempFile); tw.WriteLine("cd {0} && exec $SHELL", workdir.getAbsolute()); tw.Close(); String ssh = String.Format(PreferencesFactory.get().getProperty("terminal.command.ssh.args"), identity ? string.Format("-i \"{0}\"", host.getCredentials().getIdentity().getAbsolute()) : String.Empty, host.getCredentials().getUsername(), host.getHostname(), Convert.ToString(host.getPort()), tempFile); ApplicationLauncherFactory.get() .open( new Application(PreferencesFactory.get().getProperty("terminal.command.ssh"), null), ssh); }
public CDRootItem(Path path) : base(path, null) { }
public CDItem(Path path, BaseItem parent) { Path = path; Parent = parent; }
public override ch.cyberduck.core.editor.Editor create(ProgressListener listener, SessionPool session, Application application, Path file) { return(new SystemWatchEditor(application, session, file, listener)); }
public SystemWatchEditor(Application application, SessionPool session, Path file, ProgressListener listener) : base(application, session, file, listener) { }