/// <summary> /// Changes the position of a Chapter by the ChapterPositionShiftValue /// </summary> /// <param name="index">Index of the Chapter to shift</param> /// <param name="shiftType">Whether to shift the position backwards or forwards</param> /// <param name="modifier"></param> public void ChangeChapterPosition(int index, ShiftChapterPositionType shiftType, double modifier) { if (index < 0 || index > Track.ChapterList.Count - 1) { return; } Chapter chapterToChange = Track.ChapterList[index]; int shiftAmount = 0; switch (shiftType) { case ShiftChapterPositionType.Forwards: shiftAmount = Convert.ToInt32(Settings.Default.ChapterPositionShiftValue.TotalMilliseconds * modifier); break; case ShiftChapterPositionType.Backwards: shiftAmount = -Convert.ToInt32(Settings.Default.ChapterPositionShiftValue.TotalMilliseconds * modifier); break; default: throw new ArgumentOutOfRangeException(nameof(shiftType), shiftType, null); } Track.ChapterList.ChangeChapter(chapterToChange, chapterToChange.Position + shiftAmount); _api.Player_SetPosition(chapterToChange.Position); }