Skip to content

Commit

Permalink
Add GetUser to INetServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe GOMES PEIXOTO committed Mar 16, 2018
1 parent 630c638 commit 3406b10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Ether.Network/Server/INetServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,12 @@ public interface INetServer : IDisposable
/// </summary>
/// <param name="packet">Packet to send.</param>
void SendToAll(INetPacketStream packet);

/// <summary>
/// Gets the user by his Id.
/// </summary>
/// <param name="id">User Id</param>
/// <returns>User</returns>
INetUser GetUser(Guid id);
}
}
3 changes: 3 additions & 0 deletions src/Ether.Network/Server/NetServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public void SendTo(IEnumerable<INetUser> users, INetPacketStream packet)
/// <inheritdoc />
public void SendToAll(INetPacketStream packet) => this.SendTo(this.Clients, packet);

/// <inheritdoc />
public INetUser GetUser(Guid id) => this._clients.ContainsKey(id) ? this._clients[id] : null;

/// <summary>
/// Initialize the server resourrces.
/// </summary>
Expand Down

0 comments on commit 3406b10

Please sign in to comment.