ClientManager.cs 870 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using OpenSim.Framework.Interfaces;
  5. namespace OpenSim.Framework
  6. {
  7. public delegate void ForEachClientDelegate( IClientAPI client );
  8. public class ClientManager
  9. {
  10. private Dictionary<uint, IClientAPI> m_clients;
  11. public void ForEachClient(ForEachClientDelegate whatToDo)
  12. {
  13. foreach (IClientAPI client in m_clients.Values)
  14. {
  15. whatToDo(client);
  16. }
  17. }
  18. public ClientManager()
  19. {
  20. m_clients = new Dictionary<uint, IClientAPI>();
  21. }
  22. public void Remove(uint id)
  23. {
  24. m_clients.Remove(id);
  25. }
  26. public void Add(uint id, IClientAPI client )
  27. {
  28. m_clients.Add( id, client );
  29. }
  30. }
  31. }