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


C# ByteBuffer.readByte方法代码示例

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


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

示例1: bytesReadServer

    public virtual void bytesReadServer(ByteBuffer data)
    {
        int position = data.position;
        this._tag = data.readByte();

        if (!this.isTag(this._tag))
        {
            data.position = position;
        }
    }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:10,代码来源:ErlType.cs

示例2: complexAnalyse

 public static ErlType complexAnalyse(ByteBuffer data)
 {
     int position = data.position;
     int num2 = data.readByte();
     data.position = position;
     if ((num2 == ErlArray.TAG[0]) || (num2 == ErlArray.TAG[1]))
     {
         ErlArray array = new ErlArray(null);
         array.bytesRead(data);
         return array;
     }
     switch (num2)
     {
     case 0x6a:
         {
             ErlNullList list = new ErlNullList();
             list.bytesRead(data);
             return list;
         }
     case 0x6c:
         {
             ErlList list2 = new ErlList(null);
             list2.bytesRead(data);
             return list2;
         }
     case 100:
         {
             ErlAtom atom = new ErlAtom(null);
             atom.bytesRead(data);
             return atom;
         }
     case 0x6b:
         {
             ErlString str = new ErlString(null);
             str.sampleBytesRead(data);
             return str;
         }
     case 110:
         {
             ErlLong @long = new ErlLong();
             @long.bytesRead(data);
             return @long;
         }
     case 0x6d:
         {
             ErlByteArray array2 = new ErlByteArray(null);
             array2.bytesRead(data);
             return array2;
         }
     }
     return null;
 }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:52,代码来源:ByteKitClient.cs

示例3: bytesRead

 public override void bytesRead(ByteBuffer data)
 {
     base.bytesRead(data);
     if (this.isTag(base._tag))
     {
         data.position -= 3;
         int len = data.readUnsignedShort() - 1;
         data.readByte();
         uint position = (uint) data.position;
         this._byteArray.clear();
         data.readBytes(this._byteArray, 0, len);
         this._value = this._byteArray.readUTFBytes(len);
     }
 }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:14,代码来源:ErlString.cs

示例4: bytesRead

 public override void bytesRead(ByteBuffer data)
 {
     base.bytesRead(data);
     if (this.isTag(base._tag))
     {
         int num = data.readInt();
         this._value = new ByteBuffer();
         this._value.writeBytes(data, 0, (uint) num);
         this._value.position = 0;
         data.position += num;
     }
     ByteBuffer buffer2 = new ByteBuffer(ZIPUtil.Decompress(this._value.toArray()));
     buffer2.readByte();
     this._erlValue = ByteKit.complexAnalyse(buffer2);
 }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:15,代码来源:ErlByteArray.cs

示例5: parseMessage

    public void parseMessage(ByteBuffer socketbuffer)
    {
        int num = socketbuffer.readByte ();
        bool flag = (num & 8) != 0;
        bool flag2 = (num & 4) != 0;
        bool flag3 = (num & 2) != 0;
        ByteBuffer data = new ByteBuffer (this.length - 1);
        data.write (socketbuffer.toArray (), 0, this.length - 1);
        if (base.socket.Available >= 2) {
            byte[] buffer = new byte[2];
            base.socket.Receive (buffer, SocketFlags.None);
            this.length = ByteKit.readUnsignedShort (buffer, 0);
        } else {
            this.length = 0;
        }
        if (flag) {
            data = this.encryptionCode (data, this._receiveChallengeCode);
        }
        if (flag3) {
            data = new ByteBuffer (ZIPUtil.Decompress (data.toArray ()));
        }
        if (flag2) {
            int num2 = data.readInt ();
            ByteBuffer buffer4 = new ByteBuffer ();
            buffer4.writeBytes (data.toArray (), 0, data.top - data.position);
            int num3 = (int)ChecksumUtil.Adler32 (buffer4);
            if (num2 != num3) {
                //MonoBehaviour.print(string.Concat(new object[] { "crc is err,crcValue", num2, ",nowCrc=", num3 }));
                // Log.info
                return;
            }
        }
        ErlKVMessage message = new ErlKVMessage (null);

        message.bytesRead (data);

        if (base._portHandler != null) {
            base._portHandler.erlReceive (this, message);
        }
    }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:40,代码来源:ErlConnect.cs

