当前位置: 首页>>代码示例>>C#>>正文


C# IFileSystem.DeleteDirectory方法代码示例

本文整理汇总了C#中IFileSystem.DeleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystem.DeleteDirectory方法的具体用法?C# IFileSystem.DeleteDirectory怎么用?C# IFileSystem.DeleteDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFileSystem的用法示例。


在下文中一共展示了IFileSystem.DeleteDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformDirectoryDeletionOperation

        /// <summary>
        /// Performs a directory deletion.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="directory">The directory to delete.</param>
        /// <param name="execute">if set to true, the operation gets executed.</param>
        private void PerformDirectoryDeletionOperation(IFileSystem fileSystem, IDirectoryInfo directory, bool execute)
        {
            var eventArgs = new DirectoryDeletionEventArgs(directory.FullName);

            this.OnDeletingDirectory(eventArgs);

            var directoryScanner = new FileSystemScanner(directory);

            directoryScanner.FileFound += (sender, e) =>
                this.OnProceededFile(new FileProceededEventArgs(e.File.FullName, e.File.Length));

            directoryScanner.Start();

            if (execute)
            {
                try
                {
                    fileSystem.DeleteDirectory(directory);

                    this.OnDeletedDirectory(eventArgs);
                }

                catch (AccessException)
                {
                    this.OnDirectoryDeletionError(new DirectoryDeletionEventArgs(directory.FullName));
                }
            }
        }
开发者ID:dineshkummarc,项目名称:FlagSync,代码行数:34,代码来源:Job.cs

示例2: Clean

        public void Clean(IFileSystem fileSystem, CleanMode mode)
        {
            if (mode == CleanMode.all || mode == CleanMode.packages)
            {
                var packagesFolder = PackagesFolder();
                Console.WriteLine("Deleting " + packagesFolder);
                fileSystem.DeleteDirectory(packagesFolder);
            }

            if (mode == CleanMode.all || mode == CleanMode.projects)
            {
                _projects.Each(p => p.Clean(fileSystem));
            }
        }
开发者ID:spascoe,项目名称:ripple,代码行数:14,代码来源:Solution.cs

示例3: DeleteTempTestDir

 private static string DeleteTempTestDir(IFileSystem fileSystem)
 {
     if (fileSystem.DirectoryExists(TestConstants.TempDirectory)) {
         fileSystem.DeleteDirectory(TestConstants.TempDirectory);
     }
     return TestConstants.TempDirectory;
 }
开发者ID:JMnITup,项目名称:PictureHandler,代码行数:7,代码来源:PictureDirectoryTests.cs

示例4: Close

 public static void Close(IFileSystem fileSystem) {
     var folder = GetTempCsvFilesFolder();
     if (fileSystem.DirectoryExists(folder)) {
         // Note: some files may still be locked if they are opened in Excel
         try {
             fileSystem.DeleteDirectory(folder, recursive: true);
         } catch (IOException) { } catch (UnauthorizedAccessException) { }
     }
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:9,代码来源:CsvAppFileIO.cs


注:本文中的IFileSystem.DeleteDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。