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); }
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); }
public ThreeSharpWrapper(String awsAccessKeyId, String awsSecretAccessKey) { this.config = new ThreeSharpConfig(); this.config.AwsAccessKeyID = awsAccessKeyId; this.config.AwsSecretAccessKey = awsSecretAccessKey; this.service = new ThreeSharpQuery(this.config); }
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); }
public ThreeSharpS3Service(string accessKey, string secretKey) { var config = new ThreeSharpConfig(); config.AwsAccessKeyID = accessKey; config.AwsSecretAccessKey = secretKey; config.IsSecure = false; client = new ThreeSharpQuery(config); }
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); }
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); }
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)) // { } //} }