Exemple #1
0
        private void btnScsv_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                var           se  = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250);
                var           A   = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } };
                CsvFileFormat cff = se.createCsvFileFormat();
                cff.setSeparator(";");
                cff.setDecimalSeparator(".");
                se.setFileFormat(cff);
                se.append(A);
                u.save();
                ShowInfo("Parse file {signal.csv} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Exemple #2
0
        private void btnSbin_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                SignalEntry se = u.createSignalEntry("signal.bin", new String[] { "A", "B" }, DataType.INT16, 250);
                var         A  = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } };
                //se.setFileFormat(se.createXmlFileFormat());
                var B = new short[][] { new short[] { 2, 4 }, new short[] { 3, 5 }, new short[] { 4, 6 } };
                se.append(A);
                se.append(B);
                u.save();
                ShowInfo("Parse file {signal.bin} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Exemple #3
0
        private void btnExml_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                var ee = u.createEventEntry("event.xml", 1000);
                ee.setFileFormat(ee.createXmlFileFormat());
                ee.append(new Event(124, "N", "NORMAL"));
                ee.append(new Event(346, "N", "NORMAL"));
                ee.append(new Event(523, "V", "PVC"));
                u.save();
                ShowInfo("Parse file {event.xml} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Exemple #4
0
 private void btnVxml_Click(object sender, EventArgs e)
 {
     org.unisens.Unisens u = null;
     try
     {
         UnisensFactory uf = UnisensFactoryBuilder.createFactory();
         u = uf.createUnisens(folderDialogue.SelectedPath);
         ValuesEntry ve = u.createValuesEntry("values.xml", new String[] { "A", "B" }, DataType.INT16, 250);
         ve.setFileFormat(ve.createXmlFileFormat());
         ve.append(new Value(1320, new short[] { 1, 4 }));
         ve.append(new Value(22968, new short[] { 2, 5 }));
         ve.append(new Value(30232, new short[] { 3, 6 }));
         u.save();
         ShowInfo("Parse file {values.xml} suceed!");
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
     finally
     {
         if (u != null)
         {
             u.closeAll();
         }
     }
 }
Exemple #5
0
        public IEnumerable <XElement> Main(XDocument unisensxml, IEnumerable <XElement> selectedsignals, string path, double time_cursor, double time_start, double time_end, string parameter)
        {
            List <XElement> returnElementList = new List <XElement>();
            string          groupId           = null;
            DialogNewGroup  dialogNewGroup    = new DialogNewGroup();

            dialogNewGroup.Topmost = true;
            if (dialogNewGroup.ShowDialog() != (DialogNewGroup.newgroup))
            {
                groupId = DialogNewGroup.idOfTheGroup;
            }
            path = path.Substring(0, path.Length - 11);
            UnisensFactory factory = UnisensFactoryBuilder.createFactory();

            org.unisens.Unisens unisens      = factory.createUnisens(path);
            org.unisens.Group   group        = (org.unisens.Group)unisens.createGroup(groupId);
            XElement            groupElement = new XElement("{http://www.unisens.org/unisens2.0}group",
                                                            new XAttribute("id", groupId)
                                                            );

            foreach (XElement xe in selectedsignals)
            {
                XElement xelement = new XElement("{http://www.unisens.org/unisens2.0}groupEntry",
                                                 new XAttribute("ref", xe.Attribute("id").Value));
                groupElement.Add(xelement);
            }

            returnElementList.Add(groupElement);
            unisensxml.Root.Add(groupElement);
            unisens.closeAll();
            return(returnElementList);
        }