Revision 2115e2a5 trunk/Pithos.Network/CloudFilesClient.cs
b/trunk/Pithos.Network/CloudFilesClient.cs | ||
---|---|---|
148 | 148 |
|
149 | 149 |
public CloudFilesClient(AccountInfo accountInfo) |
150 | 150 |
{ |
151 |
if (accountInfo==null) |
|
152 |
throw new ArgumentNullException("accountInfo"); |
|
151 |
Contract.Requires<ArgumentNullException>(accountInfo!=null,"accountInfo is null"); |
|
153 | 152 |
Contract.Ensures(!String.IsNullOrWhiteSpace(Token)); |
154 | 153 |
Contract.Ensures(StorageUrl != null); |
155 | 154 |
Contract.Ensures(_baseClient != null); |
... | ... | |
481 | 480 |
|
482 | 481 |
public void SetTags(ObjectInfo target,IDictionary<string,string> tags) |
483 | 482 |
{ |
484 |
if (String.IsNullOrWhiteSpace(Token)) |
|
485 |
throw new InvalidOperationException("The Token is not set"); |
|
486 |
if (StorageUrl == null) |
|
487 |
throw new InvalidOperationException("The StorageUrl is not set"); |
|
488 |
if (target == null) |
|
489 |
throw new ArgumentNullException("target"); |
|
483 |
Contract.Requires<InvalidOperationException>(!String.IsNullOrWhiteSpace(Token),"The Token is not set"); |
|
484 |
Contract.Requires<InvalidOperationException>(StorageUrl != null,"The StorageUrl is not set"); |
|
485 |
Contract.Requires<ArgumentNullException>(target != null,"target is null"); |
|
490 | 486 |
Contract.EndContractBlock(); |
491 | 487 |
|
492 | 488 |
using (ThreadContext.Stacks["Share"].Push("Share Object")) |
... | ... | |
527 | 523 |
|
528 | 524 |
public void ShareObject(string account, Uri container, Uri objectName, string shareTo, bool read, bool write) |
529 | 525 |
{ |
530 |
if (String.IsNullOrWhiteSpace(Token)) |
|
531 |
throw new InvalidOperationException("The Token is not set"); |
|
532 |
if (StorageUrl==null) |
|
533 |
throw new InvalidOperationException("The StorageUrl is not set"); |
|
534 |
if (container==null) |
|
535 |
throw new ArgumentNullException("container"); |
|
536 |
if (container.IsAbsoluteUri) |
|
537 |
throw new ArgumentException("container"); |
|
538 |
if (objectName==null) |
|
539 |
throw new ArgumentNullException("objectName"); |
|
540 |
if (objectName.IsAbsoluteUri) |
|
541 |
throw new ArgumentException("objectName"); |
|
542 |
if (String.IsNullOrWhiteSpace(account)) |
|
543 |
throw new ArgumentNullException("account"); |
|
544 |
if (String.IsNullOrWhiteSpace(shareTo)) |
|
545 |
throw new ArgumentNullException("shareTo"); |
|
526 |
|
|
527 |
Contract.Requires<InvalidOperationException>(!String.IsNullOrWhiteSpace(Token), "The Token is not set"); |
|
528 |
Contract.Requires<InvalidOperationException>(StorageUrl != null, "The StorageUrl is not set"); |
|
529 |
Contract.Requires<ArgumentNullException>(container != null, "container is null"); |
|
530 |
Contract.Requires<ArgumentException>(!container.IsAbsoluteUri, "container is absolute"); |
|
531 |
Contract.Requires<ArgumentNullException>(objectName != null, "objectName is null"); |
|
532 |
Contract.Requires<ArgumentException>(!objectName.IsAbsoluteUri, "objectName is absolute"); |
|
533 |
Contract.Requires<ArgumentNullException>(!String.IsNullOrWhiteSpace(account), "account is not set"); |
|
534 |
Contract.Requires<ArgumentNullException>(!String.IsNullOrWhiteSpace(shareTo), "shareTo is not set"); |
|
546 | 535 |
Contract.EndContractBlock(); |
547 | 536 |
|
548 | 537 |
using (ThreadContext.Stacks["Share"].Push("Share Object")) |
... | ... | |
647 | 636 |
|
648 | 637 |
public void UpdateMetadata(ObjectInfo objectInfo) |
649 | 638 |
{ |
650 |
if (objectInfo == null) |
|
651 |
throw new ArgumentNullException("objectInfo"); |
|
639 |
Contract.Requires<ArgumentNullException>(objectInfo != null,"objectInfo is null"); |
|
652 | 640 |
Contract.EndContractBlock(); |
653 | 641 |
|
654 | 642 |
using (ThreadContext.Stacks["Objects"].Push("UpdateMetadata")) |
... | ... | |
760 | 748 |
|
761 | 749 |
public IList<ObjectInfo> ListObjects(string account, Uri container, DateTimeOffset? since = null) |
762 | 750 |
{ |
751 |
/* |
|
763 | 752 |
if (container==null) |
764 | 753 |
throw new ArgumentNullException("container"); |
765 | 754 |
if (container.IsAbsoluteUri) |
766 | 755 |
throw new ArgumentException("container"); |
767 | 756 |
Contract.EndContractBlock(); |
757 |
*/ |
|
768 | 758 |
|
769 | 759 |
using (ThreadContext.Stacks["Objects"].Push("List")) |
770 | 760 |
{ |
... | ... | |
797 | 787 |
|
798 | 788 |
public IList<ObjectInfo> ListObjects(string account, Uri container, Uri folder, DateTimeOffset? since = null) |
799 | 789 |
{ |
800 |
if (container==null) |
|
790 |
/* if (container==null)
|
|
801 | 791 |
throw new ArgumentNullException("container"); |
802 | 792 |
if (container.IsAbsoluteUri) |
803 | 793 |
throw new ArgumentException("container"); |
804 |
Contract.EndContractBlock(); |
|
794 |
Contract.EndContractBlock();*/
|
|
805 | 795 |
|
806 | 796 |
using (ThreadContext.Stacks["Objects"].Push("List")) |
807 | 797 |
{ |
... | ... | |
1048 | 1038 |
|
1049 | 1039 |
private Dictionary<string, string> GetMeta(HttpResponseMessage response,string metaPrefix) |
1050 | 1040 |
{ |
1051 |
if (String.IsNullOrWhiteSpace(metaPrefix)) |
|
1052 |
throw new ArgumentNullException("metaPrefix"); |
|
1041 |
Contract.Requires<ArgumentNullException>(!String.IsNullOrWhiteSpace(metaPrefix), "metaPrefix is empty"); |
|
1053 | 1042 |
Contract.EndContractBlock(); |
1054 | 1043 |
|
1055 | 1044 |
var dict = (from header in response.Headers |
Also available in: Unified diff