ServiceNameHelper.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 class ServiceNameHelper
  14. {
  15. public static string GetServiceString(ServiceName serviceName)
  16. {
  17. switch (serviceName)
  18. {
  19. case ServiceName.DiskShare:
  20. return "A:";
  21. case ServiceName.PrinterShare:
  22. return "LPT1:";
  23. case ServiceName.NamedPipe:
  24. return "IPC";
  25. case ServiceName.SerialCommunicationsDevice:
  26. return "COMM";
  27. default:
  28. return "?????";
  29. }
  30. }
  31. public static ServiceName GetServiceName(string serviceString)
  32. {
  33. switch (serviceString)
  34. {
  35. case "A:":
  36. return ServiceName.DiskShare;
  37. case "LPT1:":
  38. return ServiceName.PrinterShare;
  39. case "IPC":
  40. return ServiceName.NamedPipe;
  41. case "COMM":
  42. return ServiceName.SerialCommunicationsDevice;
  43. default:
  44. return ServiceName.AnyType;
  45. }
  46. }
  47. }
  48. }