Inheritance: IGCSerializableHeader
Exemplo n.º 1
0
		static IGCSerializableHeader ReadHeader(uint rawEMsg, Stream stream)
		{
			IGCSerializableHeader header = null;

			if (MsgUtil.IsProtoBuf(rawEMsg))
			{
				header = new MsgGCHdrProtoBuf();
			}
			else
			{
				header = new MsgGCHdr();
			}

			header.Deserialize(stream);
			return header;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketClientGCMsgProtobuf"/> class.
        /// </summary>
        /// <param name="eMsg">The network message type for this packet message.</param>
        /// <param name="data">The data.</param>
        public PacketClientGCMsgProtobuf( uint eMsg, byte[] data )
        {
            MsgType = eMsg;
            payload = data;

            MsgGCHdrProtoBuf protobufHeader = new MsgGCHdrProtoBuf();

            // we need to pull out the job ids, so we deserialize the protobuf header
            using ( MemoryStream ms = new MemoryStream( data ) )
            {
                protobufHeader.Deserialize( ms );
            }

            TargetJobID = protobufHeader.Proto.job_id_target;
            SourceJobID = protobufHeader.Proto.job_id_source;
        }
Exemplo n.º 3
0
        IGCSerializableHeader BuildGCHeader( uint realEMsg, Stream str )
        {
            IGCSerializableHeader hdr = null;

            if ( MsgUtil.IsProtoBuf( realEMsg ) )
            {
                hdr = new MsgGCHdrProtoBuf();
            }
            else
            {
                hdr = new MsgGCHdr();
            }

            hdr.Deserialize( str );
            return hdr;
        }