Example #1
0
        private void openEDSfile(string path, InfoSection.Filetype ft)
        {
            Warnings.warning_list.Clear();

            try
            {
                EDSsharp eds = new EDSsharp();
                Device   dev;

                eds.Loadfile(path);
                Bridge bridge = new Bridge(); //tell me again why bridge is not static?
                dev = bridge.convert(eds);

                DeviceView device = new DeviceView();

                eds.OnDataDirty += Eds_onDataDirty;

                device.eds = eds;
                tabControl1.TabPages.Add(eds.di.ProductName);
                tabControl1.TabPages[tabControl1.TabPages.Count - 1].Controls.Add(device);
                device.Dock = DockStyle.Fill;

                device.dispatch_updateOD();

                network.Add(eds);
            }
            catch (Exception ex)
            {
                Warnings.warning_list.Add(ex.ToString());
            }

            if (Warnings.warning_list.Count != 0)
            {
                WarningsFrm frm = new WarningsFrm();
                frm.ShowDialog();
            }
        }
Example #2
0
        private void loadeds(string filename)
        {
            if (filename == null || filename == "")
            {
                return;
            }

            bool isdcf = false;

            switch (Path.GetExtension(filename).ToLower())
            {
            case ".xml":
            {
                CanOpenXML coxml = new CanOpenXML();
                coxml.readXML(filename);

                Bridge b = new Bridge();

                eds             = b.convert(coxml.dev);
                eds.xmlfilename = filename;
            }

            break;

            case ".dcf":
            {
                isdcf = true;
                eds   = new EDSsharp();
                eds.Loadfile(filename);
            }
            break;

            case ".eds":

            {
                eds = new EDSsharp();
                eds.Loadfile(filename);
            }
            break;
            }

            textBox_edsfilename.Text = eds.di.ProductName;


            //if (eds.di.concreteNodeId >= numericUpDown_node.Minimum && eds.di.concreteNodeId <= numericUpDown_node.Maximum)
            //    numericUpDown_node.Value = eds.di.concreteNodeId;

            listView1.BeginUpdate();
            if (!isdcf)
            {
                listView1.Items.Clear();
            }

            //           StorageLocation loc = StorageLocation


            foreach (ODentry tod in eds.ods.Values)
            {
                if (comboBoxtype.SelectedItem.ToString() != "ALL")
                {
                    if (comboBoxtype.SelectedItem.ToString() == "EEPROM" && (tod.StorageLocation.ToUpper() != "EEPROM"))
                    {
                        continue;
                    }
                    if (comboBoxtype.SelectedItem.ToString() == "ROM" && (tod.StorageLocation.ToUpper() != "ROM"))
                    {
                        continue;
                    }
                    if (comboBoxtype.SelectedItem.ToString() == "RAM" && (tod.StorageLocation.ToUpper() != "RAM"))
                    {
                        continue;
                    }
                }


                if (tod.Disabled == true)
                {
                    continue;
                }

                if (tod.Index < 0x2000 && checkBox_useronly.Checked == true)
                {
                    continue;
                }

                if (tod.objecttype == ObjectType.ARRAY || tod.objecttype == ObjectType.REC)
                {
                    foreach (ODentry subod in tod.subobjects.Values)
                    {
                        if (subod.Subindex == 0)
                        {
                            continue;
                        }

                        addtolist(subod, isdcf);
                    }

                    continue;
                }

                addtolist(tod, isdcf);
            }

            listView1.EndUpdate();

            this.filename = filename;
            addtoMRU(filename);
        }