Amazon.S3.AmazonS3Client.ListObjects C# (CSharp) Метод

ListObjects() публичный Метод

Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
public ListObjects ( ListObjectsRequest request ) : ListObjectsResponse
request ListObjectsRequest Container for the necessary parameters to execute the ListObjects service method.
Результат ListObjectsResponse
        public ListObjectsResponse ListObjects(ListObjectsRequest request)
        {
            var marshaller = new ListObjectsRequestMarshaller();
            var unmarshaller = ListObjectsResponseUnmarshaller.Instance;

            return Invoke<ListObjectsRequest,ListObjectsResponse>(request, marshaller, unmarshaller);
        }

Same methods

AmazonS3Client::ListObjects ( string bucketName ) : ListObjectsResponse
AmazonS3Client::ListObjects ( string bucketName, string prefix ) : ListObjectsResponse

Usage Example

Пример #1
6
        public void RefreshAssetList()
        {
            string SecretKey = null;
            string PublicKey = null;
            AmazonS3Client Client = new AmazonS3Client(PublicKey, SecretKey);

            ListObjectsRequest Request = new ListObjectsRequest
            {
                BucketName = "assets.minecraft.net",
            };

            ListObjectsResponse Result;

            List<Release> releases = new List<Release>();
            do
            {
                Result = Client.ListObjects(Request);
                foreach (S3Object o in Result.S3Objects)
                {
                    string IsSnapshot = "Release";
                    if(!o.Key.Contains("minecraft.jar")) continue;
                    if (Regex.IsMatch(o.Key, "[0-9][0-9]w[0-9][0-9]")) IsSnapshot = "Snapshot";
                    else if (o.Key.Contains("pre")) IsSnapshot = "Pre-release";
                    releases.Add(new Release {  Version = o.Key.Split('/')[0],
                                                Size = (o.Size / 1024).ToString() + "KB",
                                                Uploaded = DateTime.Parse(o.LastModified),
                                                Type = IsSnapshot,
                                                Key = o.Key} );
                }
            }
            while (Result.IsTruncated);
            releases.Sort(new Comparison<Release>((x, y) => DateTime.Compare(y.Uploaded, x.Uploaded)));
            _Releases.Clear();
            foreach (Release r in releases)
            {
                _Releases.Add(r);
            }
            Client.Dispose();
            Result.Dispose();
        }
All Usage Examples Of Amazon.S3.AmazonS3Client::ListObjects
AmazonS3Client