AvailableNetworkSession.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Net;
  4. using System.Threading.Tasks;
  5. namespace Microsoft.Xna.Framework.Net
  6. {
  7. /// <summary>
  8. /// Represents an available network session that can be joined.
  9. /// </summary>
  10. public class AvailableNetworkSession
  11. {
  12. public AvailableNetworkSession(
  13. string sessionName,
  14. string hostGamertag,
  15. int currentGamerCount,
  16. int openPublicGamerSlots,
  17. int openPrivateGamerSlots,
  18. NetworkSessionType sessionType,
  19. IDictionary<string, object> sessionProperties,
  20. string sessionId,
  21. IPEndPoint hostEndpoint = null)
  22. {
  23. SessionName = sessionName;
  24. HostGamertag = hostGamertag;
  25. CurrentGamerCount = currentGamerCount;
  26. OpenPublicGamerSlots = openPublicGamerSlots;
  27. OpenPrivateGamerSlots = openPrivateGamerSlots;
  28. SessionType = sessionType;
  29. SessionProperties = new Dictionary<string, object>(sessionProperties);
  30. SessionId = sessionId;
  31. HostEndpoint = hostEndpoint;
  32. }
  33. /// <summary>
  34. /// Gets the unique session ID.
  35. /// </summary>
  36. public string SessionId { get; }
  37. /// <summary>
  38. /// Gets the name of the session.
  39. /// </summary>
  40. public string SessionName { get; }
  41. /// <summary>
  42. /// Gets the gamertag of the host.
  43. /// </summary>
  44. public string HostGamertag { get; }
  45. /// <summary>
  46. /// Gets the current number of gamers in the session.
  47. /// </summary>
  48. public int CurrentGamerCount { get; }
  49. /// <summary>
  50. /// Gets the number of open public gamer slots.
  51. /// </summary>
  52. public int OpenPublicGamerSlots { get; }
  53. /// <summary>
  54. /// Gets the number of open private gamer slots.
  55. /// </summary>
  56. public int OpenPrivateGamerSlots { get; }
  57. /// <summary>
  58. /// Gets the type of the session.
  59. /// </summary>
  60. public NetworkSessionType SessionType { get; }
  61. /// <summary>
  62. /// Gets the session properties.
  63. /// </summary>
  64. public IDictionary<string, object> SessionProperties { get; }
  65. /// <summary>
  66. /// Gets the quality of service information.
  67. /// </summary>
  68. public QualityOfService QualityOfService { get; internal set; } = new QualityOfService();
  69. /// <summary>
  70. /// Gets the host's network endpoint for SystemLink (LAN) sessions.
  71. /// </summary>
  72. public IPEndPoint HostEndpoint { get; }
  73. }
  74. }