/// <summary> /// Delete a directory. /// <seealso cref="Delete(System.String)"/> /// </summary> /// <param name="path"> /// Path tto the directory to delete. /// </param> /// <param name="recursive"> /// Whether to remove all contained files and directories. /// If the parameter is <see langword="false"/> the method is the same /// as <see cref="Delete(System.String)"/>. /// </param> public void Delete(string path, bool recursive) { WinLongFileFrovider fileProvider = new WinLongFileFrovider(); if (recursive) { IEnumerable <string> filePaths = EnumerateFiles(path); foreach (string filePath in filePaths) { fileProvider.Delete(filePath); } IEnumerable <string> subFolderPaths = EnumerateDirectories(path); foreach (string subFolderPath in subFolderPaths) { Delete(subFolderPath, recursive); } } Delete(path); }
public WinLongFileSystemProvider() { FileProvider = new WinLongFileFrovider(); DirectoryProvider = new WinLongDirectoryProvider(); SupportsTransactions = Util.SystemInfo.IsAnyWindows && Environment.OSVersion.Version.Major > 5; }