using System;\r
-using System.Collections.Generic;\r
using System.ComponentModel.Composition;\r
using System.Diagnostics;\r
using System.Diagnostics.Contracts;\r
using System.IO;\r
-using System.Linq;\r
using System.Net;\r
using System.Reflection;\r
-using System.Security.Cryptography;\r
using System.Threading;\r
using System.Threading.Tasks;\r
using Pithos.Interfaces;\r
if (action.IsCreation)\r
{\r
//Add the folder to the Selected URls\r
- var selectiveUri = new Uri(client.RootAddressUri, cloudFile.Uri);\r
+ var selectiveUri = client.RootAddressUri.Combine(cloudFile.Uri);\r
Selectives.AddUri(accountInfo, selectiveUri);\r
Selectives.Save(accountInfo);\r
}\r
}\r
\r
\r
- public async Task UploadWithHashMap(AccountInfo accountInfo, ObjectInfo cloudFile, FileInfo fileInfo, string url, TreeHash treeHash, CancellationToken token)\r
+ public async Task UploadWithHashMap(AccountInfo accountInfo, ObjectInfo cloudFile, FileInfo fileInfo, Uri uri, TreeHash treeHash, CancellationToken token)\r
{\r
if (accountInfo == null)\r
throw new ArgumentNullException("accountInfo");\r
throw new ArgumentNullException("cloudFile");\r
if (fileInfo == null)\r
throw new ArgumentNullException("fileInfo");\r
- if (String.IsNullOrWhiteSpace(url))\r
- throw new ArgumentNullException(url);\r
+ if (uri==null)\r
+ throw new ArgumentNullException("uri");\r
if (treeHash == null)\r
throw new ArgumentNullException("treeHash");\r
- if (String.IsNullOrWhiteSpace(cloudFile.Container))\r
+ if (cloudFile.Container==null)\r
throw new ArgumentException("Invalid container", "cloudFile");\r
+ if (cloudFile.Container.IsAbsoluteUri)\r
+ throw new ArgumentException("Container URI must be relative", "cloudFile");\r
Contract.EndContractBlock();\r
\r
\r
\r
var client = new CloudFilesClient(accountInfo);\r
//Send the hashmap to the server \r
- var missingHashes = await client.PutHashMap(account, container, url, treeHash).ConfigureAwait(false);\r
+ var missingHashes = await client.PutHashMap(account, container, uri, treeHash).ConfigureAwait(false);\r
ReportUploadProgress(fileInfo.Name, block, 0, missingHashes.Count, fileInfo.Length);\r
//If the server returns no missing hashes, we are done\r
\r
token.ThrowIfCancellationRequested();\r
Log.InfoFormat("[BLOCK] Block {0} of {1} uploaded", blockIndex, fullFileName);\r
}\r
- catch (TaskCanceledException exc)\r
+ catch (TaskCanceledException)\r
{\r
throw new OperationCanceledException(token);\r
}\r
\r
token.ThrowIfCancellationRequested();\r
//Repeat until there are no more missing hashes \r
- missingHashes = await client.PutHashMap(account, container, url, treeHash).ConfigureAwait(false);\r
+ missingHashes = await client.PutHashMap(account, container, uri, treeHash).ConfigureAwait(false);\r
}\r
\r
ReportUploadProgress(fileInfo.Name, missingHashes.Count, 0, missingHashes.Count, fileInfo.Length);\r