Esempio n. 1
0
    public void Dispose()
    {
        foreach (var item in _dir.EnumerateFiles(recursive: true))
        {
            var info      = new FileInfo(item.Path);
            var cleanTime = _clean switch
            {
                CleanType.AccessTime => info.LastAccessTime,
                CleanType.WriteTime => info.LastWriteTime,
                CleanType.CreationTime => info.CreationTime,
                _ => throw new NotImplementedException(),
            };
            if (info.LastAccessTime < _startTime)
            {
                item.Delete();
            }
        }

        foreach (var item in _dir
                 .EnumerateDirectories(recursive: true, includeSelf: true)
                 .Reverse())
        {
            if (item.Empty)
            {
                item.DeleteEntireFolder();
            }
        }
    }
Esempio n. 2
0
 public static void ListAllPackageVersions(DirectoryPath packageDirectoryPath, TextWriter writer)
 {
     foreach (var versionDirectoryPath in packageDirectoryPath.EnumerateDirectories())
     {
         LocalDirectoryNugetRepository.ListPackageVersionInformation(versionDirectoryPath, writer);
     }
 }