示例#1
0
 public PlaylistInfo CreateNewShuffle(Playlist playlist)
 {
     int[] order = Enumerable.Range(0, playlist.Tracks.Count).OrderBy(x => this.random.Next()).ToArray();
     var info = new PlaylistInfo()
     {
         ShuffleOrder = order,
         CurrentIndex = 0,
     };
     this.shuffles[playlist.Name] = info;
     this.Save();
     return info;
 }
示例#2
0
 public PlaylistInfo GetInfo(Playlist playlist)
 {
     PlaylistInfo order;
     if (this.shuffles.TryGetValue(playlist.Name, out order))
     {
         if (order.ShuffleOrder.Length == playlist.Tracks.Count)
         {
             return order;
         }
     }
     return this.CreateNewShuffle(playlist);
 }