Example #1
0
        /// <summary>
        /// Creates a new server instance
        /// </summary>
        /// <param name="endpoint"></param>
        public Server(ServerConnection connection, int version, IPAddress address, string cdKey, GeoIP geoip, int heartbeatCode, bool enableStatLogging, XMPMS.Net.OperatingSystem operatingSystem, string locale, int matchId)
        {
            this.Connection        = connection;
            this.Local             = connection != null;
            this.Version           = version;
            this.Address           = address;
            this.CDKey             = cdKey;
            this.HeartbeatCode     = heartbeatCode;
            this.EnableStatLogging = enableStatLogging;
            this.OperatingSystem   = EnumInfo.Description(operatingSystem);
            this.Locale            = locale;
            this.matchId           = matchId;

            this.Name = "< Waiting gamestate... >";
            this.Port = 0;

            this.LastUpdate = DateTime.Now;
            this.Country    = geoip.Match(address).Country;

            this.queryClient = new UDPServerQueryClient();
            this.queryClient.QueryFinished += new UDPServerQueryResponseHandler(HandleQueryFinished);

            Properties = new Dictionary <string, string>();
            Properties.Add("servermode", "dedicated");

            Players = new List <Player>();
        }