Пример #1
0
	public void InsertData( body2_GC_CHANNEL_LIST data)
	{
		dataList.Add( data);
	}
Пример #2
0
	public new void PacketBytesToClass( byte[] data)
	{
		Type infotype = this.GetType();
		FieldInfo headerinfo = null;

		int index = ParsePacketHeader( data);

		// bIngame
		byte[] ingame = new byte[ sizeof( bool)];
		headerinfo = infotype.GetField( "bIngame", BINDING_FLAGS_PIG);
		Buffer.BlockCopy( data, index, ingame, 0, sizeof( bool));
		headerinfo.SetValue( this, BitConverter.ToBoolean( ingame, 0));
		index += sizeof( bool);

		// nCnt
		byte[] count = new byte[ sizeof( Int32)];
		headerinfo = infotype.GetField( "nCnt", BINDING_FLAGS_PIG);
		Buffer.BlockCopy( data, index, count, 0, sizeof( Int32));
		headerinfo.SetValue( this, BitConverter.ToInt32( count, 0));
		index += sizeof( Int32);

		if( 0 >= nCnt)
			AsUtil.ShutDown( "body1_GC_CHANNEL_LIST");

		channels = new body2_GC_CHANNEL_LIST[ nCnt];
		for( int i = 0; i < nCnt; i++)
		{
			channels[i] = new body2_GC_CHANNEL_LIST();
//			tmpData = new byte[ body2_GC_CHANNEL_LIST.size];
//			Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length);
//			channels[i].ByteArrayToClass( tmpData);
//			index += body2_GC_CHANNEL_LIST.size;
			index = channels[i].PacketBytesToClass( data, index);
		}
	}