public static List <DS_protocol.p_IdToFrames> DSerializeData(byte[] buffers) { var ms = new MemoryStream(buffers); var br = new BinaryReader(ms); List <DS_protocol.p_IdToFrames> idtofreames = new List <DS_protocol.p_IdToFrames>(); int nAreaCount = br.ReadChar(); for (int nLoop = 0; nLoop < nAreaCount; nLoop++) { DS_protocol.p_IdToFrames TIdToFrame = new DS_protocol.p_IdToFrames(); TIdToFrame.areaid = br.ReadChar(); int nSyncFrameCount = br.ReadInt16(); int nStartIndex = 0; for (int i = 0; i < nSyncFrameCount; i++) { DS_protocol.p_SyncFrame TFrame = new DS_protocol.p_SyncFrame(); //TFrame.frame_count = br.ReadInt16(); if (i == 0) { nStartIndex = br.ReadInt16(); } int nFrameMsgCount = br.ReadChar(); TFrame.frame_count = nStartIndex++; SyncFrame cur = new SyncFrame(TFrame.frame_count, TIdToFrame.areaid); for (int msgLoop = 0; msgLoop < nFrameMsgCount; msgLoop++) { var tt = DSerializeData(ms, br); if (tt != null) { cur.msg_list.Add(tt); } } Serialization.Buffer_SyncFrame_msg_list(cur.msg_list, TFrame.msg_list); TIdToFrame.frames.Add(TFrame); } idtofreames.Add(TIdToFrame); } br.Close(); ms.Close(); return(idtofreames); }