NamedPipeShare.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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 SMBLibrary.RPC;
  11. using SMBLibrary.Services;
  12. namespace SMBLibrary.Server
  13. {
  14. public class NamedPipeShare : List<RemoteService>
  15. {
  16. public NamedPipeShare(List<string> shareList)
  17. {
  18. this.Add(new ServerService(Environment.MachineName, shareList));
  19. this.Add(new WorkstationService(Environment.MachineName, Environment.MachineName));
  20. }
  21. public RemoteService GetService(string path)
  22. {
  23. foreach (RemoteService service in this)
  24. {
  25. if (String.Equals(path, service.PipeName, StringComparison.InvariantCultureIgnoreCase))
  26. {
  27. return service;
  28. }
  29. }
  30. return null;
  31. }
  32. }
  33. }