private void DownloadObject(S3Objects s3Objects) { var request = new GetObjectRequest { BucketName = s3Objects.BucketName , Key = s3Objects.Key }; if (this.s3ClientHandler.GetObject(request, "C:\\Download\\" + s3Objects.GetFileName())) { MessageBox.Show("Download Completed !"); } else { MessageBox.Show("Download Failed !"); } }
public AwsS3Controller(s3uploadtestContext context, IAmazonS3 client) { _context = context; S3Client = client; S3Items = new S3Objects(S3Client); }
private async Task GetObjectList(string BucketName, string Prefix) { this.StartSpinnerFrame(); this.BucketName = BucketName; this.FolderKey = Prefix; this.NavigationPanel.Children.Clear(); this.NavigationPanel.Children.Add(this.GetHyperLinkLabel(BucketName, "", RefreshFolder)); if (this.FolderKey != "") { string[] FolderKeys = this.FolderKey.Split('/'); string FolderKeyOrigin = ""; foreach (string Key in FolderKeys) { FolderKeyOrigin += Key + "/"; if (Key != "") { this.NavigationPanel.Children.Add(new Label { Content = " > " }); int iChild = this.NavigationPanel.Children.Add(this.GetHyperLinkLabel(FolderKey, FolderKeyOrigin, RefreshFolder)); } } } var request = new ListObjectsV2Request { BucketName = BucketName , Prefix = Prefix , Delimiter = "/" }; ObjectList.Items.Clear(); ListObjectsV2Response response; do { response = await this.s3ClientHandler.ListObjectsV2Async(request); foreach (string commonPrefix in response.CommonPrefixes) { var s3Objects = new S3Objects { Image = ResourceHelper.GetBitmapFrameForResourceImage(S3Browser.Properties.Resources.blue_folder) , Type = "Folder" , BucketName = BucketName , Key = commonPrefix , Name = this.FolderKey.Length > 0 ? commonPrefix.Replace(this.FolderKey, "") : commonPrefix }; ListViewItem item = new ListViewItem { Content = s3Objects }; _ = this.ObjectList.Items.Add(item); } foreach (S3Object s3Object in response.S3Objects) { var s3Objects = new S3Objects { Image = ResourceHelper.GetBitmapFrameForResourceImage(S3Browser.Properties.Resources.document) , Type = "Object" , BucketName = s3Object.BucketName , Key = s3Object.Key , Name = this.FolderKey.Length > 0 ? s3Object.Key.Replace(this.FolderKey, "") : s3Object.Key , LastModified = s3Object.LastModified , Owner = s3Object.Owner , StorageClass = s3Object.StorageClass }; s3Objects.SetSize(s3Object.Size); _ = this.ObjectList.Items.Add(new ListViewItem { Content = s3Objects }); } request.ContinuationToken = response.NextContinuationToken; this.EndSpinnerFrame(); } while (response.IsTruncated); }
public AwsS3Controller(s3uploadtestContext context) { _context = context; // S3Client = client; S3Items = new S3Objects(); }