public AliyunOss(string endpoint, string accessKeyId, string accessKeySecret) { EndPoint = endpoint; AccessKeyId = accessKeyId; AccessKeySecret = accessKeySecret; client = new Aliyun.OSS.OssClient("https://" + EndPoint, AccessKeyId, AccessKeySecret); }
/// <summary> /// /// </summary> /// <param name="config"></param> public void Configure(Dictionary <string, string> config) { this.endpoint = config.ContainsKey("endpoint") ? config["endpoint"] : ""; this.accessKeyId = config.ContainsKey("accessKeyId") ? config["accessKeyId"] : ""; this.accessKeySecret = config.ContainsKey("accessKeySecret") ? config["accessKeySecret"] : ""; client = new Aliyun.OSS.OssClient(this.endpoint, this.accessKeyId, this.accessKeySecret); this.bucketName = config.ContainsKey("bucketName") ? config["bucketName"] : ""; string strOptCountQuotaPerDay = config.ContainsKey("optCountQuotaPerDay") ? config["optCountQuotaPerDay"] : ""; if (!Int32.TryParse(strOptCountQuotaPerDay, out optCountQuotaPerDay)) { optCountQuotaPerDay = 10000; } this.objectMetadata_CacheControl = config.ContainsKey("objectMetadata_CacheControl") ? config["objectMetadata_CacheControl"] : ""; }