System.IO.DirectoryInfo.Delete C# (CSharp) Méthode

Delete() private méthode

private Delete ( ) : void
Résultat void
        public override void Delete()
        {
            FileSystem.Current.RemoveDirectory(FullPath, false);
        }

Same methods

DirectoryInfo::Delete ( bool recursive ) : void

Usage Example

        public void ImportSettings(BuildType buildType)
        {
            using (new WurmAssistantGateway(AppContext.WaGatewayErrorMessage))
            {
                using (var tempDirMan = new TempDirManager())
                {
                    var tempDir = tempDirMan.GetHandle();
                    var dataDir = new DirectoryInfo(DataDirPath);

                    var tempBackupDir = new DirectoryInfo(Path.Combine(tempDir.FullName, dataDir.Name));
                    DirectoryEx.DirectoryCopyRecursive(dataDir.FullName, tempBackupDir.FullName);

                    try
                    {
                        dataDir.Delete(true);
                        var otherBuildDirPath = AppContext.GetDataDir(buildType);
                        DirectoryEx.DirectoryCopyRecursive(otherBuildDirPath, dataDir.FullName);
                    }
                    catch (Exception)
                    {
                        TransientHelper.Compensate(() => dataDir.Delete(true),
                            retryDelay: TimeSpan.FromSeconds(5));
                        TransientHelper.Compensate(() => DirectoryEx.DirectoryCopyRecursive(tempBackupDir.FullName, dataDir.FullName),
                            retryDelay: TimeSpan.FromSeconds(5));
                        throw;
                    }
                }
            }
        }
All Usage Examples Of System.IO.DirectoryInfo::Delete