Example #1
0
        /// <summary>
        /// Copies a file in the storage provider.
        /// </summary>
        /// <param name="originalPath">The relative path to the file to be copied.</param>
        /// <param name="duplicatePath">The relative path to the new file.</param>
        public void CopyFile(string currentPath, string filename, string duplicatePath, string duplicateFilename)
        {
            Argument.ThrowIfNullOrEmpty(currentPath, "currentPath");
            Argument.ThrowIfNullOrEmpty(duplicatePath, "duplicatePath");
            Argument.ThrowIfNullOrEmpty(filename, "filename");
            Argument.ThrowIfNullOrEmpty(duplicateFilename, "duplicateFilename");

            _storageProvider.CopyFile(_storageProvider.Combine(currentPath, filename), _storageProvider.Combine(duplicatePath, duplicateFilename));
        }
Example #2
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);
        }
Example #3
0
 public string CopyFile(string fromPath, string toPath)
 {
     return(_storage.CopyFile(fromPath, toPath));
 }