本文整理汇总了C#中Record.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# Record.Seek方法的具体用法?C# Record.Seek怎么用?C# Record.Seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record.Seek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeekTest
public void SeekTest()
{
// Testing On Signal's Samples
using (var record = new Record("data/100s"))
{
record.Open();
var expectedSignal1Samples0 = record[0].ReadNext(10); // read 10 samples of the first 10
var expectedSignal2Samples0 = record[1].ReadNext(10); // read 10 samples of the first 10
record.Signals.First().Seek(10); // advance the 1st pointer by ten samples
var expectedSignal1Samples10 = record[0].ReadNext(10); // read 10 samples after the first 10 samples
record.Signals.Skip(1).First().Seek(10); // advance the 1st pointer by ten samples
var expectedSignal2Samples10 = record[1].ReadNext(10); // read 10 samples after the first 10 samples
record.Seek(0);
Assert.AreEqual(expectedSignal1Samples0, record[0].ReadNext(10));
Assert.AreEqual(expectedSignal2Samples0, record[1].ReadNext(10));
record.Seek(10);
Assert.AreEqual(expectedSignal1Samples10, record[0].ReadNext(10));
Assert.AreEqual(expectedSignal2Samples10, record[1].ReadNext(10));
}
}
示例2: UsingWfdbClasses
private static void UsingWfdbClasses(int frequency)
{
try
{
Frequency f = frequency;
Time t = 0, t0 = 0, t1 = 0;
using (var record = new Record("data/100s"))
{
record.Open();
if (f <= 0)
f = record.SamplingFrequency;
Frequency.InputFrequency = f;
t0 = Time.Parse("1");
record.Seek(t);
t1 = Time.Parse("2");
for (t = t0; t <= t1; t++)
{
Console.WriteLine("{0}\t{1}", record[0].ReadNext(), record[1].ReadNext());
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}