AttributeDefinition.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright (C) 2018 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 Utilities;
  10. namespace DiskAccessLibrary.FileSystems.NTFS
  11. {
  12. public class AttributeDefinition : NTFSFile
  13. {
  14. private List<AttributeDefinitionEntry> m_list;
  15. public AttributeDefinition(NTFSVolume volume) : base(volume, MasterFileTable.AttrDefSegmentReference)
  16. {
  17. }
  18. public List<AttributeDefinitionEntry> ReadList()
  19. {
  20. ulong position = 0;
  21. List<AttributeDefinitionEntry> entries = new List<AttributeDefinitionEntry>();
  22. while (position < this.Data.Length)
  23. {
  24. byte[] entryBytes = this.ReadData(position, AttributeDefinitionEntry.Length);
  25. entries.Add(new AttributeDefinitionEntry(entryBytes, 0));
  26. position += AttributeDefinitionEntry.Length;
  27. }
  28. return entries;
  29. }
  30. public List<AttributeDefinitionEntry> List
  31. {
  32. get
  33. {
  34. if (m_list == null)
  35. {
  36. m_list = ReadList();
  37. }
  38. return m_list;
  39. }
  40. }
  41. }
  42. }