public static PtKeyFrameCollection Read(byte[] bytes) { PtKeyFrameCollection info = new PtKeyFrameCollection(); info.KeyFrames = new List <FrameIdxInfo>(); ByteBuffer buffer = new ByteBuffer(bytes); info.FrameIdx = buffer.ReadInt32(); int size = buffer.ReadInt32(); for (int i = 0; i < size; ++i) { info.KeyFrames.Add(FrameIdxInfo.Read(buffer.ReadBytes())); } return(info); }
public static ReplayInfo Read(byte[] bytes) { using (ByteBuffer buffer = new ByteBuffer(ByteBuffer.Decompress(bytes))) { ReplayInfo info = new ReplayInfo(); info.OwnerId = buffer.ReadLong(); info.Version = buffer.ReadString(); info.Frames = new List <List <FrameIdxInfo> >(); int size = buffer.ReadInt32(); for (int i = 0; i < size; ++i) { int infoCount = buffer.ReadInt32(); List <FrameIdxInfo> list = new List <FrameIdxInfo>(); info.Frames.Add(list); for (int j = 0; j < infoCount; ++j) { list.Add(FrameIdxInfo.Read(buffer.ReadBytes())); } } return(info); } }