private static void CheckOneChannelData <T>(DATReader parser, ChannelHeader channel, int startIndex, int length) where T : IConvertible { var values = parser.GetChannelData <T>(channel).ToList(); var partialReadValues = parser.GetChannelData <T>(channel, (uint)startIndex, (uint)length).ToList(); Assert.Equal(values, partialReadValues); Assert.Equal(channel.MaximumValue, values.Max().ToDouble(NumberFormatInfo.InvariantInfo)); Assert.Equal(channel.MinimumValue, values.Min().ToDouble(NumberFormatInfo.InvariantInfo)); Shared.CheckOneChannelDataCommon(channel, values); }
public static void MinimalExample() { using (var parser = new DATReader(Shared.DAT_File_Path)) { // global header including: title, author, etc. GlobalHeader header = parser.GetGlobalHeader() as GlobalHeader; // channel header: channel-name, data-file location, datatype, min, max IEnumerable <ChannelHeader> headers = parser.GetChannelHeaders().Cast <ChannelHeader>(); // parses the actual channel data double[] data = parser.GetChannelData <double>(headers.First()).ToArray(); Assert.NotEmpty(data); } }