IPCClientFactory.cs 568 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace InABox.Client.IPC
  7. {
  8. public static class IPCClientFactory
  9. {
  10. private static Dictionary<string, IPCClient> Clients = new();
  11. public static IPCClient GetClient(string pipeName)
  12. {
  13. if (!Clients.TryGetValue(pipeName, out var client))
  14. {
  15. client = new IPCClient(pipeName);
  16. Clients[pipeName] = client;
  17. }
  18. return client;
  19. }
  20. }
  21. }