This project is read-only.

Add function to parse sentence in text

Dec 27, 2011 at 11:01 PM

I change some function for parse sentence I receive directly in text... don't know if it already exist a proper way...

NmeaInterpreter.cs:

Add function

        #region Public Methods
        public Boolean Parse(String sentence)
        {
            try
            {
                return Parse(_stream.ReadTypedSentence(new NmeaSentence(sentence)));
            }
            catch { return false; }
        }


in NmeaReader.cs

change
        public NmeaSentence ReadTypedSentence()
        {
            // First, read a valid sentence
            NmeaSentence sentence = ReadValidSentence();

to

        public NmeaSentence ReadTypedSentence(NmeaSentence sentence = null)
        {
            // First, read a valid sentence
            if (sentence == null)
            {
                sentence = ReadValidSentence();
            }

            if (sentence.CommandWord == null) return null;

...

            //Return
            if (sentence == null)
            {
                return false;
            }
            else
            {
                return sentence.IsValid;
            }