private Dictionary<string, Dictionary<string, IntVect>> LoadInterruptList(Dictionary<string, Dictionary<string, IntVect>> intVectList)
        {
            XmlDocument xDoc = new XmlDocument();

            try
            {
                if (Program.MakeSurePathExists(SettingsManagement.AppDataPath + "chip_xml"))
                {
                    string xmlFilePath = SettingsManagement.AppDataPath + "chip_xml\\interruptvectors.xml";

                    if (File.Exists(xmlFilePath) == false)
                        File.WriteAllText(xmlFilePath, Properties.Resources.interruptvectors);

                    xDoc.Load(xmlFilePath);
                }
                else
                {
                    xDoc.LoadXml(Properties.Resources.interruptvectors);
                }
            }
            catch (XmlException ex)
            {
                MessageBox.Show("XML error while loading interrupt vector data from interruptvectors.xml : " + ex.Message);
                return intVectList;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while loading interrupt vector data from interruptvectors.xml : " + ex.Message);
                return intVectList;
            }

            foreach (XmlElement i in xDoc.DocumentElement.GetElementsByTagName("Chip"))
            {
                string chip = i.GetAttribute("Name").Trim().ToLowerInvariant();

                if (string.IsNullOrEmpty(chip))
                    continue;

                if (intVectList.ContainsKey(chip) == false)
                    intVectList.Add(chip, new Dictionary<string, IntVect>());

                foreach (XmlElement j in i.GetElementsByTagName("HasVector"))
                {
                    string newName = j.GetAttribute("NewName").Trim();
                    string oldName = j.GetAttribute("OldName").Trim();
                    string desc = j.InnerText.Trim();

                    if (string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(desc))
                        continue;

                    IntVect v = new IntVect(newName, oldName, desc);

                    if (intVectList[chip].ContainsKey(v.Description) == false)
                        intVectList[chip].Add(v.Description, v);
                }
            }

            return intVectList;
        }
Example #2
0
        private Dictionary <string, Dictionary <string, IntVect> > LoadInterruptList(Dictionary <string, Dictionary <string, IntVect> > intVectList)
        {
            XmlDocument xDoc = new XmlDocument();

            try
            {
                if (Program.MakeSurePathExists(SettingsManagement.AppDataPath + "chip_xml"))
                {
                    string xmlFilePath = SettingsManagement.AppDataPath + "chip_xml\\interruptvectors.xml";

                    if (File.Exists(xmlFilePath) == false)
                    {
                        File.WriteAllText(xmlFilePath, Properties.Resources.interruptvectors);
                    }

                    xDoc.Load(xmlFilePath);
                }
                else
                {
                    xDoc.LoadXml(Properties.Resources.interruptvectors);
                }
            }
            catch (XmlException ex)
            {
                MessageBox.Show("XML error while loading interrupt vector data from interruptvectors.xml : " + ex.Message);
                return(intVectList);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while loading interrupt vector data from interruptvectors.xml : " + ex.Message);
                return(intVectList);
            }

            foreach (XmlElement i in xDoc.DocumentElement.GetElementsByTagName("Chip"))
            {
                string chip = i.GetAttribute("Name").Trim().ToLowerInvariant();

                if (string.IsNullOrEmpty(chip))
                {
                    continue;
                }

                if (intVectList.ContainsKey(chip) == false)
                {
                    intVectList.Add(chip, new Dictionary <string, IntVect>());
                }

                foreach (XmlElement j in i.GetElementsByTagName("HasVector"))
                {
                    string newName = j.GetAttribute("NewName").Trim();
                    string oldName = j.GetAttribute("OldName").Trim();
                    string desc    = j.InnerText.Trim();

                    if (string.IsNullOrEmpty(newName) || string.IsNullOrEmpty(desc))
                    {
                        continue;
                    }

                    IntVect v = new IntVect(newName, oldName, desc);

                    if (intVectList[chip].ContainsKey(v.Description) == false)
                    {
                        intVectList[chip].Add(v.Description, v);
                    }
                }
            }

            return(intVectList);
        }