Esempio n. 1
0
 public ADCRRecord(WDS_Extension.ApplicationDescriptor app, CompatibleDeviceDescriptor devices, CompatibleChipDescriptor chips, CompatibleLicenseDescriptor licenses)
 {
     this._applicationDescriptor = app;
     this._compatibleDevices = devices;
     this._compatibleChips = chips;
     this._compatibleLicenses = licenses;
 }
Esempio n. 2
0
        private void loadADCRRecordsFromXml()
        {
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            executingAssembly.GetManifestResourceNames();
            Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("NewWDS.WDS_Resources.ADCR.xml");
            List<ADCRRecord> list = new List<ADCRRecord>();
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load(manifestResourceStream);
                foreach (XmlNode node in document.GetElementsByTagName("ADCR_Record"))
                {
                    ApplicationDescriptor app = new ApplicationDescriptor();
                    CompatibleDeviceDescriptor comaptibleDevices = new CompatibleDeviceDescriptor();
                    CompatibleChipDescriptor chips = new CompatibleChipDescriptor();
                    CompatibleLicenseDescriptor licenses = new CompatibleLicenseDescriptor();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        string name = node2.Name;
                        if (name != null)
                        {
                            if (!(name == "Application"))
                            {
                                if (name == "Chips")
                                {
                                    goto Label_0377;
                                }
                                if (name == "Devices")
                                {
                                    goto Label_053F;
                                }
                            }
                            else
                            {
                                foreach (XmlNode node3 in node2.ChildNodes)
                                {
                                    switch (node3.Name)
                                    {
                                        case "Type":
                                            app.AppType = this.getAppTypeItemByName(node3.InnerText);
                                            break;

                                        case "Class":
                                            app.AppClass = this.getAppClassItemByName(node3.InnerText);
                                            break;

                                        case "Name":
                                            app.AppName = node3.InnerText;
                                            break;

                                        case "Description":
                                            app.ApplicationDescription = node3.InnerText;
                                            break;

                                        case "Simulation":
                                            app.SimulationCapable = bool.Parse(node3.InnerText);
                                            break;

                                        case "Advanced":
                                            app.Advanced = bool.Parse(node3.InnerText);
                                            break;

                                        case "StartupApplication":
                                            app.StartupApplication = node3.InnerText;
                                            break;

                                        case "EBIDRequired":
                                            app.EBIDRequired = bool.Parse(node3.InnerText);
                                            break;

                                        case "AllowedToRunOnDifferentFwType":
                                            app.AllowedToRunOnDifferentFwType = bool.Parse(node3.InnerText);
                                            break;

                                        case "TopOnAppList":
                                            app.TopOnAppList = bool.Parse(node3.InnerText);
                                            break;

                                        case "Licenses":
                                            foreach (XmlNode node4 in node3.ChildNodes)
                                            {
                                                if ((node4.NodeType != XmlNodeType.Comment) && (node4.Name == "Name"))
                                                {
                                                    LicenseItem item = new LicenseItem {
                                                        Name = node4.InnerText
                                                    };
                                                    licenses.LicenseList.Add(item);
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                        }
                        continue;
                    Label_0377:
                        foreach (XmlNode node5 in node2.ChildNodes)
                        {
                            CDTRecord record = new CDTRecord();
                            foreach (XmlNode node6 in node5.ChildNodes)
                            {
                                string str3 = node6.Name;
                                if (str3 != null)
                                {
                                    if (!(str3 == "Type"))
                                    {
                                        if (str3 == "Revision")
                                        {
                                            goto Label_042D;
                                        }
                                        if (str3 == "DefaultRev")
                                        {
                                            goto Label_0440;
                                        }
                                        if (str3 == "Advanced")
                                        {
                                            goto Label_0458;
                                        }
                                        if (str3 == "Licenses")
                                        {
                                            goto Label_046D;
                                        }
                                    }
                                    else
                                    {
                                        record.ChipType = node6.InnerText;
                                    }
                                }
                                continue;
                            Label_042D:
                                record.ChipRevision = node6.InnerText;
                                continue;
                            Label_0440:
                                record.DefaultRev = bool.Parse(node6.InnerText);
                                continue;
                            Label_0458:
                                record.Advanced = bool.Parse(node6.InnerText);
                                continue;
                            Label_046D:
                                foreach (XmlNode node7 in node6.ChildNodes)
                                {
                                    if ((node7.NodeType != XmlNodeType.Comment) && (node7.Name == "Name"))
                                    {
                                        LicenseItem item2 = new LicenseItem {
                                            Name = node7.InnerText
                                        };
                                        record.LicenseList.Add(item2);
                                    }
                                }
                            }
                            chips.ChipList.Add(record);
                        }
                        continue;
                    Label_053F:
                        this.parseCompatibleDevices(comaptibleDevices, node2);
                    }
                    list.Add(new ADCRRecord(app, comaptibleDevices, chips, licenses));
                }
                this._adcrRecordSet = list.ToArray();
            }
            catch (Exception exception)
            {
                MessageBox.Show("ADCR XML Reading error! \n" + exception.Message, "ADCRManager.loadADCRRecordsFromXml()");
            }
        }