Exemple #1
0
        public void Move(FilePath destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (destination.IsRelative)
            {
                throw new ArgumentException("Destination must be absolute", nameof(destination));
            }

            LocalFileProvider.Retry(() => _file.MoveTo(destination.FullPath));
        }
Exemple #2
0
        public void Copy(FilePath destination, bool overwrite)
        {
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (destination.IsRelative)
            {
                throw new ArgumentException("Destination must be absolute", nameof(destination));
            }

            LocalFileProvider.Retry(() => _file.CopyTo(destination.FullPath, overwrite));
        }
Exemple #3
0
 public IEnumerable <IFile> GetFiles(SearchOption searchOption = SearchOption.TopDirectoryOnly) =>
 LocalFileProvider.Retry(() => _directory.GetFiles("*", searchOption).Select(file => new LocalFile(file.FullName)));
Exemple #4
0
 public IEnumerable <IDirectory> GetDirectories(SearchOption searchOption = SearchOption.TopDirectoryOnly) =>
 LocalFileProvider.Retry(() => _directory.GetDirectories("*", searchOption).Select(directory => new LocalDirectory(directory.FullName)));
Exemple #5
0
 public void Delete(bool recursive) => LocalFileProvider.Retry(() => _directory.Delete(recursive));
Exemple #6
0
 public void Create() => LocalFileProvider.Retry(() => _directory.Create());
Exemple #7
0
 public Stream Open(FileMode fileMode, FileAccess fileAccess, FileShare fileShare) =>
 LocalFileProvider.Retry(() => _file.Open(fileMode, fileAccess, fileShare));
Exemple #8
0
 public Stream OpenWrite() =>
 LocalFileProvider.Retry(() => _file.OpenWrite());
Exemple #9
0
 public Stream OpenRead() =>
 LocalFileProvider.Retry(() => _file.OpenRead());
Exemple #10
0
 public string ReadAllText() =>
 LocalFileProvider.Retry(() => File.ReadAllText(_file.FullName));
Exemple #11
0
 public void Delete() => LocalFileProvider.Retry(() => _file.Delete());