Пример #1
0
        private void populateLookup(XDocument xml)
        {
            IEnumerable <XElement> elements = null;

            if (xml.Element("UNITCONSTANTS").HasElements)
            {
                elements = xml.Elements();

                IEnumerator <XElement> itr = null;// = xml.DescendantNodes().GetEnumerator();
                //XElement unitConstants = XElement.Load(ofd1.FileName, LoadOptions.None);
                itr = elements.GetEnumerator();


                XElement child = null;
                itr.MoveNext();
                child = itr.Current;//UNITCONSTANTS
                if (child.HasElements)
                {
                    elements = child.Elements();
                    itr      = elements.GetEnumerator();//SYMBOLS
                    while (itr.MoveNext())
                    {
                        child = itr.Current;
                        UnitDef temp = UnitDef.XNodeToUnitDef(child);
                        if ((temp != null) && _UnitDefinitions.ContainsKey(temp.getBasicSymbolId()) == false)//temp will be null if node is an XCOMMENT
                        {
                            _UnitDefinitions.Add(temp.getBasicSymbolId(), temp);
                        }
                    } //end while
                }
            }         //end if
        }             //end populate lookup
Пример #2
0
        }             //end populate lookup

        /**
         * @name getSymbolDef
         *
         * @desc Returns a SymbolDef from the SymbolDefTable that matches the passed in Symbol Id
         *
         * @param strBasicSymbolID - IN - A 15 character MilStd code
         * @return SymbolDef whose Symbol Id matches what is passed in
         */
        public UnitDef getUnitDef(String basicSymbolID)
        {
            UnitDef returnVal = null;

            if (_UnitDefinitions.ContainsKey(basicSymbolID))
            {
                returnVal = _UnitDefinitions[basicSymbolID];
            }
            return(returnVal);
        }