Esempio n. 1
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();
         }
     }
 }
        public void testAppendValue()
        {
            Value expected = new Value(100, new short[] { 5, 10 });

            tempValuesEntry.append(expected);
            Value[] actuals = tempValuesEntry.read(tempValuesEntry.getCount() - 1, 1);
            assertValue(expected, actuals[0]);
            unisens.deleteEntry(tempValuesEntry);
        }
Esempio n. 3
0
        private void valuesXml()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            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();
            u.closeAll();
        }
Esempio n. 4
0
 public void testValuesEntry_INT16()
 {
     valuesEntry = unisens.createValuesEntry("ve_int16.csv", new String[] { "a", "b" }, DataType.INT16, 400);
     valuesEntry.setName("Values int 16");
     valuesEntry.append(int16);
     assertValueList(int16, valuesEntry.read(5));
 }
Esempio n. 5
0
 public void testValuesEntry_XML_DOUBLE()
 {
     valuesEntry = unisens.createValuesEntry("ve_double.xml", new String[] { "a", "b" }, DataType.DOUBLE, 400);
     valuesEntry.setFileFormat(new XmlFileFormatImpl());
     valuesEntry.append(double64);
     assertValueList(double64, valuesEntry.read(5));
 }
Esempio n. 6
0
 public void testValuesEntry_XML_INT32()
 {
     valuesEntry = unisens.createValuesEntry("ve_int32.xml", new String[] { "a", "b" }, DataType.INT32, 400);
     valuesEntry.setFileFormat(new XmlFileFormatImpl());
     valuesEntry.append(int32);
     assertValueList(int32, valuesEntry.read(5));
 }
Esempio n. 7
0
        private void valuesCsv()
        {
            UnisensFactory uf  = UnisensFactoryBuilder.createFactory();
            Unisens        u   = uf.createUnisens("C:\\TestData");
            ValuesEntry    ve  = u.createValuesEntry("values.csv", new String[] { "A", "B" }, DataType.INT16, 250);
            CsvFileFormat  cff = ve.createCsvFileFormat();

            cff.setSeparator(";");
            cff.setDecimalSeparator(".");
            ve.setFileFormat(cff);
            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();
            u.closeAll();
        }
Esempio n. 8
0
 public void testValuesEntry_BIN_UINT32()
 {
     valuesEntry = unisens.createValuesEntry("ve_uint32.bin", new String[] { "a", "b" }, DataType.UINT32, 400);
     valuesEntryBinFileFormat = new BinFileFormatImpl();
     valuesEntryBinFileFormat.setEndianess(Endianess.LITTLE);
     valuesEntry.setFileFormat(valuesEntryBinFileFormat);
     valuesEntry.append(uint32);
     assertValueList(uint32, valuesEntry.read(5));
 }
Esempio n. 9
0
 public void testValuesEntry_INT32()
 {
     valuesEntry = unisens.createValuesEntry("ve_int32.csv", new String[] { "a", "b" }, DataType.INT32, 400);
     valuesEntry.append(int32);
     assertValueList(int32, valuesEntry.read(5));
 }
Esempio n. 10
0
 public void testValuesEntry_DOUBLE()
 {
     valuesEntry = unisens.createValuesEntry("ve_double.csv", new String[] { "a", "b" }, DataType.DOUBLE, 400);
     valuesEntry.append(double64);
     assertValueList(double64, valuesEntry.read(5));
 }