Delete() публичный абстрактный Метод

public abstract Delete ( bool recursive ) : void
recursive bool
Результат void
Пример #1
0
        private void SmartDirectoryDelete(DirectoryInfoBase directory, string rootPath, string targetSubFolder)
        {
            if (IgnorePath(directory))
            {
                return;
            }

            string previousDirectoryPath = FileSystemHelpers.GetRelativePath(rootPath, directory.FullName);
            if (!DoesPathExistsInManifest(previousDirectoryPath, targetSubFolder))
            {
                return;
            }

            var files = FileSystemHelpers.GetFiles(directory);
            var subDirectories = FileSystemHelpers.GetDirectories(directory);

            foreach (var file in files.Values)
            {
                string previousFilePath = FileSystemHelpers.GetRelativePath(rootPath, file.FullName);
                if (DoesPathExistsInManifest(previousFilePath, targetSubFolder))
                {
                    _logger.Log("Deleting file: '{0}'", previousFilePath);
                    var inclosuresafe = file;
                    OperationManager.Attempt(() => inclosuresafe.Delete());
                }
            }

            foreach (var subDirectory in subDirectories.Values)
            {
                SmartDirectoryDelete(subDirectory, rootPath, targetSubFolder);
            }

            if (directory.IsEmpty())
            {
                _logger.Log("Deleting directory: '{0}'", previousDirectoryPath);
                OperationManager.Attempt(() => directory.Delete());
            }
        }