コード例 #1
0
        public ThreeSharpFormSample()
        {
            InitializeComponent();

            this.transfers = new BindingList <TransferInfo>();
            this.dataGridViewStatistics.DataSource = transfers;

            bindStatisticsDelegate = new BindStatisticsDelegate(this.BindStatistics);
            listBucketDelegate     = new ListBucketDelegate(this.ListBucket);
            listFolderDelegate     = new ListFolderDelegate(this.ListFolder);
            uploadFileDelegate     = new UploadFileDelegate(this.UploadFile);
            downloadFileDelegate   = new DownloadFileDelegate(this.DownloadFile);

            this.basePath = "C:\\";

            config = new ThreeSharpConfig();
            config.AwsAccessKeyID     = Properties.Settings.Default.AwsAccessKeyID;
            config.AwsSecretAccessKey = Properties.Settings.Default.AwsSecretAccessKey;
            config.ConnectionLimit    = 40;
            config.IsSecure           = true;

            // It is necessary to use the SUBDOMAIN CallingFormat for accessing EU buckets
            config.Format = CallingFormat.SUBDOMAIN;

            this.service = new ThreeSharpQuery(config);
        }
コード例 #2
0
        public ThreeSharpFormSample()
        {
            InitializeComponent();

            this.transfers = new BindingList<Transfer>();
            this.dataGridViewStatistics.DataSource = transfers;

            bindStatisticsDelegate = new BindStatisticsDelegate(this.BindStatistics);
            listBucketDelegate = new ListBucketDelegate(this.ListBucket);
            listFolderDelegate = new ListFolderDelegate(this.ListFolder);
            uploadFileDelegate = new UploadFileDelegate(this.UploadFile);
            downloadFileDelegate = new DownloadFileDelegate(this.DownloadFile);

            this.basePath = "C:\\";

            config = new ThreeSharpConfig();
            config.AwsAccessKeyID = Properties.Settings.Default.AwsAccessKeyID;
            config.AwsSecretAccessKey = Properties.Settings.Default.AwsSecretAccessKey;
            config.ConnectionLimit = 40;
            config.IsSecure = true;

            // It is necessary to use the SUBDOMAIN CallingFormat for accessing EU buckets
            config.Format = CallingFormat.SUBDOMAIN;

            this.service = new ThreeSharpQuery(config);
        }
コード例 #3
0
        public ThreeSharpWrapper(String awsAccessKeyId, String awsSecretAccessKey)
        {
            this.config = new ThreeSharpConfig();
            this.config.AwsAccessKeyID = awsAccessKeyId;
            this.config.AwsSecretAccessKey = awsSecretAccessKey;

            this.service = new ThreeSharpQuery(this.config);
        }
コード例 #4
0
        public ThreeSharpWrapper(String awsAccessKeyId, String awsSecretAccessKey)
        {
            this.config = new ThreeSharpConfig();
            this.config.AwsAccessKeyID     = awsAccessKeyId;
            this.config.AwsSecretAccessKey = awsSecretAccessKey;

            this.service = new ThreeSharpQuery(this.config);
        }
コード例 #5
0
        public S3Connection(String awsAccessKeyId, String awsSecretAccessKey)
        {
            m_config = new ThreeSharpConfig();
            m_config.AwsAccessKeyID = awsAccessKeyId;
            m_config.AwsSecretAccessKey = awsSecretAccessKey;
            m_config.IsSecure = false;

            m_service = new ThreeSharpQuery(m_config);
        }
コード例 #6
0
        public ThreeSharpS3Service(string accessKey, string secretKey)
        {
            var config = new ThreeSharpConfig();

            config.AwsAccessKeyID     = accessKey;
            config.AwsSecretAccessKey = secretKey;
            config.IsSecure           = false;

            client = new ThreeSharpQuery(config);
        }
コード例 #7
0
      public S3BinaryRepository()
      {
         ThreeSharpConfig config;
         
         config = new ThreeSharpConfig();
         config.AwsAccessKeyID = S3Storage.AccessKey;
         config.AwsSecretAccessKey = S3Storage.SecretAccessKey;
         config.ConnectionLimit = 40;
         config.IsSecure = true;

         _service = new ThreeSharpQuery(config);
      }
コード例 #8
0
      public BinaryRepository(string accessKey, string secretKey, string bucketName)
      {
         AccessKey = accessKey;
         SecretKey = secretKey;
         BucketName = bucketName;

         ThreeSharpConfig config;

         config = new ThreeSharpConfig();
         config.AwsAccessKeyID = accessKey;
         config.AwsSecretAccessKey = secretKey;
         config.ConnectionLimit = 40;
         config.IsSecure = true;
         config.Format = CallingFormat.SUBDOMAIN;

         _service = new ThreeSharpQuery(config);
      }
コード例 #9
0
ファイル: TadImage.cs プロジェクト: trevorpower/tadmap
        private void UploadImage(IThreeSharp service, Stream oStream, string strKey, string contentType)
        {
            using (ObjectAddRequest objectAddRequest = new ObjectAddRequest(S3Storage.BucketName, strKey))
            {
                byte[] buffer = new byte[oStream.Length];

                oStream.Read(buffer, 0, (int)oStream.Length);

                objectAddRequest.LoadStreamWithBytes(buffer, contentType);

                using (ObjectAddResponse objectAddResponse = service.ObjectAdd(objectAddRequest))
                { }
            }


            //// The first thing we need to do is check for the presence of a Temporary Redirect.  These occur for a few
            //// minutes after an EU bucket is created, while S3 creates the DNS entries.  If we get one, we need to upload
            //// the file to the redirect URL
            //String redirectUrl = null;
            //using (BucketListRequest testRequest = new BucketListRequest(S3Storage.BucketName))
            //{
            //   testRequest.Method = "HEAD";
            //   using (BucketListResponse testResponse = service.BucketList(testRequest))
            //   {
            //      if (testResponse.StatusCode == System.Net.HttpStatusCode.TemporaryRedirect)
            //      {
            //         redirectUrl = testResponse.Headers["Location"].ToString() + strKey;
            //      }
            //   }
            //}

            //using (ObjectAddRequest request = new ObjectAddRequest(S3Storage.BucketName, strKey))
            //{
            //   request.Headers.Add("x-amz-acl", "public-read-write");
            //   //request.ContentType = ThreeSharpUtils.ConvertExtensionToMimeType(Path.GetExtension(strKey));
            //   request.DataStream = oStream;
            //   request.BytesTotal = (request.DataStream).Length;
            //   //request.Timeout = iTimeout;

            //   if (redirectUrl != null)
            //   {
            //      request.RedirectUrl = redirectUrl;
            //   }

            //   using (ObjectAddResponse response = service.ObjectAdd(request))
            //   { }
            //}
        }