private IEnumerable<SeekPositionItem> GetSeekPoints(Item item, int numPoints) { var nextChapterIndex = 1; var nextChapter = Chapters.Count > nextChapterIndex ? Chapters[nextChapterIndex] : null; for (var i = 0; i <= numPoints; i++) { var pos = RunTimeTicks/numPoints*i; var seek = new SeekPositionItem(pos, item); if (nextChapter != null && pos >= nextChapter.PositionTicks) { seek.PositionTicks = nextChapter.PositionTicks; seek.ChapterIndex = nextChapterIndex; nextChapterIndex++; nextChapter = Chapters.Count > nextChapterIndex ? Chapters[nextChapterIndex] : null; } yield return seek; } }
private IEnumerable<SeekPositionItem> GetSeekPoints(Item item, int numPoints) { var nextChapterIndex = 1; var nextChapter = Chapters.Count > nextChapterIndex ? Chapters[nextChapterIndex] : null; for (var i = 0; i <= numPoints; i++) { var pos = RunTimeTicks/numPoints*i; var seek = new SeekPositionItem(pos, item); if (nextChapter != null && pos >= nextChapter.PositionTicks) { seek.PositionTicks = nextChapter.PositionTicks; seek.ChapterIndex = nextChapterIndex; nextChapterIndex++; nextChapter = Chapters.Count > nextChapterIndex ? Chapters[nextChapterIndex] : null; } yield return seek; } }