Exemplo n.º 1
0
        public static DamComStatus[] GetDamComTeams(byte[] byteArray, int index)
        {
            List <DamComStatus> retVal = new List <DamComStatus>();

            if (byteArray != null)
            {
                int position = index;
                while (position < byteArray.Length && byteArray[position] != 0xfe)
                {
                    DamComStatus d = new DamComStatus(byteArray, position);
                    retVal.Add(d);
                    position += PacketLength;
                }
            }
            return(retVal.ToArray());
        }
 public static ReadOnlyCollection<DamComStatus> GetDamComTeams(Stream stream, int index)
 {
     List<DamComStatus> retVal = new List<DamComStatus>();
     if (stream != null)
     {
         int position = index;
         stream.Position = position;
         while (position < stream.Length && Convert.ToByte(stream.ReadByte()) != 0xfe)
         {
             DamComStatus d = new DamComStatus(stream, position);
             retVal.Add(d);
             position += PacketLength;
             stream.Position = position;
         }
     }
     return new ReadOnlyCollection<DamComStatus>(retVal);
 }
Exemplo n.º 3
0
        public EngGridUpdatePacket(byte[] byteArray)
        {
            if (_log.IsInfoEnabled)
            {
                _log.InfoFormat("{0}--bytes in: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(byteArray));
            }
            Systems = SystemNode.GetNodes(byteArray);
            int index = 0;

            foreach (SystemNode node in Systems)
            {
                index += node.DataLength;
            }

            DamageControlTeams = DamComStatus.GetDamComTeams(byteArray, ++index);

            if (_log.IsInfoEnabled)
            {
                _log.InfoFormat("{0}--Result bytes: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(this.GetBytes()));
            }
        }