示例6: TransParseMessage

    public void TransParseMessage(ByteBuffer socketbuffer , bool isServer , ByteBuffer src)
    {
        try{
        int num = socketbuffer.readByte ();
        bool flag = (num & 8) != 0;
        bool flag2 = (num & 4) != 0;
        bool flag3 = (num & 2) != 0;
        ByteBuffer data = new ByteBuffer (this.length - 1);
        data.write (socketbuffer.toArray (), 0, this.length - 1);
        if ((this.dataBuffer.bytesAvailable) >= 2) {
            byte[] buffer = new byte[2];
            //base.socket.Receive (buffer, SocketFlags.None);
            this.dataBuffer.readBytes(buffer,0,2);
            this.length = ByteKit.readUnsignedShort (buffer, 0);

        } else {
            this.length = 0;
        }
        if (flag) {
            if (this.isServer) {
                data = this.encryptionCode (data, this._sendChallengeCode);
            } else {
                data = this.encryptionCode (data, this._receiveChallengeCode);
            }
        }
        if (flag3) {
            data = new ByteBuffer (ZIPUtil.Decompress (data.toArray ()));
        }
        if (flag2) {
            int num2 = data.readInt ();
            ByteBuffer buffer4 = new ByteBuffer ();
            buffer4.writeBytes (data.toArray (), 0, (int)data.bytesAvailable);
            int num3 = (int)ChecksumUtil.Adler32 (buffer4);
            if (num2 != num3) {
                Log.Error(string.Concat(new object[] { "crc is err,crcValue", num2, ",nowCrc=", num3 }));
                // Log.info
                //if (this.transCallBack != null) {
                //	this.transCallBack.Invoke ();
            //	}
                    int len = (int)this.dataBuffer.bytesAvailable;
                    int pos = this.dataBuffer.position;

                    byte[] tmp = new byte[len];
                    byte[] bak = new byte[pos];

                    this.dataBuffer.position = 0;
                    this.dataBuffer.readBytes (bak, 0, pos);
                    this.dataBuffer.readBytes (tmp, 0, len);
                    this.dataBuffer.clear ();
                    this.dataBuffer = new ByteBuffer (tmp);
                    if(!this.isServer){
                        base.socket.Send (bak);}

                    if (this.dataBuffer.bytesAvailable > 0) {
                        this.TransReceive (null, this.isServer);
                    }

                return;
            }
        }

            ErlKVMessage message = new ErlKVMessage (null);
            this.tmpBuffer = data;
            message.bytesRead (data);
            Log.Debug(string.Concat( data.getArray())+"++++++");
            this.myLen = this.dataBuffer.top;

            if (base._portHandler != null) {
                base._portHandler.erlReceive (this, message);

        }
        }
        catch(Exception e) {
            Log.Error (e.Message);
            if (this.dataBuffer.bytesAvailable > 0) {
                this.TransReceive (null, this.isServer);
            } else {
                int len = (int)this.dataBuffer.bytesAvailable;
                int pos = this.dataBuffer.position;

                byte[] tmp = new byte[len];
                byte[] bak = new byte[pos];

                this.dataBuffer.position = 0;
                this.dataBuffer.readBytes (bak, 0, pos);
                this.dataBuffer.readBytes (tmp, 0, len);
                this.dataBuffer.clear ();
                this.dataBuffer = new ByteBuffer (tmp);
                if (!this.isServer) {
                    base.socket.Send (bak);
                }

                if (this.dataBuffer.bytesAvailable > 0) {
                    this.TransReceive (null, this.isServer);
                }

            }
        }
    }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:99,代码来源:ErlConnect.cs

示例7: simpleAnalyse

 public static ErlType simpleAnalyse(ByteBuffer data)
 {
     int position = data.position;
     int num2 = data.readByte();
     data.position = position;
     switch (num2)
     {
     case 0x61:
         {
             ErlByte num3 = new ErlByte(0);
             num3.bytesRead(data);
             return num3;
         }
     case 0x6d:
         {
             ErlByteArray array = new ErlByteArray(null);
             array.simpleBytesRead(data);
             return array;
         }
     case 0x62:
         {
             ErlInt num4 = new ErlInt(0);
             num4.bytesRead(data);
             return num4;
         }
     case 0x6b:
         {
             ErlString str = new ErlString(string.Empty);
             str.bytesRead(data);
             return str;
         }
     case 110:
         {
             ErlLong @long = new ErlLong();
             @long.bytesRead(data);
             return @long;
         }
     }
     return null;
 }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:40,代码来源:ByteKitClient.cs

示例8: simpleBytesRead

 public void simpleBytesRead(ByteBuffer data)
 {
     base.bytesRead(data);
     if (this.isTag(base._tag))
     {
         data.position -= 3;
         int num = data.readUnsignedShort();
         data.readByte();
         this._value = new ByteBuffer();
         this._value.writeBytes(data, 0, (uint) (num - 1));
         this._value.position = 0;
         data.position += num - 1;
     }
     ByteBuffer buffer2 = new ByteBuffer(ZIPUtil.Decompress(this._value.toArray()));
     buffer2.readByte();
     this._erlValue = ByteKit.complexAnalyse(buffer2);
 }
开发者ID:hebbaixue99,项目名称:XJDemoServer,代码行数:17,代码来源:ErlByteArray.cs


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