Exemplo n.º 1
0
        /// <summary>
        /// 取出一个端口号;同时得到去除这个端口号的数据;
        /// </summary>
        /// <param name="date">数据</param>
        /// <returns>返回端口号</returns>
        internal static int GetPort(ref byte[] date)
        {
            int haveInt = ByteToDate.ByteToInt(0, date);

            date = ByteToDate.ByteToByte(date, date.Length - 4, 4);
            return(haveInt);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 把缓冲区的数据拿出来;并且把缓冲区清空;
 /// </summary>
 /// <param name="stateOne">StateBase</param>
 /// <param name="insert">数据实际长度</param>
 /// <returns>需要的数据</returns>
 internal static byte[] DateOneManage(StateBase stateOne, int insert)
 {
     byte[] receiveByte = null;
     if (stateOne.Buffer[0] == 0 && stateOne.BufferBackup != null && stateOne.BufferBackup.Length >= insert)
     {
         receiveByte = stateOne.BufferBackup; stateOne.BufferBackup = null;
     }                                                                   //主要用于缓冲区有扩大缩小
     else
     {
         receiveByte = stateOne.Buffer;
     }
     byte[] haveDate = ByteToDate.ByteToByte(receiveByte, insert, 0);
     Array.Clear(stateOne.Buffer, 0, stateOne.Buffer.Length);
     return(haveDate);
 }