using GpsClient2.Exceptions; using GpsClient2.NmeaMessages; using System; using System.Collections.Generic; namespace GpsClient2 { public static class NmeaConstants { private static readonly Dictionary TypeDictionary = new Dictionary { {"GPGGA", typeof(GpggaMessage)}, {"GPRMC", typeof(GprmcMessage)}, {"GPVTG", typeof(GpvtgMessage)}, {"GPGSA", typeof(GpgsaMessage)} }; /// /// Returns the correct class type of the message. /// /// The type name given. /// The class type. /// Given if the type is unkown. public static Type GetClassType(string typeName) { Type result; TypeDictionary.TryGetValue(typeName, out result); if (result == null) { throw new UnknownTypeException(); } return result; } } }