Esempio n. 1
0
 /// <summary>
 /// Disconnects this peer
 /// </summary>
 /// <param name="reason">Disconnection reason</param>
 public override void Disconnect(EDisconnectionReason reason)
 {
     try
     {
         Peer.Disconnect((uint)reason);
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e);
     }
 }
 /// <summary>
 /// Constructs a message informing about an useer leaving the lobby
 /// </summary>
 /// <param name="user">User</param>
 /// <param name="reason">Reason</param>
 /// <param name="message">Message</param>
 public UserLeftMessageData(IUser user, EDisconnectionReason reason, string message) : base(Naming.GetMessageTypeNameFromMessageDataType <UserLeftMessageData>())
 {
     if (user == null)
     {
         throw new ArgumentNullException(nameof(user));
     }
     if (!user.IsValid)
     {
         throw new ArgumentException("User is not valid.", nameof(user));
     }
     if (reason == EDisconnectionReason.Invalid)
     {
         throw new ArgumentException("Reason can't be invalid.", nameof(reason));
     }
     GUID    = user.GUID;
     Reason  = reason;
     Message = message ?? throw new ArgumentNullException(nameof(message));
 }
Esempio n. 3
0
 /// <summary>
 /// Disconnects an user
 /// </summary>
 /// <param name="reason">Reason</param>
 public void Disconnect(EDisconnectionReason reason) => Peer.Disconnect(reason);
Esempio n. 4
0
 /// <summary>
 /// Disconnects this user
 /// </summary>
 /// <param name="reason">Disconnection reason</param>
 public virtual void Disconnect(EDisconnectionReason reason) => ServerUser.Disconnect(reason);
Esempio n. 5
0
 /// <summary>
 /// Closes the connection to peer
 /// </summary>
 /// <param name="reason">Disconnection reason</param>
 public abstract void Disconnect(EDisconnectionReason reason);
Esempio n. 6
0
 /// <summary>
 /// Disconnects peer
 /// </summary>
 /// <param name="reason">Reason</param>
 public override void Disconnect(EDisconnectionReason reason) => InternalOwningConnector.DisconnectPeer(this);
Esempio n. 7
0
 /// <summary>
 /// Closes connection to all peers
 /// </summary>
 /// <param name="reason">Disconnection reason</param>
 public override void Close(EDisconnectionReason reason)
 {
     base.Close(reason);
     isConnectorThreadRunning = false;
     connectorThread.Join();
 }