SetFileDispositionInfo.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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.Text;
  10. using Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. /// <summary>
  14. /// SMB_SET_FILE_DISPOSITION_INFO
  15. /// </summary>
  16. public class SetFileDispositionInfo : SetInformation
  17. {
  18. public const int Length = 1;
  19. /// <summary>
  20. /// Indicate that a file SHOULD be deleted when it is closed.
  21. /// </summary>
  22. public bool DeletePending;
  23. public SetFileDispositionInfo()
  24. {
  25. }
  26. public SetFileDispositionInfo(byte[] buffer) : this(buffer, 0)
  27. {
  28. }
  29. public SetFileDispositionInfo(byte[] buffer, int offset)
  30. {
  31. DeletePending = (ByteReader.ReadByte(buffer, ref offset) > 0);
  32. }
  33. public override byte[] GetBytes()
  34. {
  35. byte[] buffer = new byte[Length];
  36. ByteWriter.WriteByte(buffer, 0, Convert.ToByte(DeletePending));
  37. return buffer;
  38. }
  39. }
  40. }