public static ObjectMetadata ToObjectMetadata(this ResourceMetaData instance) { ObjectMetadata omd = new ObjectMetadata(); omd.CacheControl = instance.CacheControl; omd.ContentType = instance.ContentType; return(omd); }
public void Put(string resourceKey, Stream stream, ResourceMetaData metaData = null) { try { if (metaData == null) { var metadata = new ObjectMetadata(); metadata.CacheControl = "No-Cache"; metadata.ContentType = "text/html"; client.PutBigObject(AliResourceSection.Instance.BucketName, AliResourceSection.Instance.ResourcePrefix + resourceKey, stream, metadata); } else { ObjectMetadata omd = metaData.ToObjectMetadata(); client.PutBigObject(AliResourceSection.Instance.BucketName, AliResourceSection.Instance.ResourcePrefix + resourceKey, stream, omd); } } catch (Exception error) { logger.Fatal(string.Format("添加键为{0}的资源发生异常:", resourceKey), error); throw error; } }
public async Task PutAsync(string resourceKey, string filePath, ResourceMetaData metaData = null) { await Task.Run(() => Put(resourceKey, filePath, metaData)); }
public async Task PutAsync(string resourceKey, Stream stream, ResourceMetaData metaData = null) { await Task.Run(() => Put(resourceKey, stream, metaData)); }
public async Task PutAsync(string resourceKey, string filePath, ResourceMetaData metaData = null) { await provider.PutAsync(resourceKey, filePath, metaData); }
public async Task PutAsync(string resourceKey, Stream stream, ResourceMetaData metaData = null) { await provider.PutAsync(resourceKey, stream, metaData); }
public void Put(string resourceKey, string filePath, ResourceMetaData metaData = null) { provider.Put(resourceKey, filePath, metaData); }
public void Put(string resourceKey, Stream stream, ResourceMetaData metaData = null) { provider.Put(resourceKey, stream, metaData); }