TryParse() public method

public TryParse ( MemoryStream &stream ) : bool
stream System.IO.MemoryStream
return bool
Example #1
0
        // This attempts to parse a command and returns the command when complete
        public RemoteCommand TryParseCommand()
        {
            // If we're not working on a command yet, make one now
            if (receivecommand == null)
            {
                receivecommand = new RemoteCommand(this);
            }

            // Try parsing
            if (receivecommand.TryParse(ref receivebuffer))
            {
                // When complete, return the command and forget about this command
                RemoteCommand cmd = receivecommand;
                receivecommand = null;
                return(cmd);
            }
            else
            {
                return(null);
            }
        }