Ejemplo n.º 1
0
 public ViewModel()
 {
     server = new CCC_Server();
     Clients = new ObservableCollection<string>();
     Port = 0;
     LocalAddress = IPUtils.GetLocalAddress(); ;
     PublicAddress = IPUtils.GetPublicAddress();
     startCommand = new RelayCommand(OnStartExecuted, OnStartCanExecute);
     stopCommand = new RelayCommand(OnStopExecuted, OnStopCanExecute);
 }
Ejemplo n.º 2
0
        public async Task <IPEndPoint> GetPublicIPAddress()
        {
            var configAddress = configuration.GetValue <string>("Realtime:PublicIPAddress");
            var configPort    = configuration.GetValue <int>("EnetServer:Port");

            if (string.IsNullOrEmpty(configAddress))
            {
                var discoveredAddress = await ipUtils.GetPublicAddress();

                return(new IPEndPoint(discoveredAddress, configPort));
            }

            return(new IPEndPoint(IPAddress.Parse(configAddress), configPort));
        }
Ejemplo n.º 3
0
        public ViewModel()
        {
            server        = new CCC_Server();
            Clients       = new ObservableCollection <PlayerData>();
            Port          = 63000;
            LocalAddress  = IPUtils.GetLocalAddress();
            PublicAddress = IPUtils.GetPublicAddress();
            Running       = false;
            LastSync      = DateTime.MinValue;
            startCommand  = new RelayCommand(OnStartExecuted, OnStartCanExecute);
            stopCommand   = new RelayCommand(OnStopExecuted, OnStopCanExecute);

            server.PlayerConnected    += OnClientConnect;
            server.PlayerDisconnected += OnClientDisconnect;
            server.PlayerMoved        += OnPlayerMove;
            server.PlayerCrouch       += OnPlayerCrouch;
            server.Sync += Server_Sync;
        }