Пример #1
0
 /// <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));
 }
Пример #2
0
 /// <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));
 }
Пример #3
0
 /// <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);
 }
Пример #4
0
        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);
        }
Пример #5
0
 public CDRootItem(Path path) : base(path, null)
 {
 }
Пример #6
0
 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));
 }
Пример #8
0
 public CDItem(Path path, BaseItem parent)
 {
     Path = path;
     Parent = parent;
 }
Пример #9
0
 public CDRootItem(Path path)
     : base(path, null)
 {
 }
 public SystemWatchEditor(Application application, SessionPool session, Path file, ProgressListener listener)
     : base(application, session, file, listener)
 {
 }