Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
 public AgentInfo(Int16 id, PossibleAgentType type, EndPoint ep) : base(id, ep)
 {
     AgentType = type;
 }
Exemplo n.º 3
0
 public AgentInfo(Int16 id, PossibleAgentType type) : base(id)
 {
     AgentType = type;
 }
Exemplo n.º 4
0
 public AgentInfo(Int16 id, PossibleAgentType type, EndPoint ep)
     : base(id, ep)
 {
     AgentType = type;
 }
Exemplo n.º 5
0
 public AgentInfo(Int16 id, PossibleAgentType type)
     : base(id)
 {
     AgentType = type;
 }
Exemplo n.º 6
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();
            }
        }