}\r
_cancellationSource = new CancellationTokenSource();\r
\r
- lock (this)\r
- {\r
- CloudClient = new CloudFilesClient(UserName, ApiKey)\r
- {UsePithos = true, AuthenticationUrl = AuthenticationUrl};\r
- _accountInfo = CloudClient.Authenticate();\r
- }\r
+ CloudClient = new CloudFilesClient(UserName, ApiKey)\r
+ {UsePithos = true, AuthenticationUrl = AuthenticationUrl};\r
+ \r
+ _accountInfo = await CloudClient.Authenticate().ConfigureAwait(false);\r
_accountInfo.SiteUri = AuthenticationUrl;\r
_accountInfo.AccountPath = RootPath;\r
\r
//Create the cache folder and ensure it is hidden\r
CreateHiddenFolder(RootPath, FolderConstants.CacheFolder);\r
\r
- var policy=CloudClient.GetAccountPolicies(_accountInfo);\r
+ var policy=await CloudClient.GetAccountPolicies(_accountInfo);\r
\r
StatusNotification.NotifyAccount(policy);\r
- EnsurePithosContainers();\r
+ await EnsurePithosContainers().ConfigureAwait(false);\r
\r
StatusKeeper.BlockHash = _blockHash;\r
StatusKeeper.BlockSize = _blockSize;\r
CleanupUnselectedStates();\r
}\r
\r
- private void EnsurePithosContainers()\r
+ private async Task EnsurePithosContainers()\r
{\r
\r
//Create the two default containers if they are missing\r
foreach (var container in pithosContainers)\r
{\r
var escapedUri = container.ToEscapedUri();\r
- var info=CloudClient.GetContainerInfo(UserName, escapedUri);\r
+ var info=await CloudClient.GetContainerInfo(UserName, escapedUri).ConfigureAwait(false);\r
if (info == ContainerInfo.Empty)\r
{\r
- CloudClient.CreateContainer(UserName, escapedUri);\r
- info = CloudClient.GetContainerInfo(UserName, escapedUri);\r
+ await CloudClient.CreateContainer(UserName, escapedUri);\r
+ info = await CloudClient.GetContainerInfo(UserName, escapedUri).ConfigureAwait(false);\r
}\r
_blockSize = info.BlockSize;\r
_blockHash = info.BlockHash;\r
ConcurrentBag<string> selectivePaths;\r
if (Selectives.SelectivePaths.TryGetValue(_accountInfo.AccountKey, out selectivePaths))\r
{\r
- var statePaths= FileState.Queryable.Select(state => state.FilePath).ToList();\r
+ var statePaths= StatusKeeper.GetAllStatePaths();\r
var removedPaths = statePaths\r
.Where(sp => !selectivePaths.Any(sp.IsAtOrBelow))\r
.ToList();\r
return;\r
\r
//Ensure we remove any file state below the deleted folders\r
- FileState.UnversionPaths(removed);\r
+ StatusKeeper.UnversionPaths(removed);\r
}\r
\r
\r
}\r
\r
\r
- public ObjectInfo GetObjectInfo(string filePath)\r
+ public async Task<ObjectInfo> GetObjectInfo(string filePath)\r
{\r
if (String.IsNullOrWhiteSpace(filePath))\r
throw new ArgumentNullException("filePath");\r
}\r
\r
var client = new CloudFilesClient(accountInfo);\r
- var objectInfo=client.GetObjectInfo(accountName, container.ToEscapedUri(), relativeUrl.ToEscapedUri());\r
+ var objectInfo=await client.GetObjectInfo(accountName, container.ToEscapedUri(), relativeUrl.ToEscapedUri()).ConfigureAwait(false);\r
return objectInfo;\r
}\r
\r
- public Task<ContainerInfo> GetContainerInfo(string filePath)\r
+ public async Task<ContainerInfo> GetContainerInfo(string filePath)\r
{\r
if (String.IsNullOrWhiteSpace(filePath))\r
throw new ArgumentNullException("filePath");\r
container = parts[0]; \r
}\r
\r
- return Task.Factory.StartNew(() =>\r
- {\r
- var client = new CloudFilesClient(accountInfo);\r
- var containerInfo = client.GetContainerInfo(accountName, container.ToEscapedUri());\r
- return containerInfo;\r
- });\r
+ \r
+ var client = new CloudFilesClient(accountInfo);\r
+ var containerInfo = await client.GetContainerInfo(accountName, container.ToEscapedUri()).ConfigureAwait(false);\r
+ return containerInfo;\r
+ \r
}\r
}\r
}\r