Exemplo n.º 1
0
        public static byte[] Write(PtKeyFrameCollection info)
        {
            ByteBuffer buffer = new ByteBuffer();

            buffer.WriteInt32(info.FrameIdx);
            buffer.WriteInt32(info.KeyFrames.Count);
            for (int i = 0; i < info.KeyFrames.Count; ++i)
            {
                buffer.WriteBytes(FrameIdxInfo.Write(info.KeyFrames[i]));
            }
            return(buffer.Getbuffer());
        }
Exemplo n.º 2
0
        public static byte[] Write(ReplayInfo info)
        {
            using (ByteBuffer buffer = new ByteBuffer())
            {
                buffer.WriteLong(info.OwnerId);
                buffer.WriteString(info.Version);

                int size = info.Frames.Count;
                buffer.WriteInt32(size);
                for (int i = 0; i < size; ++i)
                {
                    int infoCount = info.Frames[i].Count;
                    buffer.WriteInt32(infoCount);
                    for (int j = 0; j < infoCount; ++j)
                    {
                        FrameIdxInfo fInfo = info.Frames[i][j];
                        buffer.WriteBytes(FrameIdxInfo.Write(fInfo));
                    }
                }
                return(ByteBuffer.CompressBytes(buffer.Getbuffer()));
            }
        }