public void WriteAndReadOneString() { try { string[] str = new[] { "test" }; string filename = Path.Combine(folder, "testOneStringList.H5"); // Open file and write the strings var fileId = Hdf5.CreateFile(filename); Assert.IsTrue(fileId > 0); Hdf5.WriteStrings(fileId, "/test", str); // Read the strings and close file Assert.IsTrue(fileId > 0); IEnumerable <string> strs2 = Hdf5.ReadStrings(fileId, "/test", "").result; Assert.IsTrue(strs2.Count() == 1); foreach (var s in strs2) { Assert.IsTrue(str[0] == s); } ; Hdf5.CloseFile(fileId); } catch (Exception ex) { CreateExceptionAssert(ex); } }
public void WriteAndReadListOfStrings() { try { List <string> strs = new List <string>(); strs.Add("t"); strs.Add("tst"); strs.Add("test1"); strs.Add("small test"); string filename = Path.Combine(folder, "testStringList.H5"); // Open file and write the strings var fileId = Hdf5.CreateFile(filename); Assert.IsTrue(fileId > 0); Hdf5.WriteStrings(fileId, "/test", strs); // Read the strings and close file Assert.IsTrue(fileId > 0); IEnumerable <string> strs2 = Hdf5.ReadStrings(fileId, "/test"); Assert.IsTrue(strs.Count() == strs2.Count()); foreach (var item in strs2.Select((str, i) => new { i, str })) { Assert.IsTrue(item.str == strs[item.i]); } Hdf5.CloseFile(fileId); } catch (Exception ex) { CreateExceptionAssert(ex); } }
public void AppendEcgCycleDescriptionSample(ECGCycleDescription e) { Hdf5.WriteStrings(GroupId, "ecg_cycle_description", new List <string> { e.AsJson() }); }