41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace Mistox.Client {
|
|
|
|
public class MistoxServerClient {
|
|
|
|
public string ServerName { get; set; } = ""; // The Name of the server
|
|
public bool Alive { get; set; } = true; // Is the server running
|
|
public int Port { get; set; } = 9126; // What Port to bind on
|
|
|
|
|
|
public event Action onServerConnected;
|
|
public void InvokeOnServerConnected(){
|
|
Alive = true;
|
|
onServerConnected?.Invoke();
|
|
}
|
|
|
|
public event Action<UDPEndpoint> onUserConnected;
|
|
public void InvokeOnUserConnected(UDPEndpoint ConnectedUser){
|
|
onUserConnected?.Invoke(ConnectedUser);
|
|
}
|
|
|
|
public event Action<dynamic> onDataReceived;
|
|
public void InvokeOnReceived(dynamic DataPacket){
|
|
onDataReceived?.Invoke(DataPacket);
|
|
}
|
|
|
|
public event Action<UDPEndpoint> onUserDisconnected;
|
|
public void InvokeOnUserDisconnected(UDPEndpoint DisconnectedUser){
|
|
onUserDisconnected?.Invoke(DisconnectedUser);
|
|
}
|
|
|
|
public event Action onServerDisconnected;
|
|
public void InvokeOnServerDisconnected(){
|
|
Alive = false;
|
|
onServerDisconnected?.Invoke();
|
|
}
|
|
}
|
|
|
|
}
|