Class GameClientManager
A class for managing various game clients.
Implements
Inherited Members
Namespace: Microsoft.Internal.Studios.Aruba.Infrastructure
Assembly: Aruba.Infrastructure.dll
Syntax
public class GameClientManager : BindableBase, INotifyPropertyChanged
Properties
View SourceAllDevices
Gets or sets the list of all devices.
Declaration
public List<IGameDevice> AllDevices { get; set; }
Property Value
Type | Description |
---|---|
List<IGameDevice> |
BugDevicesDictionary
Gets the dictionary containing the devices associated with each bug being created.
Declaration
public ConcurrentDictionary<Guid, IBugDevices> BugDevicesDictionary { get; }
Property Value
Type | Description |
---|---|
ConcurrentDictionary<Guid, IBugDevices> |
GameClients
Gets the GameClients (TitleName, {GameClientConnectionContext, GameClient})
Declaration
public ConcurrentDictionary<string, Dictionary<GameClientConnectionContext, IGameClient>> GameClients { get; }
Property Value
Type | Description |
---|---|
ConcurrentDictionary<string, Dictionary<GameClientConnectionContext, IGameClient>> |
Instance
Gets the single static instance of the class.
Declaration
public static GameClientManager Instance { get; }
Property Value
Type | Description |
---|---|
GameClientManager |
SelectedDevices
Gets or sets the list of selected devices.
Declaration
public List<IGameDevice> SelectedDevices { get; set; }
Property Value
Type | Description |
---|---|
List<IGameDevice> |
Methods
View SourceAddBugDevices(Guid, IBugDevices)
Updates the devices associated with a bug.
Declaration
public void AddBugDevices(Guid bugId, IBugDevices bugDevices)
Parameters
Type | Name | Description |
---|---|---|
Guid | bugId | The id of the bug to update. |
IBugDevices | bugDevices | The devices associated with the bug. |
AttemptDisposeClientAsync(IGameClient)
Attempts to dispose of a client asynchronously if IAsyncDisposable is implemented. Otherwise disposes synchronously if IDisposable is implemented.
Declaration
public static Task AttemptDisposeClientAsync(IGameClient client)
Parameters
Type | Name | Description |
---|---|---|
IGameClient | client | The client to dispose of. |
Returns
Type | Description |
---|---|
Task | A Task that represents the asynchronous operation. |
CleanupGameClientConnections()
Calls the dispose method on all game clients
Declaration
public void CleanupGameClientConnections()
GetConnectedClientAsync(string, IGameDevice, CancellationToken)
Gets the connected client for the given title and IP address.
Declaration
public Task<IGameClient> GetConnectedClientAsync(string titleName, IGameDevice device, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The game title. |
IGameDevice | device | The device the game client is connected to. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<IGameClient> | A connected game client. |
GetConnectedGameClientsAsync(string, bool, CancellationToken)
Gets the connected game clients for the currently selected devices.
Declaration
public Task<List<IGameClient>> GetConnectedGameClientsAsync(string titleName, bool includeDisconnectedClientsAsNull, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The game title. |
bool | includeDisconnectedClientsAsNull | Whether to include disconnected clients in the return value as null. |
CancellationToken | cancellationToken | A cancellation token. |
Returns
Type | Description |
---|---|
Task<List<IGameClient>> | A list of game clients. |
GetConnectedGameClientsAsync(string, List<IGameDevice>, bool, CancellationToken)
Gets the connected clients for the given title and IP addresses.
Declaration
public Task<List<IGameClient>> GetConnectedGameClientsAsync(string titleName, List<IGameDevice> devices, bool includeDisconnectedClientsAsNull, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The game title. |
List<IGameDevice> | devices | The devices the game client is connected to. |
bool | includeDisconnectedClientsAsNull | Whether to include disconnected clients in the return value as null. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<List<IGameClient>> | A list of connected game clients. |
GetConnectedGameClientsAsync(string, Guid, bool, CancellationToken)
Gets the connected game clients for the currently selected devices.
Declaration
public Task<List<IGameClient>> GetConnectedGameClientsAsync(string titleName, Guid bugId, bool includeDisconnectedClientsAsNull, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The game title. |
Guid | bugId | The id associated with a bug. |
bool | includeDisconnectedClientsAsNull | Whether to include disconnected clients in the return value as null. |
CancellationToken | cancellationToken | A cancellation token. |
Returns
Type | Description |
---|---|
Task<List<IGameClient>> | A list of game clients. |
RegisterGameClientConnection(string, Func<GameClientConnectionContext, CancellationToken, Task<IGameClient>>)
Registers a game client for a title by providing a connection function.
Declaration
public void RegisterGameClientConnection(string titleName, Func<GameClientConnectionContext, CancellationToken, Task<IGameClient>> connectionFunction)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The title this client is for. |
Func<GameClientConnectionContext, CancellationToken, Task<IGameClient>> | connectionFunction | The connection function to create and connect to a game client. |
SubscribeToEvents()
Subscribes to events in order to keep bug data up to date using the stored event aggregator.
Declaration
public void SubscribeToEvents()
SubscribeToEvents(IEventAggregator)
Subscribes to events in order to keep bug data up to date.
Declaration
public void SubscribeToEvents(IEventAggregator eventAggregator)
Parameters
Type | Name | Description |
---|---|---|
IEventAggregator | eventAggregator | The event aggregator to use. |
UnregisterGameClientConnectionAsync(string)
Unregister game client connections for the given title.
Declaration
public Task UnregisterGameClientConnectionAsync(string titleName)
Parameters
Type | Name | Description |
---|---|---|
string | titleName | The title to unregister. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
UnsubscribeFromEvents()
Un-subscribes from events using the stored event aggregator.
Declaration
public void UnsubscribeFromEvents()
UnsubscribeFromEvents(IEventAggregator?)
Un-subscribes from events using the provided event aggregator.
Declaration
public void UnsubscribeFromEvents(IEventAggregator? eventAggregator)
Parameters
Type | Name | Description |
---|---|---|
IEventAggregator | eventAggregator | The event aggregator to use. |