public static PSocketMsg Parse(byte[] data, TcpP2pType type) { var msg = new PSocketMsg(); if (data != null) { msg.BodyLength = data.Length; } else { msg.BodyLength = 0; } msg.Type = (byte)type; if (msg.BodyLength > 0) { msg.Content = data; } return(msg); }