/// <summary>
        /// Parse out the contents of a network message.  The standard header
        /// of the magic and protocol selection byte are assumed to be present.
        /// </summary>
        /// <param name="Buffer">Supplies the message to parse.</param>
        /// <param name="Magic">Supplies the expected magic value.</param>
        /// <param name="ProtocolType">Supplies the expected protocol type
        /// value.</param>
        public NetworkMessage(byte[] Buffer, UInt32 Magic, Byte ProtocolType)
        {
            Parser = new BufferParser(Buffer);

            if (Parser.ReadUInt32() != Magic)
            {
                throw new ApplicationException("Invalid protocol magic.");
            }
            if (Parser.ReadByte() != ProtocolType)
            {
                throw new ApplicationException("Invalid protocol type.");
            }
            Cmd = Parser.ReadUInt16();
            if (Parser.ReadUInt32() != (UInt32)Buffer.Length)
            {
                throw new ApplicationException("Invalid message length.");
            }
        }
        /// <summary>
        /// Parse out the contents of a network message.  The standard header
        /// of the magic and protocol selection byte are assumed to be present.
        /// </summary>
        /// <param name="Buffer">Supplies the message to parse.</param>
        /// <param name="Magic">Supplies the expected magic value.</param>
        /// <param name="ProtocolType">Supplies the expected protocol type
        /// value.</param>
        public NetworkMessage(byte[] Buffer, UInt32 Magic, Byte ProtocolType)
        {
            Parser = new BufferParser(Buffer);

            if (Parser.ReadUInt32() != Magic)
                throw new ApplicationException("Invalid protocol magic.");
            if (Parser.ReadByte() != ProtocolType)
                throw new ApplicationException("Invalid protocol type.");
            Cmd = Parser.ReadUInt16();
            if (Parser.ReadUInt32() != (UInt32)Buffer.Length)
                throw new ApplicationException("Invalid message length.");
        }