public Task <bool> SaveFileAsync(string path, Stream stream, CancellationToken cancellationToken = new CancellationToken())
        {
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(UnscopedStorage.SaveFileAsync(String.Concat(_pathPrefix, path), stream, cancellationToken));
        }
示例#2
0
        public Task <bool> ExistsAsync(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(UnscopedStorage.ExistsAsync(String.Concat(_pathPrefix, path)));
        }
示例#3
0
        public Task <Stream> GetFileStreamAsync(string path, CancellationToken cancellationToken = default)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(UnscopedStorage.GetFileStreamAsync(String.Concat(_pathPrefix, path), cancellationToken));
        }
示例#4
0
        public async Task <FileSpec> GetFileInfoAsync(string path)
        {
            var file = await UnscopedStorage.GetFileInfoAsync(String.Concat(_pathPrefix, path)).AnyContext();

            if (file != null)
            {
                file.Path = file.Path.Substring(_pathPrefix.Length);
            }

            return(file);
        }
示例#5
0
        public Task <bool> CopyFileAsync(string path, string targetPath, CancellationToken cancellationToken = default)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (String.IsNullOrEmpty(targetPath))
            {
                throw new ArgumentNullException(nameof(targetPath));
            }

            return(UnscopedStorage.CopyFileAsync(String.Concat(_pathPrefix, path), String.Concat(_pathPrefix, targetPath), cancellationToken));
        }
示例#6
0
        public Task <bool> SaveFileAsync(string path, Stream stream, CancellationToken cancellationToken = default)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            return(UnscopedStorage.SaveFileAsync(String.Concat(_pathPrefix, path), stream, cancellationToken));
        }
示例#7
0
        public async Task <FileSpec> GetFileInfoAsync(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            var file = await UnscopedStorage.GetFileInfoAsync(String.Concat(_pathPrefix, path)).AnyContext();

            if (file != null)
            {
                file.Path = file.Path.Substring(_pathPrefix.Length);
            }

            return(file);
        }
示例#8
0
        public async Task <PagedFileListResult> GetPagedFileListAsync(int pageSize = 100, string searchPattern = null, CancellationToken cancellationToken = default)
        {
            if (pageSize <= 0)
            {
                return(PagedFileListResult.Empty);
            }

            var unscopedResult = await UnscopedStorage.GetPagedFileListAsync(pageSize, String.Concat(_pathPrefix, searchPattern), cancellationToken).AnyContext();

            foreach (var file in unscopedResult.Files)
            {
                file.Path = file.Path.Substring(_pathPrefix.Length);
            }

            return(new PagedFileListResult(unscopedResult.Files, unscopedResult.HasMore, () => NextPage(unscopedResult)));
        }
示例#9
0
        public async Task <IEnumerable <FileSpec> > GetFileListAsync(string searchPattern = null, int?limit = null, int?skip = null, CancellationToken cancellationToken = new CancellationToken())
        {
            if (String.IsNullOrEmpty(searchPattern))
            {
                searchPattern = "*";
            }

            var files = (await UnscopedStorage.GetFileListAsync(String.Concat(_pathPrefix, searchPattern), limit, skip, cancellationToken).AnyContext()).ToList();

            foreach (var file in files)
            {
                file.Path = file.Path.Substring(_pathPrefix.Length);
            }

            return(files);
        }
示例#10
0
 public Task <int> DeleteFilesAsync(string searchPattern = null, CancellationToken cancellation = default)
 {
     return(UnscopedStorage.DeleteFilesAsync(String.Concat(_pathPrefix, searchPattern), cancellation));
 }
示例#11
0
 public Task <bool> CopyFileAsync(string path, string targetpath, CancellationToken cancellationToken = new CancellationToken())
 {
     return(UnscopedStorage.CopyFileAsync(String.Concat(_pathPrefix, path), String.Concat(_pathPrefix, targetpath), cancellationToken));
 }
示例#12
0
 public Task <bool> SaveFileAsync(string path, Stream stream, CancellationToken cancellationToken = new CancellationToken())
 {
     return(UnscopedStorage.SaveFileAsync(String.Concat(_pathPrefix, path), stream, cancellationToken));
 }
示例#13
0
 public Task <bool> ExistsAsync(string path)
 {
     return(UnscopedStorage.ExistsAsync(String.Concat(_pathPrefix, path)));
 }
示例#14
0
 public Task <Stream> GetFileStreamAsync(string path, CancellationToken cancellationToken = new CancellationToken())
 {
     return(UnscopedStorage.GetFileStreamAsync(String.Concat(_pathPrefix, path), cancellationToken));
 }
示例#15
0
 public Task <int> DeleteFilesAsync(string searchPattern = null, CancellationToken cancellation = default)
 {
     searchPattern = !String.IsNullOrEmpty(searchPattern) ? String.Concat(_pathPrefix, searchPattern) : String.Concat(_pathPrefix, "*");
     return(UnscopedStorage.DeleteFilesAsync(searchPattern, cancellation));
 }
示例#16
0
 public Task <bool> DeleteFileAsync(string path, CancellationToken cancellationToken = new CancellationToken())
 {
     return(UnscopedStorage.DeleteFileAsync(String.Concat(_pathPrefix, path), cancellationToken));
 }
示例#17
0
 public void Dispose()
 {
     UnscopedStorage?.Dispose();
 }