public static int GetTotalSampleCount(string file) { using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read)) { int count = 0; while (stream.Position < stream.Length) { var dss = MsgPackSerializer.Deserialize(stream); count += dss.SampleCount; } return(count); } }
protected override void BeginProcessing() { var path = IO.GetAbsolutePath(this, Path); using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read)) { for (var i = 0; i < TotalCount; ++i) { var dss = MsgPackSerializer.Deserialize(stream); WriteObject(dss); if (stream.Length == stream.Position) { break; } } } }