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

            ExtendedClientMsgHdr extendedHdr = new ExtendedClientMsgHdr();

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

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

            MsgType = eMsg;
            payload = data;

            Header = new ExtendedClientMsgHdr();

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

            MsgType = eMsg;
            payload = data;

            ExtendedClientMsgHdr extendedHdr = new ExtendedClientMsgHdr();

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

            TargetJobID = extendedHdr.TargetJobID;
            SourceJobID = extendedHdr.SourceJobID;
        }