當前位置: 首頁>>代碼示例>>C#>>正文


C# ByteBuffer.GetInt方法代碼示例

本文整理匯總了C#中System.ByteBuffer.GetInt方法的典型用法代碼示例。如果您正苦於以下問題:C# ByteBuffer.GetInt方法的具體用法?C# ByteBuffer.GetInt怎麽用?C# ByteBuffer.GetInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.GetInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Read

 public void Read(ByteBuffer buf)
 {
     //振動 00 00 00 01 00 09 41 A1 34 00 00 00 00
        //輸入 00 00 00 01
        buf.GetInt();// 00 00 00 01
        if (buf.HasRemaining())
        {
        //long l=buf.GetLong();
        buf.Get();//0
      int qq=  buf.GetInt(); //QQ號碼
        buf.GetByteArray(3);//未知 00 00 00
      //byte[] data=  buf.GetByteArray(8);
      //byte[] comparedata = new byte[] { 0x00, 0x09, 0x41, 0xA1, 0x34, 0x00, 0x00, 0x00 };
      //long l = BitConverter.ToInt64(data, 0);
      //long l2 = BitConverter.ToInt64(comparedata, 0);
      //  if (l == l2)
      //  {
            IsShake = true;
        //}
        }
        else
        {
        IsInputState = true;
        }
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:25,代碼來源:Vibration.cs

示例2: 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

示例3: Read

 public void Read(ByteBuffer buf)
 {
     QQ = buf.GetInt();
     Property = buf.GetInt();
     // 未知16字節
     buf.Position = buf.Position + 16;
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:7,代碼來源:UserPropertyChange.cs

示例4: Read

 public void Read(ByteBuffer buf)
 {
     QQ = buf.GetInt();
     ModifiedTime = buf.GetInt();
     int len = buf.Get() & 0xFF;
     Sig = Utils.Util.GetString(buf, len);
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:7,代碼來源:Signature.cs

示例5: ByteBuffer_GetIntReturnsCorrectData

 public void ByteBuffer_GetIntReturnsCorrectData()
 {
     var buffer = new byte[4];
     buffer[0] = 0x0D;
     buffer[1] = 0x0C;
     buffer[2] = 0x0B;
     buffer[3] = 0x0A;
     var uut = new ByteBuffer(buffer);
     Assert.AreEqual(0x0A0B0C0D, uut.GetInt(0));
 }
開發者ID:google,項目名稱:flatbuffers,代碼行數:10,代碼來源:ByteBufferTests.cs

示例6: ParseBody

 protected override void ParseBody(ByteBuffer buf)
 {
     #if DEBUG
     Client.LogManager.Log(ToString() + " Decoded Data:" + Utils.Util.ToHex(buf.ToByteArray()));
     #endif
     buf.GetChar();//01 66 length or sth...
     buf.GetChar();//01 00
     Client.QQUser.QQKey.LoginInfo_Key2 = buf.GetByteArray(16);
     buf.Position += 8;//00 00 00 01 00 00 00 64
     Client.QQUser.QQKey.LoginInfo_UnknowData2 = buf.GetByteArray(4);
     Client.ServerTime = buf.GetByteArray(4);
     Client.ClientIP = buf.GetByteArray(4);
     buf.GetInt();//00000000
     int len = (int)buf.GetChar();
     Client.QQUser.QQKey.LoginInfo_Large_Token = buf.GetByteArray(len);
     buf.GetInt();//????
     len = (int)buf.Get();
     NickName = Utils.Util.GetString(buf.GetByteArray(len));
     Client.LogManager.Log(ToString() + ": Hello," + NickName);
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:20,代碼來源:LoginGetInfoReplyPacket.cs

示例7: ParseBody

 protected override void ParseBody(ByteBuffer buf)
 {
     #if DEBUG
     Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
     #endif
     FriendQQ = buf.GetInt();
     ReplyCode = (ReplyCode)buf.Get();
     if (ReplyCode == ReplyCode.OK)
     {
         AuthCode = (AuthType)buf.Get();
     }
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:12,代碼來源:AddFriendReplyPacket.cs

示例8: ParseBody

 protected override void ParseBody(ByteBuffer buf)
 {
     #if DEBUG
     Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
     #endif
     buf.Get();//00
     Onlines = buf.GetInt();
     IP = Utils.Util.GetIpStringFromBytes(buf.GetByteArray(4));//client ip
     Port = (int)buf.GetChar();
     buf.GetChar();//unknown 00 3c
     ServerTime = Utils.Util.GetDateTimeFromMillis(buf.GetInt() * 1000L);
     Client.LogManager.Log(ToString() + " Onlines:" +Onlines.ToString()+" IP:"+IP+" ServerTime:"+ServerTime.ToString());
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:13,代碼來源:KeepAliveReplyPacket.cs

示例9: Read

 /// <summary>
 /// 給定一個輸入流,解析ReceiveIMHeader結構
 /// </summary>
 /// <param name="buf">The buf.</param>
 public void Read(ByteBuffer buf)
 {
     // 發送者QQ號或者群內部ID
     Sender = buf.GetInt();
     // 接收者QQ號
     Receiver = buf.GetUInt();
     // 包序號,這個序號似乎和我們發的包裏麵的序號不同,至少這個是int,我們發的是char
     //     可能這個序號是服務器端生成的一個總的消息序號
     Sequence = buf.GetUInt();
     // 發送者IP,如果是服務器轉發的,那麽ip就是服務器ip
     SenderIP = buf.GetByteArray(4);
     // 發送者端口,如果是服務器轉發的,那麽就是服務器的端口 兩個字節
     SenderPort = buf.GetUShort();
     // 消息類型,是好友發的,還是陌生人發的,還是係統消息等等
     Type = (RecvSource)buf.GetUShort();
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:20,代碼來源:ReceiveIMHeader.cs

示例10: ReadBindUserSMS

        /// <summary>給定一個輸入流,解析SMS結構
        /// </summary>
        /// <param name="buf">The buf.</param>
        public void ReadBindUserSMS(ByteBuffer buf)
        {
            // 未知1字節,0x0
            buf.Get();
            // 發送者QQ號,4字節
            Sender = buf.GetInt();
            // 發送者頭像
            Header = (int)buf.GetUShort();
            // 發送者名稱,最多13字節,不足後麵補0
            SenderName = Utils.Util.GetString(buf, (byte)0, QQGlobal.QQ_MAX_SMS_SENDER_NAME);
            // 未知的1字節,0x4D
            buf.Get();
            // 消息內容
            Message = Utils.Util.GetString(buf, (byte)0);

            Time = DateTime.Now.Millisecond;
        }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:20,代碼來源:SMS.cs

示例11: ParseBody

        protected override void ParseBody(ByteBuffer buf)
        {
            #if DEBUG
            Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
            ReplyCode = buf.Get();
            buf.GetInt();
            switch (ReplyCode)
            {
                case 0x88:
                    buf.GetInt();//00000003 unknown
                    this.Level = buf.GetUShort();
                    this.ActiveDays = buf.GetUShort();
                    buf.GetChar();//unknown
                    this.UpgradeDays = buf.GetUShort();
                    Client.LogManager.Log(ToString() + " " + string.Format("level:{0} active_days:{1} upgrade_days:{2}", this.Level, this.ActiveDays, this.UpgradeDays));
                    break;
                default:
                    Client.LogManager.Log(ToString()+"unknown ReplyCode:0x"+ReplyCode.ToString("X"));
                    break;

            }
        }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:23,代碼來源:GetLevelReplyPacket.cs

示例12: ParseBody

 protected override void ParseBody(ByteBuffer buf)
 {
     SubCommand = (TempSessionSubCmd)buf.Get();
     switch (SubCommand)
     {
         case TempSessionSubCmd.SendIM:
             Receiver = buf.GetInt();
             ReplyCode = (ReplyCode)buf.Get();
             int len = buf.Get() & 0xFF;
             ReplyMessage = Utils.Util.GetString(buf, len);
             break;
         default:
             break;
     }
 }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:15,代碼來源:TempSessionOpReplyPacket.cs

示例13: ParseBody

        /// <summary>
        /// 解析包體,從buf的開頭位置解析起
        /// <remark>abu 2008-02-18 </remark>
        /// </summary>
        /// <param name="buf">The buf.</param>
        protected override void ParseBody(ByteBuffer buf)
        {
            #if DEBUG
            Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
            Empty = false;
            // 檢查消息長度,至少要有16字節,因為我們需要前16字節做為確認發回
            if (buf.Remaining() < 16)
            {
                throw new PacketParseException("收到的消息太短,拋棄該消息");
            }
            // 得到前16個字節用作回複
            Reply = buf.GetByteArray(16);
            // 讀取消息頭
            buf.Position = 0;
            Header = new ReceiveIMHeader();
            Header.Read(buf);
            // 檢查輸入流可用字節
            if (!buf.HasRemaining())
            {
                Empty = true;
                return;
            }
            // 判斷消息類型
            int len = 0;
            switch (Header.Type)
            {
                case RecvSource.FRIEND_0801: //手機消息
                    buf.Position += 10;//buf.GetInt();
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_0802:
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_09:
                    buf.Position += 11;
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_09SP1:
                    buf.Position += 2;
                    int len1 = buf.GetUShort();
                    buf.Position += len1;
                    ParseNormalIM(buf);
                    break;
                case RecvSource.STRANGER:
                    /* 是從好友或者陌生人處發來的消息 */
                    ParseNormalIM(buf);
                    break;

                case RecvSource.TEMP_SESSION:
                    TempSessionIM = new TempSessionIM();
                    TempSessionIM.Read(buf);
                    break;
                case RecvSource.SYS_MESSAGE:
                    /* 是係統消息 */
                    buf.GetInt();//00 00 00 00
                    ParseSystemMessage(buf);
                    break;
                case RecvSource.CLUSTER_09:
                    /* 群消息09 */
                    ParseClusterIM09(buf);
                    break;
                case RecvSource.CLUSTER:

                    /* 群消息 */
                    ParseClusterIM(buf);
                    break;
                case RecvSource.TEMP_CLUSTER:
                    /* 臨時群消息 */
                    ParseTempClusterIM(buf);
                    break;
                case RecvSource.UNKNOWN_CLUSTER:
                    ParseUnknownClusterIM(buf);
                    break;
                case RecvSource.BIND_USER:
                    SMS = new SMS();
                    SMS.ReadBindUserSMS(buf);
                    break;
                case RecvSource.MOBILE_QQ:
                    SMS = new SMS();
                    SMS.ReadMobileQQSMS(buf);
                    break;
                case RecvSource.MOBILE_QQ_2 :
                    SMS = new SMS();
                    SMS.ReadMobileQQ2SMS(buf);
                    break;
                case RecvSource.MOBILE:
                    SMS = new SMS();
                    SMS.ReadMobileSMS(buf);
                    break;
                case RecvSource.CREATE_CLUSTER:
                case RecvSource.ADDED_TO_CLUSTER:
                case RecvSource.DELETED_FROM_CLUSTER:
                    ExternalId = buf.GetInt();
                    ClusterType = (ClusterType)buf.Get();
//.........這裏部分代碼省略.........
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:101,代碼來源:ReceiveIMPacket.cs

示例14: ParseBody

        protected override void ParseBody(ByteBuffer buf)
        {
            //怎麽我得到的數據是//01 00 05 00 00 20 78 09 D7 43 99 8B DD 87 59 82 EA 85 7D 09 9A B2 92 77 53 5B 6D E3 6C B6 66 B3 21 75 6B 0B 37 85
            #if DEBUG
            Client.LogManager.Log(ToString() + " Decoded Data:" + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
            ReplyCode = buf.Get();//03: ok   04: need verifying 可是我得到的是01是由於前麵錯了了一個byte
            buf.Get();//0x00
            buf.Get();//0x05
            Png_Data = buf.Get();
            int len = 0;
            if (Png_Data == 0x00 && ReplyCode == 0x01)
            {
                len = (int)buf.Get();
                while (len == 0)
                {
                    len = (int)buf.Get();
                }
            }
            else //ReplyCode != 0x01按下麵走 兼容多版本
            {
                buf.GetInt();//需要驗證碼時為00 00 01 23,不需要時為全0
                len=(int)buf.GetChar();
            }
            Answer_Token = buf.GetByteArray(len);
            if (Png_Data== 0x01)//有驗證碼數據
            {
                len = (int)buf.GetChar();
                byte[] data = buf.GetByteArray(len);
                buf.Get();
                Next = buf.Get();
                string directory = Utils.Util.MapPath("/Verify/");
                this.CodeFileName = Path.Combine(directory, Client.QQUser.QQ + ".png");
                FileStream fs=null;
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
                if (Next != 0x00)
                {
                    fs = new FileStream(this.CodeFileName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);

                }
                else fs = new FileStream(this.CodeFileName, FileMode.Append, FileAccess.Write, FileShare.Read);
                //fs.Seek(0, SeekOrigin.End);
                fs.Write(data,0,data.Length);
                fs.Close();
                fs=null;

                len = (int)buf.GetChar();
                Png_Token = buf.GetByteArray(len);
            }

            //
            if (Png_Data!=0x00)
            {
                if (Next!=0x00)
                {
                    //prot_login_request(qq, &png_token, 0, 1);
                    Client.LogManager.Log("接收到部分驗證碼圖片數據,繼續接收....");
                    OutPacket outPacket = new LoginRequestPacket(Client, Png_Token, 0, 1);//發送一個請求驗證碼的包
                    Client.PacketManager.SendPacketAnyway(outPacket, QQPort.Main.Name);
                }
                else
                {
                    //qq->data.verify_token = answer_token;
                    //qqclient_set_process(qq, P_VERIFYING);
                    Client.LoginStatus = LoginStatus.NeedVerifyCode;
                    Client.QQUser.QQKey.Verify_Token = Answer_Token;
                    Client.LogManager.Log("Need input Verify Code");
                    //Client.LoginManager.OnLoginNeedVerifyCode(e);
                }
            }
            else
            {
                //DBG("process verify password");
                //qq->data.token_c = answer_token;
                //prot_login_verify(qq);
                Client.LogManager.Log("Process LoginRequest Success! Now Process Verify Password...");
                Client.QQUser.QQKey.Answer_Token = Answer_Token;
                OutPacket outPacket = new LoginVerifyPacket(Client);//發送一個登陸請求包
                Client.PacketManager.SendPacketAnyway(outPacket, QQPort.Main.Name);
            }
        }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:84,代碼來源:LoginRequestReplyPacket.cs

示例15: Read09

        /// <summary>
        /// 分析09的流
        /// </summary>
        /// <param name="buf"></param>
        public void Read09(ByteBuffer buf)
        {
            FontStyle = new FontStyle();
            // 是否有字體屬性
            HasFontAttribute = buf.GetInt() != 0;
            // 分片數
            TotalFragments = (int)buf.Get();
            // 分片序號
            FragmentSequence = (int)buf.Get();
            // 消息id 兩個字節
            MessageId = (int)buf.GetUShort();
            // 消息類型,這裏的類型表示是正常回複還是自動回複之類的信息
            ReplyType = (ReplyType)buf.Get();
            // 消息正文
            #region 字體屬性開始 未處理
            buf.Position += 8;//'M' 'S' 'G' 00 00 00 00 00
            buf.GetInt();//send time
            buf.Position += 12;//5D 69 71 DE 00 80 80 00 0A 00 86 00  參見sendim
            int len = buf.GetUShort();
            buf.GetByteArray(len);//字體 E5 AE 8B E4 BD 93 =宋體
            #endregion
            buf.GetUShort();//00 00
            IsNormalIM09 = true;//標注09的信息
            MessageBytes = buf.GetByteArray(buf.Remaining());
            //_Message = "";
            //while (buf.HasRemaining())
            //{
            //    byte type = buf.Get();
            //    len = buf.GetUShort();
            //    switch (type)
            //    {
            //        case 0x01://pure text
            //            //len_str = buf.GetUShort();
            //            _Message +=new NormalIMText(QQClient,buf.GetByteArray(len)).ToString();
            //            break;
            //        case 0x02://face
            //            _Message += new NormalIMFace(QQClient, buf.GetByteArray(len)).ToString();
            //            break;
            //        case 0x06://image
            //            _Message += new NormalIMImage(QQClient, buf.GetByteArray(len)).ToString();
            //            break;
            //        default:
            //            QQClient.LogManager.Log(ToString() + " Class Parse Unknown Type=0x" + type.ToString("X") + " Data=" + Utils.Util.ToHex(buf.GetByteArray(len)));
            //            break;

            //    }

            //}
        }
開發者ID:leaker,項目名稱:fuhj-widgets,代碼行數:53,代碼來源:NormalIM.cs


注:本文中的System.ByteBuffer.GetInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。