Beispiel #1
0
        public void CopyFile(string sourcePath, string targetPath, NameValueCollection metadata)
        {
            sourcePath = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, sourcePath).ToString();
            targetPath = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, targetPath).ToString();

            NameValueCollection meta = new NameValueCollection(metadata);

            meta.Add(HttpHeaders.CacheControl, _appConfig.CacheControl);
            meta.Add(HttpHeaders.ContentEncoding, _appConfig.ContentEncoding);
            if (_appConfig.Expires > 0)
            {
                meta.Add(HttpHeaders.Expires, DateTime.Now.AddSeconds(_appConfig.Expires).ToString());
            }
            _service.CopyFile(sourcePath, targetPath, metadata);
        }
Beispiel #2
0
 public void DeleteFile(string path)
 {
     path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString();
     _service.DeleteFile(path);
 }
Beispiel #3
0
 public Stream GetFileStream(string path)
 {
     path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString();
     return(_service.GetFileStream(path));
 }
Beispiel #4
0
 public string AddFile(string path, Stream data, NameValueCollection userMetadata)
 {
     //path = DfsHelper.ParseToDfsPath(path, _appConfig.BucketName);
     path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString();
     return(_service.AddFile(path, data, userMetadata));
 }
Beispiel #5
0
 public void DowloadFile(string filePath, string localFilePath)
 {
     filePath = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, filePath).ToString();
     _service.DowloadFile(filePath, localFilePath);
 }
Beispiel #6
0
 public bool DoesFileExist(string path)
 {
     path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString();
     return(_service.DoesFileExist(path));
 }
Beispiel #7
0
 public string GetHttpUrl(string path)
 {
     path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString();
     return(_service.GetHttpUrl(path));
 }
Beispiel #8
0
 /// <summary>
 /// 获取文件夹下的所有文件路径
 /// </summary>
 /// <param name="dirPath"></param>
 /// <returns></returns>
 public List <string> GetFiles(string dirPath)
 {
     dirPath = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, dirPath).ToString();
     return(_service.GetFiles(dirPath));
 }