PocFolderScanByFileSystemEnumerable.cs 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.IO.Enumeration;
  2. using FSE = (bool isDir, string path, long size, System.DateTimeOffset lastWrited);
  3. namespace FNZCM2.ProofOfConcept;
  4. internal static class PocFolderScanByFileSystemEnumerable
  5. {
  6. public static void RunPoc()
  7. {
  8. var fse = new FileSystemEnumerable<FSE>(
  9. "library",
  10. (ref FileSystemEntry p) => new(
  11. p.IsDirectory,
  12. p.ToFullPath(),
  13. p.Length,
  14. p.LastWriteTimeUtc
  15. ),
  16. new()
  17. {
  18. RecurseSubdirectories = true,
  19. });
  20. var lst = new List<FSE>();
  21. foreach (var entry in fse)
  22. {
  23. if (entry.isDir) continue;
  24. lst.Add(entry);
  25. int bp = 0;
  26. // by file type
  27. // - read tags
  28. // - make cache model
  29. }
  30. var allSize = lst.Sum(p => p.size);
  31. var fmt = allSize.ToString("N0");
  32. //SUCCESS
  33. }
  34. }