예제 #1
0
        private static void openXMLfile(string path, string outpath)
        {
            CanOpenXML coxml = new CanOpenXML();

            coxml.readXML(path);

            Bridge b = new Bridge();

            eds             = b.convert(coxml.dev);
            eds.xmlfilename = path;

            exportCOOD(outpath);
        }
예제 #2
0
        private void openXMLfile(string path)
        {
            try
            {
                EDSsharp eds;
                Device   dev; //one day this will be multiple devices

                CanOpenXML coxml = new CanOpenXML();
                coxml.readXML(path);

                Bridge b = new Bridge();

                eds             = b.convert(coxml.dev);
                eds.xmlfilename = path;

                dev = coxml.dev;

                tabControl1.TabPages.Add(eds.di.ProductName);

                DeviceView device = new DeviceView();

                eds.onDataDirty += Eds_onDataDirty;

                device.eds = eds;
                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();
            }
        }
예제 #3
0
        void ProfileAddClick(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab != null)
            {
                DeviceView dv = (DeviceView)tabControl1.SelectedTab.Controls[0];

                ToolStripMenuItem item = (ToolStripMenuItem)sender;

                string filename = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + item.Name;

                CanOpenXML coxml = new CanOpenXML();
                coxml.readXML(filename);

                Bridge b = new Bridge();

                EDSsharp eds;
                Device   dev; //one day this will be multiple devices

                eds = b.convert(coxml.dev);

                dev = coxml.dev;

                foreach (KeyValuePair <UInt16, ODentry> kvp in eds.ods)
                {
                    if (!dv.eds.ods.ContainsKey(kvp.Key))
                    {
                        dv.eds.ods.Add(kvp.Key, kvp.Value);
                    }
                }


                dv.dispatch_updateOD();
                dv.dispatch_updatePDOinfo();

                dv.eds.updatePDOcount();
                dv.dispatch_updatedevice();
            }
        }
예제 #4
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);
        }