SetInformation.cs 1.6 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.Text;
  10. using Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. public abstract class SetInformation
  14. {
  15. public abstract byte[] GetBytes();
  16. public static SetInformation GetSetInformation(byte[] buffer, SetInformationLevel informationLevel)
  17. {
  18. switch (informationLevel)
  19. {
  20. case SetInformationLevel.SMB_INFO_STANDARD:
  21. return new SetInfoStandard(buffer);
  22. case SetInformationLevel.SMB_INFO_SET_EAS:
  23. return new SetExtendedAttributes(buffer);
  24. case SetInformationLevel.SMB_SET_FILE_BASIC_INFO:
  25. return new SetFileBasicInfo(buffer);
  26. case SetInformationLevel.SMB_SET_FILE_DISPOSITION_INFO:
  27. return new SetFileDispositionInfo(buffer);
  28. case SetInformationLevel.SMB_SET_FILE_ALLOCATION_INFO:
  29. return new SetFileAllocationInfo(buffer);
  30. case SetInformationLevel.SMB_SET_FILE_END_OF_FILE_INFO:
  31. return new SetFileEndOfFileInfo(buffer);
  32. default:
  33. throw new UnsupportedInformationLevelException();
  34. }
  35. }
  36. }
  37. }