예제 #1
0
 public byte[] SerializeMSG(SnapshotMsg msg)
 {
     byte[] header = Header(msg.msgType);
     byte[] body   = BuildMSG(msg.from, msg.to, msg.positions,
                              msg.rotation,
                              msg.camRotation);
     return(Combine(IntByte((Int64)8 + header.Length + body.Length), header, body));
 }
예제 #2
0
        // Snapshot MSG
        private SnapshotMsg GetSsMSG(byte[] msg, Int64 msgSize)
        {
            Int32 type = ByteInt32(msg[8]);

            byte[] seq_num = new byte[4];
            byte[] vars    = new byte[msgSize - 13];

            Array.Copy(msg, 9, seq_num, 0, 4);
            Array.Copy(msg, 13, vars, 0, msgSize - 13);

            SnapshotMsg SsMSG = SsMSGVars(vars);

            SsMSG.msgType = type;
            return(SsMSG);
        }
예제 #3
0
        private SnapshotMsg SsMSGVars(byte[] vars) //needs work
        {
            byte[] from = new byte[4];
            byte[] pos  = new byte[12];
            byte[] pR   = new byte[16];
            byte[] cR   = new byte[16];

            int index = 0;

            //Console.WriteLine(vars.Length);
            Array.Copy(vars, index, from, 0, 4);
            index += 4;
            Array.Copy(vars, index, pos, 0, 12);
            index += 12;
            Array.Copy(vars, index, pR, 0, 16);
            index += 16;
            Array.Copy(vars, index, cR, 0, 16);

            SnapshotMsg msg = new SnapshotMsg();

            return(msg);
        }