private PlaylistItem indexToItem(int index, Playlist pl) { return index < pl.PlaylistItems.Count ? pl.PlaylistItems[index] : null; }
private void resetShuffle(Playlist pl) { foreach (PlaylistItem pi in pl.PlaylistItems) { pi.Played = false; } }
private int getRandomMove(Playlist pl) { List<int> candidates = new List<int>(); int currIdx = pl.PlaylistItems.IndexOf(mainForm.DataSource.CurrentItem); for (int i = 0; i < pl.PlaylistItems.Count; i++) { if (i != currIdx) candidates.Add(i); } if (candidates.Count > 0) { return candidates[(int)GetRandom(0, candidates.Count)]; } else { return currIdx; } }