public void Can_Get_Media() { var mediaLink = _client.GetMedia("/Test/WP_20120111_011610Z.mp4"); Assert.IsNotNull(mediaLink); Assert.IsNotNull(mediaLink.Expires); Assert.IsNotNull(mediaLink.Url); }
public void Download(string file, string saveWhere, Dispatcher dispatch, Action done) { var shareResp = _client.GetMedia(file); using (WebClient webclient = new WebClient()) { webclient.DownloadFileCompleted += (object sender, AsyncCompletedEventArgs e) => { dispatch.BeginInvoke(new Action(() => { done(); })); }; webclient.DownloadFileAsync(new Uri(shareResp.Url), saveWhere); } }
public String GetMedialUrl(string path, AuthCredential credential) { if (String.IsNullOrEmpty(path)) { return(null); } var _client = new DropNetClient(MogConstants.DROPBOX_KEY, MogConstants.DROPBOX_SECRET); UserLogin User = new UserLogin() { Token = credential.Token, Secret = credential.Secret }; _client.UserLogin = User; _client.UseSandbox = true; ShareResponse response = _client.GetMedia(path); return(response != null ? response.Url : null); }
public string UploadFile(Stream stream, string filename, string filetype, string path = "/") { if (stream == null || !stream.CanRead) { throw new ArgumentException("stream"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentException("filename"); } if (string.IsNullOrEmpty(filetype)) { throw new ArgumentException("filetype"); } var fullFileName = filename + filetype.GetFileExtension(); this.client.UploadFile(path, fullFileName, stream); var meta = client.GetMedia(fullFileName); return(meta.Url); }
public static string Download(string path) { return(client.GetMedia(path).Url); }
public string GetShareLink(string fileName) { return(client.GetMedia(fileName).Url); }