public static int Marshall(byte[] pBuffers,int nBufferLen,int nUsed, TJobInfos rValue) { int nLen=0; int n; n = TypeMarshaller.Marshall(pBuffers, nBufferLen, nUsed, rValue.m_uMenuId); if (n < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nLen += n; nUsed += n; n = TypeMarshaller.Marshall(pBuffers, nBufferLen, nUsed, rValue.m_uLvl); if (n < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nLen += n; nUsed += n; n = TypeMarshaller.Marshall(pBuffers, nBufferLen, nUsed, rValue.m_uFatherMenuId); if (n < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nLen += n; nUsed += n; n = TypeMarshaller.Marshall(pBuffers, nBufferLen, nUsed, rValue.m_pszNames); if (n < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nLen += n; nUsed += n; return nUsed; }
public static int Unmarshall(byte[] pBuffers,int nBufferLen,int nUsed, out TJobInfos rValue) { rValue = new TJobInfos(); int nLen=0; nLen = TypeUnmarshaller.Unmarshall(pBuffers, nBufferLen, nUsed, out rValue.m_uMenuId); if (nLen < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nUsed += nLen; nLen = TypeUnmarshaller.Unmarshall(pBuffers, nBufferLen, nUsed, out rValue.m_uLvl); if (nLen < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nUsed += nLen; nLen = TypeUnmarshaller.Unmarshall(pBuffers, nBufferLen, nUsed, out rValue.m_uFatherMenuId); if (nLen < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nUsed += nLen; nLen = TypeUnmarshaller.Unmarshall(pBuffers, nBufferLen, nUsed, out rValue.m_pszNames); if (nLen < MacrosAndDef.SUCCESS) { return MacrosAndDef.OUT_OF_MEM; } nUsed += nLen; return nUsed; }
public static int GetLength(TJobInfos rValue) { return TypeMarshaller.GetLength(rValue.m_uMenuId)+TypeMarshaller.GetLength(rValue.m_uLvl)+TypeMarshaller.GetLength(rValue.m_uFatherMenuId)+TypeMarshaller.GetLength(rValue.m_pszNames); }
int IfUserSession.ReqUpdateMenuInfo(TJobInfos _rJobInfos) { int nLength =TJobInfos.GetLength(_rJobInfos); CMessage pMsg = new CMessage((uint)IfUserSessionMethodId.IfUserSessionReqUpdateMenuInfoMethodId, nLength); if (null == pMsg.m_pBuffers) { return MacrosAndDef.OUT_OF_MEM; } int nBufferLen = pMsg.m_pBuffers.Length; int nUsed = TypeMarshaller.Marshall(pMsg.m_pBuffers, nBufferLen, 0, nLength); nUsed += TypeMarshaller.Marshall(pMsg.m_pBuffers, nBufferLen, nUsed,pMsg.m_uMsgId); int nLen = TJobInfos.Marshall(pMsg.m_pBuffers, nBufferLen, nUsed, _rJobInfos); if (nLen < MacrosAndDef.SUCCESS) { return nLen; } nUsed += nLen; if (nUsed != nBufferLen) { Debug.Log("the nUsed is:"+nUsed); TypeMarshaller.Marshall(pMsg.m_pBuffers, nBufferLen, sizeof(uint), nUsed); } CMessage.sm_pSocket.SendMsg(pMsg); return nUsed; }