Permalink
Browse files

Exposed content metadata for DownloadFile and DownloadThumbnail metho…

…ds [SPRNETSOCIALDB-2]
  • Loading branch information...
1 parent 1917645 commit 2ea8b4c4c15ac113b5defa50a5ca46f77553fe25 @bbaia bbaia committed Feb 5, 2012
View
@@ -73,11 +73,9 @@ IDropbox dropboxApi = serviceProvider.GetApi(accessToken.Value, accessToken.Secr
Entry UploadFile(IResource file, string path, bool overwrite, string revision);
- byte[] DownloadFile(string path);
+ DropboxFile DownloadFile(string path);
- byte[] DownloadFile(string path, string revision);
-
- DropboxFile DownloadFileAndMetadata(string path, string revision);
+ DropboxFile DownloadFile(string path, string revision);
Entry GetMetadata(string path);
@@ -97,9 +95,7 @@ IDropbox dropboxApi = serviceProvider.GetApi(accessToken.Value, accessToken.Secr
DropboxLink GetMediaLink(string path);
- byte[] DownloadThumbnail(string path, ThumbnailFormat format, ThumbnailSize size);
-
- DropboxFile DownloadThumbnailAndMetadata(string path, ThumbnailFormat format, ThumbnailSize size);
+ DropboxFile DownloadThumbnail(string path, ThumbnailFormat format, ThumbnailSize size);
}]]></programlisting>
<para>
@@ -13,7 +13,7 @@
<!-- auto-generated -->
<copyright>Copyright 2012 SpringSource</copyright>
<!-- auto-generated -->
- <pubdate>Last Updated 1/30/2012</pubdate>
+ <pubdate>Last Updated 2/5/2012</pubdate>
<authorgroup>
<author>
<firstname>Bruno</firstname>
@@ -53,7 +53,7 @@ static void Main(string[] args)
DropboxProfile profile = dropbox.GetUserProfileAsync().Result;
Console.WriteLine("Hi " + profile.DisplayName + "!");
- // Use step by step debugging
+ // Use step by step debugging, or not
/*
Entry createFolderEntry = dropbox.CreateFolderAsync("Spring Social").Result;
Entry uploadFileEntry = dropbox.UploadFileAsync(
@@ -65,10 +65,11 @@ static void Main(string[] args)
dropbox.DownloadFileAsync("Spring Social/File.txt")
.ContinueWith(task =>
{
+ Console.WriteLine("File '{0}' downloaded ({1})", task.Result.Metadata.Path, task.Result.Metadata.Size);
// Save file to "C:\Spring Social.txt"
using (FileStream fileStream = new FileStream(@"C:\Spring Social.txt", FileMode.Create))
{
- fileStream.Write(task.Result, 0, task.Result.Length);
+ fileStream.Write(task.Result.Content, 0, task.Result.Content.Length);
}
});
Entry folderMetadata = dropbox.GetMetadataAsync("Spring Social").Result;
@@ -83,10 +84,11 @@ static void Main(string[] args)
dropbox.DownloadThumbnailAsync("Spring Social/Image.png", ThumbnailFormat.Png, ThumbnailSize.Medium)
.ContinueWith(task =>
{
+ Console.WriteLine("Thumbnail '{0}' downloaded ({1})", task.Result.Metadata.Path, task.Result.Metadata.Size);
// Save file to "C:\Thumbnail_Medium.png"
using (FileStream fileStream = new FileStream(@"C:\Thumbnail_Medium.png", FileMode.Create))
{
- fileStream.Write(task.Result, 0, task.Result.Length);
+ fileStream.Write(task.Result.Content, 0, task.Result.Content.Length);
}
});
*/
@@ -132,7 +134,7 @@ static void Main(string[] args)
DropboxProfile profile = dropbox.GetUserProfile();
Console.WriteLine("Hi " + profile.DisplayName + "!");
- // Use step by step debugging
+ // Use step by step debugging, or not
/*
Entry createFolderEntry = dropbox.CreateFolder("Spring Social");
Entry uploadFileEntry = dropbox.UploadFile(
@@ -144,10 +146,11 @@ static void Main(string[] args)
var fileCanceler = dropbox.DownloadFileAsync("Spring Social/File.txt",
r =>
{
+ Console.WriteLine("File '{0}' downloaded ({1})", r.Response.Metadata.Path, r.Response.Metadata.Size);
// Save file to "C:\Spring Social.txt"
using (FileStream fileStream = new FileStream(@"C:\Spring Social.txt", FileMode.Create))
{
- fileStream.Write(r.Response, 0, r.Response.Length);
+ fileStream.Write(r.Response.Content, 0, r.Response.Content.Length);
}
});
Entry folderMetadata = dropbox.GetMetadata("Spring Social");
@@ -162,10 +165,11 @@ static void Main(string[] args)
var thumbnailCanceler = dropbox.DownloadThumbnailAsync("Spring Social/Image.png", ThumbnailFormat.Png, ThumbnailSize.Medium,
r =>
{
+ Console.WriteLine("Thumbnail '{0}' downloaded ({1})", r.Response.Metadata.Path, r.Response.Metadata.Size);
// Save file to "C:\Thumbnail_Medium.png"
using (FileStream fileStream = new FileStream(@"C:\Thumbnail_Medium.png", FileMode.Create))
{
- fileStream.Write(r.Response, 0, r.Response.Length);
+ fileStream.Write(r.Response.Content, 0, r.Response.Content.Length);
}
});
*/
Oops, something went wrong.

0 comments on commit 2ea8b4c

Please sign in to comment.