private List <ChipInfo> DoGetChipInfo(string vendor, string serise) { XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true;//忽略文档里面的注释 XmlDocument doc = new XmlDocument(); List <ChipInfo> infolist = new List <ChipInfo>(); try { doc.Load(_chipinfodir + @"\" + vendor + @"\" + serise + ".xml"); var chipinfosiglenode = doc.SelectSingleNode(ChipInfo.TYPE_TABLE_NAME_CHIPINFO); var chipinfoElement = chipinfosiglenode as XmlElement; chipinfoElement.GetAttribute(ChipInfo.TYPE_COLUMN_VENDOR); // parse every chip. in the em XmlNodeList xnl = chipinfosiglenode.ChildNodes; foreach (XmlNode xmlnode in xnl) { var siglechipele = xmlnode as XmlElement; ChipInfo chipinfoobject = new ChipInfo(); chipinfoobject.vendor = vendor; chipinfoobject.series = serise; chipinfoobject.name = siglechipele.GetAttribute(ChipInfo.TYPE_COLUMN_NAME); chipinfoobject.type = siglechipele.GetAttribute(ChipInfo.TYPE_COLUMN_TYPE); chipinfoobject.package = siglechipele.GetAttribute(ChipInfo.TYPE_COLUMN_PACKAGE); chipinfoobject.burner = siglechipele.GetAttribute(ChipInfo.TYPE_COLUMN_BURNER); chipinfoobject.note = siglechipele.GetAttribute(ChipInfo.TYPE_COLUMN_NOTE); infolist.Add(chipinfoobject); } } catch { } finally { } return(infolist); }
private void InitDBmodul() { var sql = "select * from " + ChipInfo.TYPE_TABLE_NAME_CHIPINFO + ";"; var read = _DeviceManager.DataBaseManager.ExeGetReader(sql); if (read == null || !read.HasRows) { return; } _venderseriesDictionary.Clear(); _allchipvendorlistDic.Clear(); _allChipInfo.Clear(); while (read.Read()) { try { var chipinfo = new ChipInfo(); NameValueCollection nv = read.GetValues(); chipinfo.vendor = "" + nv.Get(ChipInfo.TYPE_COLUMN_VENDOR); var series = nv.Get(ChipInfo.TYPE_COLUMN_SERIES); chipinfo.series = "" + nv.Get(ChipInfo.TYPE_COLUMN_SERIES); chipinfo.name = nv.Get(ChipInfo.TYPE_COLUMN_NAME); chipinfo.type = nv.Get(ChipInfo.TYPE_COLUMN_TYPE); chipinfo.package = nv.Get(ChipInfo.TYPE_COLUMN_PACKAGE); chipinfo.burner = nv.Get(ChipInfo.TYPE_COLUMN_BURNER); chipinfo.note = nv.Get(ChipInfo.TYPE_COLUMN_NOTE); _allChipInfo.Add(chipinfo); ProgLog.D(TAG, chipinfo.ToString()); } catch (Exception e) { SystemLog.E(TAG, " get chipinfo error " + e.ToString()); } } read.Close(); }