/// <summary> /// Factor method to create an object of this class from a byte list /// </summary> /// <param name="bytes">A byte list from which the distributable object will be decoded</param> /// <returns>A new object of this class</returns> new public static AgentList Create(ByteList bytes) { AgentList result = new AgentList(); result.Decode(bytes); return(result); }
public void Update(AgentList agentList) { log.Debug("Enter AgentList Update"); if (agentList != null && agentList.Count > 0) { lock (myLock) { foreach (AgentInfo updatedAgent in agentList) { UpdateAgent(updatedAgent); } } } }
public static DistributableObject Create(ByteList bytes) { DistributableObject result = null; if (bytes == null || bytes.RemainingToRead < 4) { throw new ApplicationException("Invalid byte array"); } DISTRIBUTABLE_CLASS_IDS objType = (DISTRIBUTABLE_CLASS_IDS)bytes.PeekInt16(); switch (objType) { case DISTRIBUTABLE_CLASS_IDS.MessageNumber: result = MessageNumber.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.Bomb: result = Bomb.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.AgentInfo: result = AgentInfo.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.AgentList: result = AgentList.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.EndPoint: result = EndPoint.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.Excuse: result = Excuse.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.FieldLocation: result = FieldLocation.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.GameConfiguration: result = GameConfiguration.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.PlayingFieldLayout: result = PlayingFieldLayout.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.Tick: result = Tick.Create(bytes); break; case DISTRIBUTABLE_CLASS_IDS.WhiningTwine: result = WhiningTwine.Create(bytes); break; default: throw new ApplicationException(string.Format("Invalid Class Id={0}", objType)); } return(result); }