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);
        }
        public NmeaSentence AddNmeaSentence(string sentence, TalkerID?tid = null)
        {
            if (sentence == null)
            {
                throw new ArgumentNullException();
            }

            if (!IsFull && NmeaSentence.validateChecksum(sentence))
            {
                TalkerID talkerID = tid != null ? (TalkerID)tid : NmeaIDTools.ParseTalkerID(sentence);

                switch (NmeaIDTools.ParseSentenceID(sentence))
                {
                case SentenceID.GGA:
                {
                    if (!gga.ContainsKey(talkerID))
                    {
                        ggaIsValidated = false;

                        GGASentence ggaSentence = new GGASentence(sentence);
                        gga.Add(talkerID, ggaSentence);
                        allSenteneces.Add(ggaSentence);
                        return(ggaSentence);
                    }
                    else
                    {
                        throw new ExcessiveStringException(SentenceID.GGA);
                    }
                }

                case SentenceID.GSA:
                {
                    gsaIsValidated = false;

                    GSASentence gsaSentence;
                    if (!gsa.ContainsKey(talkerID))
                    {
                        gsaSentence = new GSASentence(sentence);
                        gsa.Add(talkerID, gsaSentence);
                        allSenteneces.Add(gsaSentence);
                        return(gsaSentence);
                    }
                    else
                    {
                        gsaSentence = gsa[talkerID];
                        gsaSentence.Parse(sentence);
                        return(gsaSentence);
                    }
                }

                case SentenceID.RMC:
                {
                    if (!rmc.ContainsKey(talkerID))
                    {
                        rmcIsValidated = false;

                        RMCSentence rmcSentence = new RMCSentence(sentence);
                        rmc.Add(talkerID, rmcSentence);
                        allSenteneces.Add(rmcSentence);
                        return(rmcSentence);
                    }
                    else
                    {
                        throw new ExcessiveStringException(SentenceID.RMC);
                    }
                }

                case SentenceID.GSV:
                {
                    gsvIsValidated = false;

                    GSVSentence gsvSentence;
                    if (!gsv.ContainsKey(talkerID) || gsv[talkerID].TotalMessageCount == 0)
                    {
                        gsvSentence = new GSVSentence(sentence);
                        gsv.Add(talkerID, gsvSentence);
                        allSenteneces.Add(gsvSentence);
                        return(gsvSentence);
                    }
                    else
                    {
                        gsvSentence = gsv[talkerID];
                        if (gsvSentence.MessageCount < gsvSentence.TotalMessageCount)
                        {
                            gsvSentence.Parse(sentence);
                            return(gsvSentence);
                        }
                        else
                        {
                            throw new ExcessiveStringException(SentenceID.GSV);
                        }
                    }
                }
                }
            }

            return(null);
        }