Revision 42800be8 trunk/Pithos.Core/PithosMonitor.cs
b/trunk/Pithos.Core/PithosMonitor.cs | ||
---|---|---|
455 | 455 |
container = parts[0]; |
456 | 456 |
relativeUrl = String.Join("/", parts.Splice(1)); |
457 | 457 |
} |
458 |
|
|
459 |
/*return new ObjectInfo |
|
460 |
{ |
|
461 |
Account = accountName, |
|
462 |
Container = container, |
|
463 |
Name = relativeUrl, |
|
464 |
Content_Type="application/pdf", |
|
465 |
Bytes = 123456, |
|
466 |
Hash = "8902372934sjhshjfsdjkf223894sdgh", |
|
467 |
Last_Modified = DateTime.Today.AddDays(-1), |
|
468 |
ModifiedBy = accountName, |
|
469 |
Version = 12312455, |
|
470 |
VersionTimestamp = DateTime.Today.AddDays(-1) |
|
471 |
};*/ |
|
472 |
|
|
458 |
|
|
473 | 459 |
var client = new CloudFilesClient(accountInfo); |
474 | 460 |
var objectInfo=client.GetObjectInfo(accountName, container, relativeUrl); |
475 | 461 |
return objectInfo; |
476 | 462 |
} |
463 |
|
|
464 |
public ContainerInfo GetContainerInfo(string filePath) |
|
465 |
{ |
|
466 |
if (String.IsNullOrWhiteSpace(filePath)) |
|
467 |
throw new ArgumentNullException("filePath"); |
|
468 |
Contract.EndContractBlock(); |
|
469 |
|
|
470 |
var file=new FileInfo(filePath); |
|
471 |
var relativePath = file.AsRelativeTo(RootPath); |
|
472 |
|
|
473 |
string accountName,container; |
|
474 |
|
|
475 |
var parts=relativePath.Split('\\'); |
|
476 |
|
|
477 |
var accountInfo = _accountInfo; |
|
478 |
if (relativePath.StartsWith(FolderConstants.OthersFolder)) |
|
479 |
{ |
|
480 |
accountName = parts[1]; |
|
481 |
container = parts[2]; |
|
482 |
//Create the root URL for the target account |
|
483 |
var oldName = UserName; |
|
484 |
var absoluteUri = _accountInfo.StorageUri.AbsoluteUri; |
|
485 |
var nameIndex=absoluteUri.IndexOf(oldName); |
|
486 |
var root=absoluteUri.Substring(0, nameIndex); |
|
487 |
|
|
488 |
accountInfo = new AccountInfo |
|
489 |
{ |
|
490 |
UserName = accountName, |
|
491 |
AccountPath = Path.Combine(accountInfo.AccountPath, parts[0], parts[1]), |
|
492 |
StorageUri = new Uri(root + accountName), |
|
493 |
BlockHash=accountInfo.BlockHash, |
|
494 |
BlockSize=accountInfo.BlockSize, |
|
495 |
Token=accountInfo.Token |
|
496 |
}; |
|
497 |
} |
|
498 |
else |
|
499 |
{ |
|
500 |
accountName = UserName; |
|
501 |
container = parts[0]; |
|
502 |
} |
|
503 |
|
|
504 |
var client = new CloudFilesClient(accountInfo); |
|
505 |
var containerInfo=client.GetContainerInfo(accountName, container); |
|
506 |
return containerInfo; |
|
507 |
} |
|
477 | 508 |
} |
478 | 509 |
|
479 | 510 |
|
Also available in: Unified diff