示例#1
0
        /// <summary>
        /// This method decodes a message from a byte list.  It can onlt be called from within the class hierarchy.
        /// </summary>
        /// <param name="messageBytes"></param>
        protected override void Decode(ByteList bytes)
        {
            if (bytes == null || bytes.RemainingToRead < MinimumEncodingLength)
            {
                throw new ApplicationException("Invalid byte array");
            }
            else if (bytes.PeekInt16() != ClassId)
            {
                throw new ApplicationException("Invalid class id");
            }
            else
            {
                Int16 objType   = bytes.GetInt16();
                Int16 objLength = bytes.GetInt16();

                bytes.SetNewReadLimit(objLength);

                base.Decode(bytes);

                agentType   = (PossibleAgentType)bytes.GetByte();
                agentStatus = (PossibleAgentStatus)bytes.GetByte();
                aNumber     = bytes.GetString();
                firstName   = bytes.GetString();
                lastName    = bytes.GetString();
                strength    = bytes.GetDouble();
                speed       = bytes.GetDouble();
                points      = bytes.GetDouble();
                location    = bytes.GetDistributableObject() as FieldLocation;

                bytes.RestorePreviosReadLimit();
            }
        }
示例#2
0
 public AgentInfo(Int16 id, PossibleAgentType type, EndPoint ep) : base(id, ep)
 {
     AgentType = type;
 }
示例#3
0
 public AgentInfo(Int16 id, PossibleAgentType type) : base(id)
 {
     AgentType = type;
 }
 public AgentInfo(Int16 id, PossibleAgentType type, EndPoint ep)
     : base(id, ep)
 {
     AgentType = type;
 }
 public AgentInfo(Int16 id, PossibleAgentType type)
     : base(id)
 {
     AgentType = type;
 }
        /// <summary>
        /// This method decodes a message from a byte list.  It can onlt be called from within the class hierarchy.
        /// </summary>
        /// <param name="messageBytes"></param>
        protected override void Decode(ByteList bytes)
        {
            if (bytes == null || bytes.RemainingToRead < MinimumEncodingLength)
                throw new ApplicationException("Invalid byte array");
            else if (bytes.PeekInt16() != ClassId)
                throw new ApplicationException("Invalid class id");
            else
            {
                Int16 objType = bytes.GetInt16();
                Int16 objLength = bytes.GetInt16();

                bytes.SetNewReadLimit(objLength);

                base.Decode(bytes);

                agentType = (PossibleAgentType)bytes.GetByte();
                agentStatus = (PossibleAgentStatus)bytes.GetByte();
                aNumber = bytes.GetString();
                firstName = bytes.GetString();
                lastName = bytes.GetString();
                strength = bytes.GetDouble();
                speed = bytes.GetDouble();
                points = bytes.GetDouble();
                location = bytes.GetDistributableObject() as FieldLocation;

                bytes.RestorePreviosReadLimit();
            }
        }