Esempio n. 1
0
 public void Start()
 {
     if (IsRunning)
         return;
     Addons = new AddonsManager();
     Game = new Game(this);
     Addons.Init(Game);
     try
     {
         _listener = new TcpListener(IPAddress.Any, Config.GetInt("Port", DEFAULT_PORT));
         _listener.Start();
         IsRunning = true;
         IsListening = true;
         Game.Start();
     }
     catch (Exception)
     {
         //ignore
     }
 }
Esempio n. 2
0
 public void Start()
 {
     if (IsRunning)
     {
         return;
     }
     Addons = new AddonsManager();
     Game   = new Game(this);
     Addons.Init(Game);
     try
     {
         _listener = new TcpListener(IPAddress.Any, Config.GetInt("Port", DEFAULT_PORT));
         _listener.Start();
         IsRunning   = true;
         IsListening = true;
         Game.Start();
     }
     catch (Exception)
     {
         //ignore
     }
 }
Esempio n. 3
0
 public void Start()
 {
     if (IsRunning)
     {
         return;
     }
     Addons = new AddonsManager();
     Game   = new Game(this);
     Addons.Init(Game);
     try
     {
         int port = Config.GetInt("Port", DEFAULT_PORT);
         if (Config.GetBool("SRVProMode", false))
         {
             port = PortConfig.GetFirstAvailablePort();
         }
         if (port < 1)
         {
             throw new Exception("Port " + port + " is unavailable.");
         }
         if (Config.GetBool("SRVProMode", false))
         {
             Console.WriteLine(port);
         }
         _listener = new NetworkServer(IPAddress.Any, port);
         _listener.ClientConnected += Listener_ClientConnected;
         _listener.Start();
         IsRunning   = true;
         IsListening = true;
         Game.Start();
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex.ToString());
     }
 }