public bool TryToCreateDirectory(IDirectoryInfoWrap directory) { if (directory.Exists) return false; directory.Create(); return true; }
public void TestInit() { _directoryInfoStub = MockRepository.GenerateStub<IDirectoryInfoWrap>(); _testURI = "http://testurl.com/Test_Image.png"; // Sample value. _testFileName = "Test_Image.png"; // Sample Value. _testDirectory = @"C:\Image Temp Folder"; // Sample Value. _webClient = new WebClient(_testURI, _testDirectory); }
public bool TryToCreateDirectory(IDirectoryInfoWrap directory) { if (directory.Exists) { return(false); } directory.Create(); return(true); }
public void UploadFiles(IDirectoryInfoWrap directoryInfo, bool recurse, string bucketName, bool setPublicRead) { var rootFolder = directoryInfo.FullName; var files = GetFilesInDirectory(directoryInfo, recurse); foreach (var file in files) { var key = NormalisePathForKey(file.FullName.Replace(rootFolder, string.Empty)); using (var fileStream = FileLoader(file.FullName)) { Upload(fileStream, bucketName, key, setPublicRead); fileStream.Close(); } } }
public void UploadFiles(IDirectoryInfoWrap directoryInfo, bool recurse, string bucketName, bool setPublicRead) { var rootFolder = directoryInfo.FullName; var files = GetFilesInDirectory(directoryInfo, recurse); foreach (var file in files) { var key = NormalisePathForKey(file.FullName.Replace(rootFolder, string.Empty)); using (var fileStream = FileLoader(file.FullName)) { Upload(fileStream, bucketName, key, setPublicRead); fileStream.Close(); } } }
private IEnumerable <IFileInfoWrap> GetFilesInDirectory(IDirectoryInfoWrap source, bool recurse) { if (!source.Exists) { return(Enumerable.Empty <IFileInfoWrap>()); } var files = source.GetFiles().ToList(); if (recurse) { IDirectoryInfoWrap[] dirs = source.GetDirectories(); foreach (IDirectoryInfoWrap dir in dirs) { files.AddRange(GetFilesInDirectory(dir, true)); } } return(files); }
public bool CheckIfDirectoryExists(IDirectoryInfoWrap directory) { return directory.Exists; }
public void GetParent_test() { IDirectoryInfoWrap di = _directoryWrap.GetParent(path); Assert.AreEqual("Debug", di.Name); }
public void StartTest() { _directoryWrap = new DirectoryWrap(); _directoryInfoWrap = _directoryWrap.CreateDirectory(path); Assert.IsTrue(_directoryInfoWrap.Exists, "Directory TempTest must be created."); }
public NativeDirectoryEntry(IDirectoryInfoWrap directoryInfo) { this.DirectoryInfo = directoryInfo; }
private IEnumerable<IFileInfoWrap> GetFilesInDirectory(IDirectoryInfoWrap source, bool recurse) { if (!source.Exists) { return Enumerable.Empty<IFileInfoWrap>(); } var files = source.GetFiles().ToList(); if (recurse) { IDirectoryInfoWrap[] dirs = source.GetDirectories(); foreach (IDirectoryInfoWrap dir in dirs) { files.AddRange(GetFilesInDirectory(dir, true)); } } return files; }
public void StartTest() { _directoryWrap = new DirectoryWrap(); _directoryInfoWrap = _directoryWrap.CreateDirectory(path); Assert.IsTrue(_directoryInfoWrap.Exists, "Directory TempTest must be created."); }