Beispiel #1
0
        public static ObjectMetadata ToObjectMetadata(this ResourceMetaData instance)
        {
            ObjectMetadata omd = new ObjectMetadata();

            omd.CacheControl = instance.CacheControl;
            omd.ContentType  = instance.ContentType;
            return(omd);
        }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
 public async Task PutAsync(string resourceKey, string filePath, ResourceMetaData metaData = null)
 {
     await Task.Run(() => Put(resourceKey, filePath, metaData));
 }
Beispiel #4
0
 public async Task PutAsync(string resourceKey, Stream stream, ResourceMetaData metaData = null)
 {
     await Task.Run(() => Put(resourceKey, stream, metaData));
 }
Beispiel #5
0
 public async Task PutAsync(string resourceKey, string filePath, ResourceMetaData metaData = null)
 {
     await provider.PutAsync(resourceKey, filePath, metaData);
 }
Beispiel #6
0
 public async Task PutAsync(string resourceKey, Stream stream, ResourceMetaData metaData = null)
 {
     await provider.PutAsync(resourceKey, stream, metaData);
 }
Beispiel #7
0
 public void Put(string resourceKey, string filePath, ResourceMetaData metaData = null)
 {
     provider.Put(resourceKey, filePath, metaData);
 }
Beispiel #8
0
 public void Put(string resourceKey, Stream stream, ResourceMetaData metaData = null)
 {
     provider.Put(resourceKey, stream, metaData);
 }