/// <summary> /// Установить текущую главу по наименованию /// </summary> /// <param name="chapterCaption"></param> /// <param name="saveOnDisk"></param> public void SetCurrentChapterByCaption([NotNull] string chapterCaption, bool saveOnDisk) { RuntimeEnvironment.ChapterSelected = true; _currentChapter = Chapters.FirstOrDefault(x => x.Caption == chapterCaption) ?? Chapters.First(); if (saveOnDisk) { Helpers.WriteDiscContent(TestsManager.CURRENT_CHAPTER_FILE, chapterCaption); } }
public void RemovePaddingChapters() { if (Chapters.FirstOrDefault()?.IsPaddingChapter ?? false) { Chapters.RemoveAt(0); } if (Chapters.LastOrDefault()?.IsPaddingChapter ?? false) { Chapters.RemoveAt(Chapters.Count - 1); } }
public Chapter GetChapterByTitle(string title) { Chapter chapter = Chapters.FirstOrDefault(c => c.Title == title); return(chapter); }
public Chapter GetChapterById(int id) { Chapter chapter = Chapters.FirstOrDefault(c => c.ID == id); return(chapter); }