public CSmartValue GetMember(ushort ID) { CSmartValue Value = new CSmartValue(); if (m_pData == null) { return(Value); } uint HeadIndex = m_StartIndex; uint TailIndex = m_StartIndex + GetDataLen(); HeadIndex += sizeof(byte) + sizeof(uint); while (HeadIndex + sizeof(ushort) < TailIndex) { ushort MemberID = BitConverter.ToUInt16(m_pData, (int)HeadIndex); HeadIndex += sizeof(ushort); if (!Value.Attach(m_pData, HeadIndex, TailIndex - HeadIndex, CSmartValue.SMART_VALUE_TYPE.VT_UNKNOWN)) { break; } if (MemberID == ID) { return(Value); } HeadIndex += Value.GetDataLen(); } Value.Destory(); return(Value); }
public CSmartValue GetMemberByIndex(uint Index) { CSmartValue Value = new CSmartValue(); if (m_pData == null) { return(Value); } uint HeadIndex = m_StartIndex; uint TailIndex = m_StartIndex + GetDataLen(); HeadIndex += sizeof(byte) + sizeof(uint); while (HeadIndex + sizeof(ushort) < TailIndex) { HeadIndex += sizeof(ushort); if (!Value.Attach(m_pData, HeadIndex, TailIndex - HeadIndex, CSmartValue.SMART_VALUE_TYPE.VT_UNKNOWN)) { break; } HeadIndex += Value.GetDataLen(); if (Index == 0) { return(Value); } Index--; } Value.Destory(); return(Value); }