public static void AsynListBucketVersions(COSXML.CosXml cosXml, string bucket) { ListBucketVersionsRequest request = new ListBucketVersionsRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 cosXml.ListBucketVersions(request, delegate(CosResult cosResult) { ListBucketVersionsResult result = cosResult as ListBucketVersionsResult; Console.WriteLine(result.GetResultInfo()); }, delegate(CosClientException clientEx, CosServerException serverEx) { if (clientEx != null) { QLog.D("XIAO", clientEx.Message); Console.WriteLine("CosClientException: " + clientEx.Message); } if (serverEx != null) { QLog.D("XIAO", serverEx.Message); Console.WriteLine("CosServerException: " + serverEx.GetInfo()); } }); }
public static void ListBucketVersions(COSXML.CosXml cosXml, string bucket) { try { ListBucketVersionsRequest request = new ListBucketVersionsRequest(bucket); //设置签名有效时长 request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600); //执行请求 ListBucketVersionsResult result = cosXml.ListBucketVersions(request); Console.WriteLine(result.GetResultInfo()); } catch (COSXML.CosException.CosClientException clientEx) { QLog.D("XIAO", clientEx.Message); Console.WriteLine("CosClientException: " + clientEx.Message); } catch (COSXML.CosException.CosServerException serverEx) { QLog.D("XIAO", serverEx.Message); Console.WriteLine("CosServerException: " + serverEx.GetInfo()); } }