public virtual async Task Delete(string key) { this.CheckSaveKey(key); var bm = new BucketManager(this._mac); // 返回结果存储在result中 var res = await bm.DeleteAsync(this._option.QiniuBucketName, key); res.ThrowIfException(); }
protected override async Task RemoveFileAsync(FileInfo fileInfo, CancellationToken cancellationToken = default) { Mac mac = new Mac(Options.AccessKey, Options.SecretKey); var bucket = fileInfo.Directory + ":" + fileInfo.Name; var backetManager = new BucketManager(mac); await backetManager.DeleteAsync(bucket, fileInfo.Name); throw new NotImplementedException(); }
public async Task <bool> DeleteFileAsync(string fileName) { Mac mac = new Mac(AccessKey, SecretKey); BucketManager bucketManager = new BucketManager(mac); HttpResult deleteRet = await bucketManager.DeleteAsync(Bucket, fileName); if (deleteRet.Code != (int)HttpCode.OK) { return(true); } return(false); }
public async Task DeleteTest() { Mac mac = new Mac(AccessKey, SecretKey); BucketManager target = new BucketManager(mac); HttpResult result = await target.DeleteAsync(Bucket1, FileKey1); bool cond = (result.Code == (int)HttpCode.OK || result.Code == (int)HttpCode.BUCKET_NOT_EXIST || result.Code == (int)HttpCode.FILE_NOT_EXIST); Assert.IsTrue(cond); }