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); }
public void DeleteFile(string path) { path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString(); _service.DeleteFile(path); }
public Stream GetFileStream(string path) { path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString(); return(_service.GetFileStream(path)); }
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)); }
public void DowloadFile(string filePath, string localFilePath) { filePath = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, filePath).ToString(); _service.DowloadFile(filePath, localFilePath); }
public bool DoesFileExist(string path) { path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString(); return(_service.DoesFileExist(path)); }
public string GetHttpUrl(string path) { path = new DfsPath(_appConfig.ApplicationName, _appConfig.BucketName, path).ToString(); return(_service.GetHttpUrl(path)); }
/// <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)); }