/// <summary> /// Sets the chapter to play. /// </summary> /// <param name="chapter">Chapter name</param> public override void SetChapter(string chapter) { string[] chapters = Chapters; for (int i = 0; i < chapters.Length; i++) { if (chapter == chapters[i]) { _dvdCtrl.PlayChapter(i + 1, DvdCmdFlags.Flush, out _cmdOption); return; } } }
void TestPlayChapter() { int hr; IDvdCmd ppCmd; DvdPlaybackLocation2 pLocation; AllowPlay(); hr = m_idc2.PlayChapterInTitle(1, 2, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd); DsError.ThrowExceptionForHR(hr); Thread.Sleep(2000); hr = m_idc2.PlayChapter(1, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd); DsError.ThrowExceptionForHR(hr); hr = m_idi2.GetCurrentLocation(out pLocation); DsError.ThrowExceptionForHR(hr); hr = m_idc2.Stop(); DsError.ThrowExceptionForHR(hr); Debug.Assert(pLocation.TitleNum == 1, "TestPlayChapter"); Debug.Assert(pLocation.ChapterNum == 1, "TestPlayChapter2"); }