Example #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.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));
 }
Example #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.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));
 }