当前位置: 首页>>代码示例>>C#>>正文


C# System.ByteBuffer类代码示例

本文整理汇总了C#中System.ByteBuffer的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer类的具体用法?C# ByteBuffer怎么用?C# ByteBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ByteBuffer类属于System命名空间,在下文中一共展示了ByteBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PutBody

        protected override void PutBody(ByteBuffer buf)
        {
            // 初始密钥
            //buf.Put(user.QQKey.InitKey);
            buf.PutChar((char)user.QQKey.LoginInfo_Magic_Token.Length);
            buf.Put(user.QQKey.LoginInfo_Magic_Token);
            ByteBuffer DecodedBuf = new ByteBuffer();
            DecodedBuf.PutChar((char)0x0101);
            DecodedBuf.PutChar((char)0x0000);
            DecodedBuf.Put((byte)Client.QQUser.QQKey.LoginInfo_Token.Length);
            DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_Token);

            DecodedBuf.Put(new byte[]{0x10,0x03,0xC8,0xEC,0xC8,0x96,
                0x8B,0xF2,0xB3,0x6B,0x4D,0x0C,0x5C,0xE0,0x6A,0x51,0xCE});//unknown data
            //Client.QQUser.QQKey.Key = Client.QQUser.QQKey.LoginInfo_Key1;//可能要用到
            byte[] EncodedBuf = crypter.Encrypt(DecodedBuf.ToByteArray(), user.QQKey.LoginInfo_Key1);
            #if DEBUG
            Client.LogManager.Log(ToString() + " key:" + Utils.Util.ToHex(user.QQKey.LoginInfo_Key1));
            Client.LogManager.Log(ToString() + " UnBody:" + Utils.Util.ToHex(DecodedBuf.ToByteArray()));
            #endif
            buf.Put(EncodedBuf);
            #if DEBUG
            Client.LogManager.Log(ToString() + " EnBody:" + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:25,代码来源:LoginA4Packet.cs

示例2: ByteBuffer_GetByteReturnsCorrectData

 public void ByteBuffer_GetByteReturnsCorrectData()
 {
     var buffer = new byte[1];
     buffer[0] = 99;
     var uut = new ByteBuffer(buffer);
     Assert.AreEqual((byte)99, uut.Get(0));
 }
开发者ID:google,项目名称:flatbuffers,代码行数:7,代码来源:ByteBufferTests.cs

示例3: PutBody

 protected override void PutBody(ByteBuffer buf)
 {
     buf.Put(Reply);
     #if DEBUG
     Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
     #endif
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:7,代码来源:ReceiveIMReplyPacket.cs

示例4: PutBody

        protected override void PutBody(ByteBuffer buf)
        {
            buf.PutChar((char)Client.QQUser.QQKey.LoginInfo_Magic_Token.Length);
            buf.Put(user.QQKey.LoginInfo_Magic_Token);
            ByteBuffer DecodedBuf = new ByteBuffer();
            DecodedBuf.PutChar((char)0x011A);
            DecodedBuf.PutChar((char)0x0001);
            DecodedBuf.Put(VersionData.QQ09_LOCALE);
            DecodedBuf.Put(VersionData.QQ09_VERSION_SPEC);
            DecodedBuf.Put((byte)0x00);
            DecodedBuf.Put((byte)Client.QQUser.QQKey.Answer_Token.Length);
            DecodedBuf.Put(Client.QQUser.QQKey.Answer_Token);
            DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_UnknowData2);
            DecodedBuf.Put(Client.ServerTime);
            DecodedBuf.Put(Client.ClientIP);
            DecodedBuf.Position += 4;//00 00 00 00
            DecodedBuf.PutChar((char)Client.QQUser.QQKey.LoginInfo_Large_Token.Length);
            DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_Large_Token);
            DecodedBuf.PutUShort(this.Pos);
            DecodedBuf.Position += 2;// 00 00
            DecodedBuf.PutChar((char)0x0071);
            DecodedBuf.Position += 0x0070;//0x0071 zeros
            DecodedBuf.Put(0x00);

            byte[] EncodedBuf = crypter.Encrypt(DecodedBuf.ToByteArray(), user.QQKey.LoginInfo_Key1);
            #if DEBUG
            Client.LogManager.Log(ToString() + " QQKey.LoginInfo_Key1:" + Utils.Util.ToHex(user.QQKey.LoginInfo_Key1));
            Client.LogManager.Log(ToString() + " pos:"+this.Pos+" UnBody:" + Utils.Util.ToHex(DecodedBuf.ToByteArray()));
            #endif
            buf.Put(EncodedBuf);
            #if DEBUG
            Client.LogManager.Log(ToString() + " EnBody:" + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:34,代码来源:LoginGetListPacket.cs

示例5: OnDecode

 protected override void OnDecode(ByteBuffer buffer, int count)
 {
     if (count-- > 0)
     {
         this.TxnId = AmqpCodec.DecodeBinary(buffer);
     }
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:7,代码来源:Declared.cs

示例6: Encode

 public void Encode(ByteBuffer buffer)
 {
     byte[] bytes = this.uuid.ToByteArray();
     buffer.Validate(true, bytes.Length);
     Buffer.BlockCopy(bytes, 0, buffer.Buffer, buffer.WritePos, bytes.Length);
     buffer.Append(bytes.Length);
 }
开发者ID:Eclo,项目名称:amqpnetlite,代码行数:7,代码来源:EmployeeId.cs

示例7: PutBody

 protected override void PutBody(ByteBuffer buf)
 {
     // 命令类型
     buf.Put((byte)SubCommand);
     // 内部ID
     buf.PutInt(ClusterId);
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:7,代码来源:ClusterExitPacket.cs

示例8: InitializeSettings

		private void InitializeSettings()
		{
			// TODO: clean this stuff up
			/*****************************************/
			int size = Core.Rom.Length;
			_size = Core.Rom.Length < 8448 ? 8448 : Core.Rom.Length; //8448 or Rom size, whichever is bigger

			_numberOfLoadImages = (byte)(_size / 8448);

			// TODO: why are we making a redundant copy?
			_loadedImages = new ByteBuffer(_size);
			for (int i = 0; i < size; i++)
			{
				_loadedImages[i] = Core.Rom[i];
			}

			if (size < 8448)
			{
				for (int i = size; i < _size; i++)
				{
					_loadedImages[i] = DefaultHeader[i];
				}
			}
			/*****************************************/

			InitializeRom();
			BankConfiguration(0);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:28,代码来源:mAR.cs

示例9: ParseBody

 protected override void ParseBody(ByteBuffer buf)
 {
     #if DEBUG
     Client.LogManager.Log(ToString() + " Decoded Data:" + Utils.Util.ToHex(buf.ToByteArray()));
     Client.LogManager.Log(ToString() + ":No use data until now!You can check this dat! It's said it has a key");
     #endif
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:7,代码来源:LoginA4ReplyPacket.cs

示例10: Can_Encode_And_Decode_MulipleValue_Fields_SingleValue_Alt_Format

        public void Can_Encode_And_Decode_MulipleValue_Fields_SingleValue_Alt_Format()
        {
            var wireFrame = new byte[]
            {
            0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x10, 0xd0, 0x00, 0x00, 0x00, 0x3c, 0x00,
            0x00, 0x00, 0x09, 0xb1, 0x00, 0x00, 0x00, 0x00,
            0x40, 0x70, 0xff, 0xff, 0xff, 0xff, 0x60, 0xff,
            0xff, 0x40, 0x40, 0x40, 0x40,
            0xa3, 0x24, 0x30, 0x64, 0x36, 0x36, 0x32, 0x65,
            0x64, 0x35, 0x2d, 0x33, 0x30, 0x62, 0x38, 0x2d,
            0x34, 0x32, 0x62, 0x39, 0x2d, 0x61, 0x61, 0x37,
            0x30, 0x2d, 0x66, 0x33, 0x30, 0x66, 0x30, 0x37,
            0x66, 0x38, 0x61, 0x34, 0x62, 0x34, 0x40, 0x38,
            0x61, 0x34, 0x62, 0x34,
            };

            var buffer = new ByteBuffer(wireFrame);

            var decodedValue = AmqpCodec.DecodeObject<Open>(buffer);

            Assert.NotNull(decodedValue.DesiredCapabilities);
            Assert.AreEqual(1, decodedValue.DesiredCapabilities.Length);
            Assert.IsNotNullOrEmpty(decodedValue.DesiredCapabilities[0]);
        }
开发者ID:jdaigle,项目名称:LightRail,代码行数:25,代码来源:DescribedListCodecTests.cs

示例11: PutBody

 protected override void PutBody(ByteBuffer buf)
 {
     buf.Put((byte)SubCommand);
     buf.Put((byte)Type);
     buf.PutInt(ParentClusterId);
     buf.PutInt(ClusterId);
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:7,代码来源:ClusterExitTempPacket.cs

示例12: GetInt32Test_Exception_OutOfRange

 public void GetInt32Test_Exception_OutOfRange()
 {
     var bytes = new byte[] { 0x00, 0x00, 0x00, 0x01 };
     var bb = new ByteBuffer(bytes, ByteOrder.BigEndian);
     bb.GetInt32();
     bb.GetInt32();
 }
开发者ID:yksz,项目名称:binaryutil.net,代码行数:7,代码来源:ByteBufferTests.cs

示例13: decodeControlResponse

        /// <summary>
        /// Decode input as a control parameters in NDN-TLV and set the fields of the
        /// controlResponse object.
        /// </summary>
        ///
        /// <param name="controlResponse"></param>
        /// <param name="input"></param>
        /// <param name="copy">unchanged while the Blob values are used.</param>
        /// <exception cref="EncodingException">For invalid encoding</exception>
        public override void decodeControlResponse(ControlResponse controlResponse,
				ByteBuffer input, bool copy)
        {
            TlvDecoder decoder = new TlvDecoder(input);
            int endOffset = decoder
                    .readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_ControlResponse);

            controlResponse.setStatusCode((int) decoder
                    .readNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_StatusCode));
            // Set copy false since we just immediately get a string.
            Blob statusText = new Blob(
                    decoder.readBlobTlv(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_StatusText), false);
            controlResponse.setStatusText(statusText.toString());

            // Decode the body.
            if (decoder
                    .peekType(net.named_data.jndn.encoding.tlv.Tlv.ControlParameters_ControlParameters, endOffset)) {
                controlResponse.setBodyAsControlParameters(new ControlParameters());
                // Decode into the existing ControlParameters to avoid copying.
                decodeControlParameters(
                        controlResponse.getBodyAsControlParameters(), decoder, copy);
            } else
                controlResponse.setBodyAsControlParameters(null);

            decoder.finishNestedTlvs(endOffset);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:35,代码来源:Tlv0_2WireFormat.cs

示例14: Read

 /// <summary>
 /// </summary>
 /// <param name="buf">The buf.</param>
 public void Read(ByteBuffer buf)
 {
     // 发送者
     Sender = buf.GetInt();
     // 未知的4字节
     buf.GetInt();
     // 昵称
     int len = buf.Get() & 0xFF;
     Nick = Utils.Util.GetString(buf, len);
     // 群名称
     len = buf.Get() & 0xFF;
     Site = Utils.Util.GetString(buf, len);
     // 未知的1字节
     buf.Get();
     // 时间
     Time = (long)buf.GetInt() * 1000L;
     // 后面的内容长度
     len = buf.GetUShort();
     // 得到字体属性长度,然后得到消息内容
     int fontStyleLength = buf.Get(buf.Position + len - 1) & 0xFF;
     Message = Utils.Util.GetString(buf, len - fontStyleLength);
     // 字体属性
     FontStyle = new FontStyle();
     FontStyle.Read(buf);
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:28,代码来源:TempSessionIM.cs

示例15: CustomAudioDevice

		public CustomAudioDevice(Context context)
		{
			if (!InstanceFieldsInitialized)
			{
				InitializeInstanceFields();
				InstanceFieldsInitialized = true;
			}
			this.m_context = context;

			try
			{
				m_playBuffer = ByteBuffer.allocateDirect(MAX_SAMPLES);
				m_recBuffer = ByteBuffer.allocateDirect(MAX_SAMPLES);
			}
			catch (Exception e)
			{
				Log.e(LOG_TAG, e.Message);
			}

			m_tempBufPlay = new sbyte[MAX_SAMPLES];
			m_tempBufRec = new sbyte[MAX_SAMPLES];

			m_captureSettings = new AudioSettings(SAMPLING_RATE, NUM_CHANNELS_CAPTURING);
			m_rendererSettings = new AudioSettings(SAMPLING_RATE, NUM_CHANNELS_RENDERING);

			m_audioManager = (AudioManager) m_context.getSystemService(Context.AUDIO_SERVICE);

			m_audioManager.Mode = AudioManager.MODE_IN_COMMUNICATION;
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:29,代码来源:CustomAudioDevice.cs


注:本文中的System.ByteBuffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。