public override IEnumerable <DirectoryInfoBase> EnumerateDirectories() { return(instance.EnumerateDirectories().Select(directoryInfo => new DirectoryInfoWrapper(FileSystem, directoryInfo))); }
private void AlphaFS_Directory_Copy_ExistingDirectory_UsingGlobalRootAsSourcePath(bool isNetwork) { var testOk = false; using (var tempRoot = new TemporaryDirectory(isNetwork)) { var folder = tempRoot.CreateDirectoryRandomizedAttributes(); var dosDevices = Alphaleonis.Win32.Filesystem.Volume.QueryAllDosDevices().Where(device => device.StartsWith("HarddiskVolumeShadowCopy", StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (var dosDevice in dosDevices) { if (testOk) { break; } var shadowSource = Alphaleonis.Win32.Filesystem.Path.GlobalRootDevicePrefix + dosDevice; var sourceFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); var drive = System.IO.Directory.GetDirectoryRoot(sourceFolder).TrimEnd('\\'); var globalRoot = sourceFolder.Replace(drive, shadowSource); var dirInfo = new Alphaleonis.Win32.Filesystem.DirectoryInfo(globalRoot); Console.WriteLine("Input GlobalRoot Path: [{0}]\n", dirInfo.FullName); if (!dirInfo.Exists) { UnitTestAssert.InconclusiveBecauseFileNotFound("No volume shadow copy found."); } var enumOptions = Alphaleonis.Win32.Filesystem.DirectoryEnumerationOptions.Recursive | Alphaleonis.Win32.Filesystem.DirectoryEnumerationOptions.SkipReparsePoints; var copyOptions = Alphaleonis.Win32.Filesystem.CopyOptions.None; var copyCount = 0; foreach (var fsi in dirInfo.EnumerateDirectories(enumOptions)) { if (copyCount == 3) { break; } // Copy all folders from "\Program Files". var folderCopy = System.IO.Path.Combine(folder.FullName, System.IO.Path.GetFileName(fsi.FullName)); Console.WriteLine("Copy directory #{0}.", copyCount + 1); var cmr = Alphaleonis.Win32.Filesystem.Directory.Copy(fsi.FullName, folderCopy, copyOptions); UnitTestConstants.Dump(cmr); Console.WriteLine(); Assert.AreEqual(0, cmr.ErrorCode); testOk = true; copyCount++; } } } Console.WriteLine(); Assert.IsTrue(testOk); }