示例#1
0
        void AddChannel(IPCReceiver receiver, IPCReader data, SyncHandler sync)
        {
            var serverId   = data.ReadByte();
            var channelId  = data.ReadByte();
            var type       = data.ReadInt32();
            var ip         = data.ReadUInt32();
            var port       = data.ReadInt16();
            var maxPlayers = data.ReadInt16();

            if (!sync.ServerExists(serverId))
            {
                sync.AddServer(serverId);
            }

            if (sync.ServerHasChannel(serverId, channelId))
            {
                return;
            }

            sync.AddServerChannel(serverId, channelId, new ChannelData(channelId, type, ip, port, maxPlayers, 0));
            receiver.SetServerInfo(serverId, channelId);

            if (!Configuration.serverDBs.ContainsKey(serverId))
            {
                Configuration.LoadMasterServer(serverId);

                Log.Message("Connecting to Database for Server " + serverId.ToString() + "...", Log.DefaultFG);
                var db = new DatabaseHandler(Configuration.serverDBTypes[serverId], Configuration.serverDBIPs[serverId], Configuration.serverDBs[serverId], Configuration.serverDBUsers[serverId], Configuration.serverDBPasses[serverId]);
                sync.AddServerDB(serverId, db);
            }
        }