コード例 #1
0
ファイル: IconCache.cs プロジェクト: zhuomingliang/cyberduck
 /// <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));
 }