コード例 #1
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
    public static bool ParseHeader(byte[] packetHeader, ref ushort msgType, ref ushort msgLength)
    {
        bool result;

        if (packetHeader.Length < WfPacket.GetHeaderLength())
        {
            result = false;
        }
        else
        {
            int offset = 0;
            msgLength = LBitConverter.ToUInt16(packetHeader, ref offset);
            msgType   = LBitConverter.ToUInt16(packetHeader, ref offset);
            uint server_use = LBitConverter.ToUInt32(packetHeader, ref offset);
            result = true;
        }
        return(result);
    }
コード例 #2
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
    public void SetHeadLength()
    {
        int offset = 0;

        LBitConverter.GetBytes((ushort)GetOffset(), m_ReadBytes.GetBytes(), ref offset);
    }
コード例 #3
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public void Write(double i)
 {
     LBitConverter.GetBytes(i, s_WriteBytes, ref m_Offset);
 }
コード例 #4
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public void Write(String str)
 {
     LBitConverter.GetBytes(str, s_WriteBytes, ref m_Offset);
 }
コード例 #5
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public double ReadDouble()
 {
     return(LBitConverter.ToDouble(m_ReadBytes.GetBytes(), ref m_Offset));
 }
コード例 #6
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public string ReadString(int strLength)
 {
     return(LBitConverter.ToString(m_ReadBytes.GetBytes(), ref m_Offset, strLength));
 }
コード例 #7
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public float ReadFloat()
 {
     return(LBitConverter.ToSingle(m_ReadBytes.GetBytes(), ref m_Offset));
 }
コード例 #8
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public bool ReadBool()
 {
     return(LBitConverter.ToBoolean(m_ReadBytes.GetBytes(), ref m_Offset));
 }
コード例 #9
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public short ReadShort()
 {
     return(LBitConverter.ToInt16(m_ReadBytes.GetBytes(), ref m_Offset));
 }
コード例 #10
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public long ReadInt64()
 {
     return(LBitConverter.ToInt64(m_ReadBytes.GetBytes(), ref m_Offset));
 }
コード例 #11
0
ファイル: WfPacket.cs プロジェクト: xaerowl/WfBinaryProtocol
 public int ReadInt()
 {
     return(LBitConverter.ToInt32(m_ReadBytes.GetBytes(), ref m_Offset));
 }