public NmeaSentence AddNmeaSentence(String sentence, TalkerID?tid = null) { if (sentence == null) { throw new ArgumentNullException(); } if (!IsFull && NmeaSentence.validateChecksum(sentence)) { switch (NmeaIDTools.ParseSentenceID(sentence)) { case SentenceID.GGA: { if (gga == null || !gga.IsValid) { gga = new GGASentence(sentence); return(gga); } else { throw new ExcessiveStringException(SentenceID.GGA); } } case SentenceID.GSA: { if (gsa == null) { gsa = new GSASentence(sentence); return(gsa); } else { gsa.Parse(sentence); return(gsa); } } case SentenceID.RMC: { if (rmc == null) { rmc = new RMCSentence(sentence); return(rmc); } else { throw new ExcessiveStringException(SentenceID.RMC); } } case SentenceID.GSV: { if (gsv == null || gsv.TotalMessageCount == 0) { gsv = new GSVSentence(sentence); return(gsv); } else { if (gsv.MessageCount < gsv.TotalMessageCount) { gsv.Parse(sentence); return(gsv); } else { throw new ExcessiveStringException(SentenceID.GSV); } } } } } return(null); }