示例#1
0
 public IFileStore GetFileStore(string name, bool create = true)
 {
     lock (this)
     {
         if (null == _stores)
         {
             _stores = ListFileStores().ToDictionary(x => x, x => new __Store(S3, x));
         }
         if (!_stores.ContainsKey(name))
         {
             if (create)
             {
                 S3.PutBucket(
                     new PutBucketRequest()
                     .WithBucketName(name)
                     .WithBucketRegion(S3Region.US)
                     );
                 _stores[name] = new __Store(S3, name);
             }
             else
             {
                 throw new Exception("Bucket does not exist and 'create' is false.");
             }
         }
         return(_stores[name]);
     }
 }
 public IFileStore GetFileStore(string name, bool create = true)
 {
     lock (this)
     {
         if (null == _stores)
         {
             _stores = ListFileStores().ToDictionary(x => x, x => new __Store(S3, x));
         }
         if (!_stores.ContainsKey(name))
         {
             if (create)
             {
                 S3.PutBucket(
                     new PutBucketRequest()
                     .WithBucketName(name)
                     .WithBucketRegion(S3Region.US)
                 );
                 _stores[name] = new __Store(S3, name);
             }
             else
             {
                 throw new Exception("Bucket does not exist and 'create' is false.");
             }
         }
         return _stores[name];
     }
 }