Example #1
0
        /// <summary>
        /// Updates our zonelist screen with required info
        /// </summary>
        /// <param name="msg">Incoming message</param>
        public void UpdateList(Lidgren.Network.NetIncomingMessage msg)
        {
            if (Zones.Count > 0)
            {
                foreach (string zname in Zones.Keys)
                {
                    oldZones.Add(zname);
                }
            }
            Zones.Clear();

            int count = msg.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                ZoneSettings _zone = new ZoneSettings();
                _zone.ID          = msg.ReadInt64();
                _zone.Name        = msg.ReadString();
                _zone.Description = msg.ReadString();
                _zone.Address     = msg.ReadIPEndPoint();

                //Add it to our dictionary
                Zones.Add(_zone.Name, _zone);

                //Remove it from our old list
                if (oldZones.Contains(_zone.Name))
                {
                    oldZones.Remove(_zone.Name);
                }
            }

            UpdateButtons();
        }
 public void ReadObject(Lidgren.Network.NetIncomingMessage msg)
 {
     Id = msg.ReadInt64();
     ReadMe(msg);
 }