diff --git a/dotnet/dist/AbortMultiPartsUpload.cs b/dotnet/dist/AbortMultiPartsUpload.cs index b337c97..441463f 100644 --- a/dotnet/dist/AbortMultiPartsUpload.cs +++ b/dotnet/dist/AbortMultiPartsUpload.cs @@ -31,8 +31,8 @@ public class AbortMultiPartsUploadModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -112,4 +112,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/AppendObject.cs b/dotnet/dist/AppendObject.cs new file mode 100644 index 0000000..68e89a2 --- /dev/null +++ b/dotnet/dist/AppendObject.cs @@ -0,0 +1,104 @@ +using COSXML.Common; +using COSXML.CosException; +using COSXML.Model; +using COSXML.Model.Object; +using COSXML.Model.Tag; +using COSXML.Model.Bucket; +using COSXML.Model.Service; +using COSXML.Utils; +using COSXML.Auth; +using COSXML.Transfer; +using System; +using COSXML; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Net; + +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using COSXML.Log; +using System.Net.Cache; +using System.Collections; + + +namespace COSSnippet +{ + public class AppendObjectModel { + + private static CosXml cosXml; + private static int count = 0; + + AppendObjectModel() { + CosXmlConfig config = new CosXmlConfig.Builder() + .SetRegion("") //设置一个默认的存储桶地域 + .Build(); + + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey + long durationSecond = 600; //每次请求签名有效时长,单位为秒 + QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, + secretKey, durationSecond); + + cosXml = new CosXmlServer(config, qCloudCredentialProvider); + } + + /// 简单上传对象 + public void AppendObject() + { + //.cssg-snippet-body-start:[Append-object] + try + { + string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID + string key = "exampleobject"; //对象键 + string srcPath = @"temp-source-file";//本地文件绝对路径 + + //首次append上传,追加位置传0,创建一个appendable对象 + long next_append_position = 0; + AppendObjectRequest request = new AppendObjectRequest(bucket, key, srcPath, next_append_position); + //设置进度回调 + request.SetCosProgressCallback(delegate (long completed, long total) + { + Console.WriteLine(String.Format("progress = {0:##.##}%", completed * 100.0 / total)); + }); + AppendObjectResult result = cosXml.AppendObject(request); + //获取下次追加位置 + next_append_position = result.nextAppendPosition; + Console.WriteLine(result.GetResultInfo()); + + //执行追加,传入上次获取的对象末尾 + request = new AppendObjectRequest(bucket, key, srcPath, next_append_position); + request.SetCosProgressCallback(delegate (long completed, long total) + { + Console.WriteLine(String.Format("progress = {0:##.##}%", completed * 100.0 / total)); + }); + result = cosXml.AppendObject(request); + Console.WriteLine(result.GetResultInfo()); + } + catch (COSXML.CosException.CosClientException clientEx) + { + //请求失败 + Console.WriteLine("CosClientException: " + clientEx); + } + catch (COSXML.CosException.CosServerException serverEx) + { + //请求失败 + Console.WriteLine("CosServerException: " + serverEx.GetInfo()); + } + + //.cssg-snippet-body-end + } + + // .cssg-methods-pragm + + static void Main(string[] args) + { + AppendObjectModel m = new AppendObjectModel(); + m.AppendObject(); + } + } +} diff --git a/dotnet/dist/BucketACL.cs b/dotnet/dist/BucketACL.cs index 6f126a2..0328cf2 100644 --- a/dotnet/dist/BucketACL.cs +++ b/dotnet/dist/BucketACL.cs @@ -29,8 +29,8 @@ public class BucketACLModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -111,4 +111,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketCORS.cs b/dotnet/dist/BucketCORS.cs index 6190805..3f00f1b 100644 --- a/dotnet/dist/BucketCORS.cs +++ b/dotnet/dist/BucketCORS.cs @@ -29,8 +29,8 @@ public class BucketCORSModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -186,4 +186,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketDomain.cs b/dotnet/dist/BucketDomain.cs index f59b10b..bc29eb9 100644 --- a/dotnet/dist/BucketDomain.cs +++ b/dotnet/dist/BucketDomain.cs @@ -29,8 +29,8 @@ public class BucketDomainModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -124,4 +124,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketInventory.cs b/dotnet/dist/BucketInventory.cs index 31a2163..818ed10 100644 --- a/dotnet/dist/BucketInventory.cs +++ b/dotnet/dist/BucketInventory.cs @@ -29,8 +29,8 @@ public class BucketInventoryModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -152,4 +152,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketLifecycle.cs b/dotnet/dist/BucketLifecycle.cs index b9a9cc0..c9b999b 100644 --- a/dotnet/dist/BucketLifecycle.cs +++ b/dotnet/dist/BucketLifecycle.cs @@ -29,8 +29,8 @@ public class BucketLifecycleModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -148,4 +148,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketLogging.cs b/dotnet/dist/BucketLogging.cs index e49539e..90f40a6 100644 --- a/dotnet/dist/BucketLogging.cs +++ b/dotnet/dist/BucketLogging.cs @@ -29,8 +29,8 @@ public class BucketLoggingModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -109,4 +109,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketPolicy.cs b/dotnet/dist/BucketPolicy.cs index d759c19..4b2dc54 100644 --- a/dotnet/dist/BucketPolicy.cs +++ b/dotnet/dist/BucketPolicy.cs @@ -29,8 +29,8 @@ public class BucketPolicyModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -77,4 +77,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketReplication.cs b/dotnet/dist/BucketReplication.cs index 24ad004..ea33efa 100644 --- a/dotnet/dist/BucketReplication.cs +++ b/dotnet/dist/BucketReplication.cs @@ -29,8 +29,8 @@ public class BucketReplicationModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -139,4 +139,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketTagging.cs b/dotnet/dist/BucketTagging.cs index 961f3e3..60673f4 100644 --- a/dotnet/dist/BucketTagging.cs +++ b/dotnet/dist/BucketTagging.cs @@ -29,8 +29,8 @@ public class BucketTaggingModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -143,4 +143,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketVersioning.cs b/dotnet/dist/BucketVersioning.cs index 6867207..7a75edd 100644 --- a/dotnet/dist/BucketVersioning.cs +++ b/dotnet/dist/BucketVersioning.cs @@ -29,8 +29,8 @@ public class BucketVersioningModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -101,4 +101,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/BucketWebsite.cs b/dotnet/dist/BucketWebsite.cs index 85f2f1f..b0f5f9d 100644 --- a/dotnet/dist/BucketWebsite.cs +++ b/dotnet/dist/BucketWebsite.cs @@ -29,8 +29,8 @@ public class BucketWebsiteModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -136,4 +136,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/CopyObject.cs b/dotnet/dist/CopyObject.cs index 151a6b9..eafe386 100644 --- a/dotnet/dist/CopyObject.cs +++ b/dotnet/dist/CopyObject.cs @@ -29,8 +29,8 @@ public class CopyObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -132,4 +132,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/CustomCredentialProvider.cs b/dotnet/dist/CustomCredentialProvider.cs index 11a844b..1075cfd 100644 --- a/dotnet/dist/CustomCredentialProvider.cs +++ b/dotnet/dist/CustomCredentialProvider.cs @@ -17,8 +17,8 @@ public CustomQCloudCredentialProvider(): base(null, null, 0L, null) { public override void Refresh() { //... 这里通过腾讯云请求临时密钥 - string tmpSecretId = "COS_SECRETID"; //"临时密钥 SecretId"; - string tmpSecretKey = "COS_SECRETKEY"; //"临时密钥 SecretKey"; + string tmpSecretId = "SECRET_ID"; //"临时密钥 SecretId"; + string tmpSecretKey = "SECRET_KEY"; //"临时密钥 SecretKey"; string tmpToken = "COS_TOKEN"; //"临时密钥 token"; long tmpStartTime = 1546861202;//临时密钥有效开始时间,精确到秒 long tmpExpiredTime = 1546862502;//临时密钥有效截止时间,精确到秒 @@ -34,4 +34,4 @@ public void init() { } } -} \ No newline at end of file +} diff --git a/dotnet/dist/DeleteBucket.cs b/dotnet/dist/DeleteBucket.cs index 01a3d6a..33715de 100644 --- a/dotnet/dist/DeleteBucket.cs +++ b/dotnet/dist/DeleteBucket.cs @@ -29,8 +29,8 @@ public class DeleteBucketModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -76,4 +76,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/DeleteObject.cs b/dotnet/dist/DeleteObject.cs index 53d169e..e74cfa5 100644 --- a/dotnet/dist/DeleteObject.cs +++ b/dotnet/dist/DeleteObject.cs @@ -29,8 +29,8 @@ public class DeleteObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -171,4 +171,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/GetAuthorization.cs b/dotnet/dist/GetAuthorization.cs index 5931d36..1590fcf 100644 --- a/dotnet/dist/GetAuthorization.cs +++ b/dotnet/dist/GetAuthorization.cs @@ -29,8 +29,8 @@ public class GetAuthorizationModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -57,4 +57,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/GetObject.cs b/dotnet/dist/GetObject.cs index be24ab8..ac689e1 100644 --- a/dotnet/dist/GetObject.cs +++ b/dotnet/dist/GetObject.cs @@ -29,8 +29,8 @@ public class GetObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -116,4 +116,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/GetService.cs b/dotnet/dist/GetService.cs index 50f601b..5e3ab35 100644 --- a/dotnet/dist/GetService.cs +++ b/dotnet/dist/GetService.cs @@ -29,8 +29,8 @@ public class GetServiceModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -114,4 +114,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/HeadBucket.cs b/dotnet/dist/HeadBucket.cs index 0678d77..850e3e7 100644 --- a/dotnet/dist/HeadBucket.cs +++ b/dotnet/dist/HeadBucket.cs @@ -29,8 +29,8 @@ public class HeadBucketModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -76,4 +76,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/HeadObject.cs b/dotnet/dist/HeadObject.cs index 279c31d..134164b 100644 --- a/dotnet/dist/HeadObject.cs +++ b/dotnet/dist/HeadObject.cs @@ -29,8 +29,8 @@ public class HeadObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -77,4 +77,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ListObjects.cs b/dotnet/dist/ListObjects.cs index edfed65..c335d40 100644 --- a/dotnet/dist/ListObjects.cs +++ b/dotnet/dist/ListObjects.cs @@ -30,8 +30,8 @@ public class ListObjectsModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -146,4 +146,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ListObjectsVersioning.cs b/dotnet/dist/ListObjectsVersioning.cs index 0dc19e2..4a9f1a3 100644 --- a/dotnet/dist/ListObjectsVersioning.cs +++ b/dotnet/dist/ListObjectsVersioning.cs @@ -31,8 +31,8 @@ public class ListObjectsVersioningModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -124,4 +124,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ModifyObjectProperty.cs b/dotnet/dist/ModifyObjectProperty.cs index a1e2b43..0a46e77 100644 --- a/dotnet/dist/ModifyObjectProperty.cs +++ b/dotnet/dist/ModifyObjectProperty.cs @@ -29,8 +29,8 @@ public class ModifyObjectPropertyModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -130,4 +130,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/MoveObject.cs b/dotnet/dist/MoveObject.cs index 4f2b105..1ee3dde 100644 --- a/dotnet/dist/MoveObject.cs +++ b/dotnet/dist/MoveObject.cs @@ -29,8 +29,8 @@ public class MoveObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -88,4 +88,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/MultiPartsCopyObject.cs b/dotnet/dist/MultiPartsCopyObject.cs index 90b8355..43e9a81 100644 --- a/dotnet/dist/MultiPartsCopyObject.cs +++ b/dotnet/dist/MultiPartsCopyObject.cs @@ -31,8 +31,8 @@ public class MultiPartsCopyObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -161,4 +161,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/MultiPartsUploadObject.cs b/dotnet/dist/MultiPartsUploadObject.cs index d031d94..e226dd9 100644 --- a/dotnet/dist/MultiPartsUploadObject.cs +++ b/dotnet/dist/MultiPartsUploadObject.cs @@ -31,8 +31,8 @@ public class MultiPartsUploadObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -217,4 +217,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ObjectACL.cs b/dotnet/dist/ObjectACL.cs index a9261b9..e7e8371 100644 --- a/dotnet/dist/ObjectACL.cs +++ b/dotnet/dist/ObjectACL.cs @@ -29,8 +29,8 @@ public class ObjectACLModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -115,4 +115,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ObjectPresignUrl.cs b/dotnet/dist/ObjectPresignUrl.cs index 578b157..5c18fc2 100644 --- a/dotnet/dist/ObjectPresignUrl.cs +++ b/dotnet/dist/ObjectPresignUrl.cs @@ -29,8 +29,8 @@ public class ObjectPresignUrlModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -148,4 +148,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/ObjectTagging.cs b/dotnet/dist/ObjectTagging.cs index 912c49e..307b0d5 100644 --- a/dotnet/dist/ObjectTagging.cs +++ b/dotnet/dist/ObjectTagging.cs @@ -29,8 +29,8 @@ public class ObjectTaggingModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -77,4 +77,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PictureOperation.cs b/dotnet/dist/PictureOperation.cs index fc266f4..73547f5 100644 --- a/dotnet/dist/PictureOperation.cs +++ b/dotnet/dist/PictureOperation.cs @@ -32,8 +32,8 @@ public class PictureOperationModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -188,4 +188,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PostObject.cs b/dotnet/dist/PostObject.cs index 2eae089..23e4a0c 100644 --- a/dotnet/dist/PostObject.cs +++ b/dotnet/dist/PostObject.cs @@ -29,8 +29,8 @@ public class PostObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -83,4 +83,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PutBucket.cs b/dotnet/dist/PutBucket.cs index 03400df..edf45fb 100644 --- a/dotnet/dist/PutBucket.cs +++ b/dotnet/dist/PutBucket.cs @@ -29,8 +29,8 @@ public class PutBucketModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -110,4 +110,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PutObject.cs b/dotnet/dist/PutObject.cs index 4e7d0a2..446db72 100644 --- a/dotnet/dist/PutObject.cs +++ b/dotnet/dist/PutObject.cs @@ -29,8 +29,8 @@ public class PutObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -84,4 +84,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PutObjectCSE.cs b/dotnet/dist/PutObjectCSE.cs index 1081aed..afe294d 100644 --- a/dotnet/dist/PutObjectCSE.cs +++ b/dotnet/dist/PutObjectCSE.cs @@ -29,8 +29,8 @@ public class PutObjectCSEModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -67,4 +67,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/PutObjectSSE.cs b/dotnet/dist/PutObjectSSE.cs index ecf5afe..7e6a8ff 100644 --- a/dotnet/dist/PutObjectSSE.cs +++ b/dotnet/dist/PutObjectSSE.cs @@ -29,8 +29,8 @@ public class PutObjectSSEModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -92,4 +92,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/QrcodeRecognition.cs b/dotnet/dist/QrcodeRecognition.cs index 13160af..5b493d8 100644 --- a/dotnet/dist/QrcodeRecognition.cs +++ b/dotnet/dist/QrcodeRecognition.cs @@ -32,8 +32,8 @@ public class QrcodeRecognitionModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -96,4 +96,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/RestoreObject.cs b/dotnet/dist/RestoreObject.cs index fc075a0..1e3ded6 100644 --- a/dotnet/dist/RestoreObject.cs +++ b/dotnet/dist/RestoreObject.cs @@ -29,8 +29,8 @@ public class RestoreObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -81,4 +81,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/SelectObject.cs b/dotnet/dist/SelectObject.cs index d0c0eba..d84ee0d 100644 --- a/dotnet/dist/SelectObject.cs +++ b/dotnet/dist/SelectObject.cs @@ -29,8 +29,8 @@ public class SelectObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -90,4 +90,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/SetCustomDomain.cs b/dotnet/dist/SetCustomDomain.cs index 193076a..45bee52 100644 --- a/dotnet/dist/SetCustomDomain.cs +++ b/dotnet/dist/SetCustomDomain.cs @@ -29,8 +29,8 @@ public class SetCustomDomainModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -106,4 +106,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/SetCustomHeaders.cs b/dotnet/dist/SetCustomHeaders.cs index b1c3705..35eabcb 100644 --- a/dotnet/dist/SetCustomHeaders.cs +++ b/dotnet/dist/SetCustomHeaders.cs @@ -29,8 +29,8 @@ public class SetCustomHeadersModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -66,4 +66,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/TransferCopyObject.cs b/dotnet/dist/TransferCopyObject.cs index 14d7f0d..feed7e6 100644 --- a/dotnet/dist/TransferCopyObject.cs +++ b/dotnet/dist/TransferCopyObject.cs @@ -29,8 +29,8 @@ public class TransferCopyObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -83,4 +83,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/TransferDownloadObject.cs b/dotnet/dist/TransferDownloadObject.cs index b82aef9..0601332 100644 --- a/dotnet/dist/TransferDownloadObject.cs +++ b/dotnet/dist/TransferDownloadObject.cs @@ -29,8 +29,8 @@ public class TransferDownloadObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -134,7 +134,7 @@ public async void DownloadObjectTrafficLimit() } /// 设置支持断点下载 - public void TransferDownloadResumable() + public async void TransferDownloadResumable() { TransferConfig transferConfig = new TransferConfig(); @@ -150,8 +150,17 @@ public void TransferDownloadResumable() cosPath, localDir, localFileName); //.cssg-snippet-body-start:[transfer-download-resumable] COSXMLDownloadTask downloadTask = new COSXMLDownloadTask(request); + //开启断点续传,当本地存在未下载完成文件时,追加下载到文件末尾 + //本地文件已存在部分内容可能导致下载失败,请删除重试 downloadTask.SetResumableDownload(true); - + try { + COSXML.Transfer.COSXMLDownloadTask.DownloadTaskResult result = await + transferManager.DownloadAsync(downloadTask); + Console.WriteLine(result.GetResultInfo()); + string eTag = result.eTag; + } catch (Exception e) { + Console.WriteLine("CosException: " + e); + } //.cssg-snippet-body-end } @@ -178,4 +187,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +} diff --git a/dotnet/dist/TransferUploadObject.cs b/dotnet/dist/TransferUploadObject.cs index 8594641..307dced 100644 --- a/dotnet/dist/TransferUploadObject.cs +++ b/dotnet/dist/TransferUploadObject.cs @@ -29,8 +29,8 @@ public class TransferUploadObjectModel { .SetRegion("COS_REGION") //设置一个默认的存储桶地域 .Build(); - string secretId = "COS_SECRETID"; //云 API 密钥 SecretId - string secretKey = "COS_SECRETKEY"; //云 API 密钥 SecretKey + string secretId = "SECRET_ID"; //云 API 密钥 SecretId + string secretKey = "SECRET_KEY"; //云 API 密钥 SecretKey long durationSecond = 600; //每次请求签名有效时长,单位为秒 QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond); @@ -245,4 +245,4 @@ static void Main(string[] args) // .cssg-methods-pragma } } -} \ No newline at end of file +}