Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketMsg"/> class.
        /// </summary>
        /// <param name="eMsg">The network message type for this packet message.</param>
        /// <param name="data">The data.</param>
        public PacketMsg(EMsg eMsg, byte[] data)
        {
            MsgType = eMsg;
            payload = data;

            MsgHdr msgHdr = new MsgHdr();

            // deserialize the header to get our hands on the job ids
            using (MemoryStream ms = new MemoryStream(data))
            {
                msgHdr.Deserialize(ms);
            }

            TargetJobID = msgHdr.TargetJobID;
            SourceJobID = msgHdr.SourceJobID;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketMsg"/> class.
        /// </summary>
        /// <param name="eMsg">The network message type for this packet message.</param>
        /// <param name="data">The data.</param>
        public PacketMsg(EMsg eMsg, byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            MsgType = eMsg;
            payload = data;

            Header = new MsgHdr();

            // deserialize the header to get our hands on the job ids
            using MemoryStream ms = new MemoryStream(data);
            Header.Deserialize(ms);
            BodyOffset = ms.Position;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketMsg"/> class.
        /// </summary>
        /// <param name="eMsg">The network message type for this packet message.</param>
        /// <param name="data">The data.</param>
        public PacketMsg(EMsg eMsg, byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            MsgType = eMsg;
            payload = data;

            MsgHdr msgHdr = new MsgHdr();

            // deserialize the header to get our hands on the job ids
            using (MemoryStream ms = new MemoryStream(data))
            {
                msgHdr.Deserialize(ms);
            }

            TargetJobID = msgHdr.TargetJobID;
            SourceJobID = msgHdr.SourceJobID;
        }