Exemplo n.º 1
0
 /// <summary>
 /// Copy a file or folder in the cache
 /// </summary>
 /// <param name="sourceCache"></param>
 /// <param name="sourceEntry"></param>
 /// <param name="targetPath"></param>
 public void copyFromCache(ICache sourceCache, ICacheEntry sourceEntry, string targetPath)
 {
     this.put(targetPath, this.cacheEntryToArray(sourceEntry));
     if (sourceEntry.getMimeType() == sourceEntry.DIRECTORY_MIMETYPE)
     {
         var folderContent = sourceCache.getFolderContentsById(sourceEntry.getId());
         foreach (var subEntry in folderContent)
         {
             var subTargetPath = targetPath + "/" + subEntry.getName();
             this.copyFromCache(sourceCache, subEntry, subTargetPath);
         }
     }
 }
Exemplo n.º 2
0
 private IDictionary <string, object> cacheEntryToArray(ICacheEntry entry)
 {
     return(new Dictionary <string, object>
     {
         { "size", entry.getSize() },
         { "mtime", entry.getMTime() },
         { "storage_mtime", entry.getStorageMTime() },
         { "mimetype", entry.getMimeType() },
         { "mimepart", entry.getMimePart() },
         { "etag", entry.getEtag() },
         { "permissions", entry.getPermissions() },
         { "encrypted", entry.isEncrypted() }
     });
 }