protected override MultiParamBinaryRequestInfo ResolveRequestInfo(ArraySegment <byte> header, byte[][] paraBuffer) { int num = header.Array[0]; if (num == 0) { UserOP dop = (UserOP)header.Array[1]; return(new MultiParamBinaryRequestInfo(dop.ToString(), null, paraBuffer)); } return(null); }
internal void SendData(UserOP opCode, params byte[][] datas) { int totalLen = 0; foreach (byte[] data in datas) { totalLen = totalLen + data.Length; } totalLen = m_OPTypeLength + m_OPCodeLength + m_ParaCountLength + datas.Length * m_PerParaCountLength + totalLen; int flag = 0; int optype = 0; byte[] senddata = new byte[totalLen]; if (m_OPTypeLength == 1) { senddata[flag] = (byte)((optype & 0xFF)); } else if (m_OPTypeLength == 2) { senddata[flag + 1] = (byte)((optype >> 8) & 0xFF); senddata[flag] = (byte)((optype & 0xFF)); } else if (m_OPTypeLength == 3) { senddata[flag + 2] = (byte)((optype >> 16) & 0xFF); senddata[flag + 1] = (byte)((optype >> 8) & 0xFF); senddata[flag] = (byte)((optype & 0xFF)); } else { senddata[flag + 3] = (byte)((optype >> 24) & 0xFF); senddata[flag + 2] = (byte)((optype >> 16) & 0xFF); senddata[flag + 1] = (byte)((optype >> 8) & 0xFF); senddata[flag] = (byte)((optype & 0xFF)); } flag = flag + m_OPTypeLength; if (m_OPCodeLength == 1) { senddata[flag] = (byte)(((int)opCode & 0xFF)); } else if (m_OPCodeLength == 2) { senddata[flag + 1] = (byte)(((int)opCode >> 8) & 0xFF); senddata[flag] = (byte)(((int)opCode & 0xFF)); } else if (m_OPCodeLength == 3) { senddata[flag + 2] = (byte)(((int)opCode >> 16) & 0xFF); senddata[flag + 1] = (byte)(((int)opCode >> 8) & 0xFF); senddata[flag] = (byte)(((int)opCode & 0xFF)); } else { senddata[flag + 3] = (byte)(((int)opCode >> 24) & 0xFF); senddata[flag + 2] = (byte)(((int)opCode >> 16) & 0xFF); senddata[flag + 1] = (byte)(((int)opCode >> 8) & 0xFF); senddata[flag] = (byte)(((int)opCode & 0xFF)); } flag = flag + m_OPCodeLength; if (m_ParaCountLength == 1) { senddata[flag] = (byte)((datas.Length & 0xFF)); } else if (m_ParaCountLength == 2) { senddata[flag + 1] = (byte)((datas.Length >> 8) & 0xFF); senddata[flag] = (byte)((datas.Length & 0xFF)); } else if (m_ParaCountLength == 3) { senddata[flag + 2] = (byte)((datas.Length >> 16) & 0xFF); senddata[flag + 1] = (byte)((datas.Length >> 8) & 0xFF); senddata[flag] = (byte)((datas.Length & 0xFF)); } else { senddata[flag + 3] = (byte)((datas.Length >> 24) & 0xFF); senddata[flag + 2] = (byte)((datas.Length >> 16) & 0xFF); senddata[flag + 1] = (byte)((datas.Length >> 8) & 0xFF); senddata[flag] = (byte)((datas.Length & 0xFF)); } flag = flag + m_ParaCountLength; for (int i = 0; i < datas.Length; i++) { if (m_PerParaCountLength == 1) { senddata[flag] = (byte)((datas[i].Length & 0xFF)); } else if (m_PerParaCountLength == 2) { senddata[flag + 1] = (byte)((datas[i].Length >> 8) & 0xFF); senddata[flag] = (byte)((datas[i].Length & 0xFF)); } else if (m_PerParaCountLength == 3) { senddata[flag + 2] = (byte)((datas[i].Length >> 16) & 0xFF); senddata[flag + 1] = (byte)((datas[i].Length >> 8) & 0xFF); senddata[flag] = (byte)((datas[i].Length & 0xFF)); } else { senddata[flag + 3] = (byte)((datas[i].Length >> 24) & 0xFF); senddata[flag + 2] = (byte)((datas[i].Length >> 16) & 0xFF); senddata[flag + 1] = (byte)((datas[i].Length >> 8) & 0xFF); senddata[flag] = (byte)((datas[i].Length & 0xFF)); } flag = flag + m_PerParaCountLength; Buffer.BlockCopy(datas[i], 0, senddata, flag, datas[i].Length); flag = flag + datas[i].Length; } this.Send(senddata, 0, senddata.Length); }