/// <summary>
        /// get all information for a remote directory from the Dropbox metadata
        /// </summary>
        private async Task<SyncedDirectory> SniffRemoteDirectory(Metadata remoteDirectory)
        {
            var result = new SyncedDirectory
            {
                Name = remoteDirectory.Name,
                RemoteDeleted = remoteDirectory.IsDirectory
            };

            foreach (var child in remoteDirectory.Contents)
            {
                if (child.IsDirectory)
                {
                    //contents are not downloaded recursively for subdirs, do it now
                    var childFromDropbox = await _dropboxClient.GetMetaDataWithDeleted(child.Path);

                    result.AddDir(await SniffRemoteDirectory(childFromDropbox));
                }
                else
                {
                    result.AddFile(SniffRemoteFile(child));
                }
            }

            return result;
        }
        /// <summary>
        /// get all information for a remote file from the Dropbox metadata
        /// </summary>
        private SyncedFile SniffRemoteFile(Metadata file)
        {
            var result = new SyncedFile
            {
                Name = file.Name,
                RemoteDeleted = file.IsDeleted,
                RemotePath = file.Path
            };

            result.CurrentSyncTimestamp.Remote = file.UTCDateModified;

            return result;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the thumbnail of an image given its MetaData
 /// </summary>
 /// <param name="file"></param>
 /// <param name="size"></param>
 /// <returns></returns>
 public async Task<byte[]> GetThumbnail(Metadata file, ThumbnailSize size)
 {
     return await GetThumbnail(file.Path, size);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the thumbnail of an image given its MetaData (default size = small)
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 public async Task<byte[]> GetThumbnail(Metadata file)
 {
     return await GetThumbnail(file.Path, ThumbnailSize.Small);
 }