FileNameIndexLeafNode.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.IO;
  10. using System.Text;
  11. using Utilities;
  12. namespace DiskAccessLibrary.FileSystems.NTFS
  13. {
  14. public class FileNameIndexLeafNode
  15. {
  16. public List<FileNameIndexEntry> Entries = new List<FileNameIndexEntry>();
  17. public FileNameIndexLeafNode(byte[] buffer, int offset)
  18. {
  19. int position = offset;
  20. while (true)
  21. {
  22. FileNameIndexEntry entry = new FileNameIndexEntry(buffer, position);
  23. if (entry.IsLastEntry)
  24. {
  25. break;
  26. }
  27. Entries.Add(entry);
  28. position += entry.RecordLength;
  29. if (entry.RecordLength == 0)
  30. {
  31. throw new InvalidDataException("Invalid FileName index entry");
  32. }
  33. }
  34. }
  35. }
  36. }