Example #1
0
 public NmeaDictionary(string path)
 {
     _dictionaryByName = new Dictionary<string, NmeaSentenceType>();
     _dictionaryByCode = new Dictionary<string, NmeaSentenceType>();
     _dictionaryPath = path;
     XmlDocument doc = new XmlDocument();
     doc.Load(path);
     XmlElement sentences = (XmlElement)doc.ChildNodes[0];
     foreach (XmlElement sentence in sentences.ChildNodes)
     {
         string name = sentence.Attributes["name"].Value;
         string code = sentence.Attributes["code"].Value;
         bool ignore = false;
         if (sentence.Attributes["ignore"] != null)
         {
             ignore = bool.Parse(sentence.Attributes["ignore"].Value);
         }
         NmeaSentenceType t = new NmeaSentenceType(name, code, ignore);
         XmlElement parts = (XmlElement)sentence.ChildNodes[0];
         foreach (XmlElement part in parts.ChildNodes)
         {
             int position = int.Parse(part.Attributes["position"].Value);
             string partName = part.Attributes["name"].Value;
             NmeaSentenceTypePart p = new NmeaSentenceTypePart(position, partName, t);
             t.AddPart(p);
         }
         _dictionaryByName[t.Name] = t;
         _dictionaryByCode[t.Code] = t;
     }
 }
Example #2
0
        public NmeaDictionary(string path)
        {
            _dictionaryByName = new Dictionary <string, NmeaSentenceType>();
            _dictionaryByCode = new Dictionary <string, NmeaSentenceType>();
            _dictionaryPath   = path;
            XmlDocument doc = new XmlDocument();

            doc.Load(path);
            XmlElement sentences = (XmlElement)doc.ChildNodes[0];

            foreach (XmlElement sentence in sentences.ChildNodes)
            {
                string name   = sentence.Attributes["name"].Value;
                string code   = sentence.Attributes["code"].Value;
                bool   ignore = false;
                if (sentence.Attributes["ignore"] != null)
                {
                    ignore = bool.Parse(sentence.Attributes["ignore"].Value);
                }
                NmeaSentenceType t     = new NmeaSentenceType(name, code, ignore);
                XmlElement       parts = (XmlElement)sentence.ChildNodes[0];
                foreach (XmlElement part in parts.ChildNodes)
                {
                    int    position        = int.Parse(part.Attributes["position"].Value);
                    string partName        = part.Attributes["name"].Value;
                    NmeaSentenceTypePart p = new NmeaSentenceTypePart(position, partName, t);
                    t.AddPart(p);
                }
                _dictionaryByName[t.Name] = t;
                _dictionaryByCode[t.Code] = t;
            }
        }
 public NmeaSentenceTypePart(int position, string name, NmeaSentenceType sentenceType)
 {
     _position = position;
     _name = name;
     _sentenceType = sentenceType;
 }
Example #4
0
 public NmeaSentenceTypePart(int position, string name, NmeaSentenceType sentenceType)
 {
     _position     = position;
     _name         = name;
     _sentenceType = sentenceType;
 }