UsnJournalData.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.IO;
  3. using Y.FileQueryEngine.Win32.Structures;
  4. namespace Y.FileQueryEngine.UsnOperation
  5. {
  6. public class UsnJournalData
  7. {
  8. public DriveInfo Drive { get; private set; }
  9. public UInt64 UsnJournalID { get; private set; }
  10. public Int64 FirstUsn { get; private set; }
  11. public Int64 NextUsn { get; private set; }
  12. public Int64 LowestValidUsn { get; private set; }
  13. public Int64 MaxUsn { get; private set; }
  14. public UInt64 MaximumSize { get; private set; }
  15. public UInt64 AllocationDelta { get; private set; }
  16. public UsnJournalData(DriveInfo drive, USN_JOURNAL_DATA ntfsUsnJournalData)
  17. {
  18. this.Drive = drive;
  19. this.UsnJournalID = ntfsUsnJournalData.UsnJournalID;
  20. this.FirstUsn = ntfsUsnJournalData.FirstUsn;
  21. this.NextUsn = ntfsUsnJournalData.NextUsn;
  22. this.LowestValidUsn = ntfsUsnJournalData.LowestValidUsn;
  23. this.MaxUsn = ntfsUsnJournalData.MaxUsn;
  24. this.MaximumSize = ntfsUsnJournalData.MaximumSize;
  25. this.AllocationDelta = ntfsUsnJournalData.AllocationDelta;
  26. }
  27. // pesudo-code for checking valid USN journal
  28. //private bool IsUsnJournalValid()
  29. //{
  30. // bool isValid = true;
  31. // //
  32. // // is the JournalID from the previous state == JournalID from current state?
  33. // //
  34. // if (_previousUsnState.UsnJournalID == _currentUsnState.UsnJournalID)
  35. // {
  36. // //
  37. // // is the next usn to process still available
  38. // //
  39. // if (_previousUsnState.NextUsn > _currentUsnState.FirstUsn && _previousUsnState.NextUsn < _currentUsnState.NextUsn)
  40. // {
  41. // isValid = true;
  42. // }
  43. // else
  44. // {
  45. // isValid = false;
  46. // }
  47. // }
  48. // else
  49. // {
  50. // isValid = false;
  51. // }
  52. // return isValid;
  53. //}
  54. }
  55. }