예제 #1
0
 private void loadPods()
 {
     podPlayList = new List <string>();
     if (Directory.Exists(configWindow.podPathTextBox.Text))
     {
         List <String> pl = new List <string>(FindFiles.FileSystemEnumerator(configWindow.podPathTextBox.Text, "*.mp3", SearchOption.AllDirectories));
         podsFoundCount = pl.Count;
         // suffle the podcasts
         pl = new List <String>(pl.OrderBy(item => rand.Next()));
         for (int ri = 0; ri < MAX_REPEATS; ri++)
         {
             foreach (String pc in pl)
             {
                 int rep = 0;
                 if (podsHeard != null)
                 {
                     foreach (string ph in podsHeard)
                     {
                         String[] tn = ph.Split(podsHeardSeperator);
                         if (tn[0].Equals(pc))
                         {
                             if (tn.Contains("DELETE"))
                             {
                                 rep = -1;  // this one due for deletion
                                 if (ri == 0 && rep == 0)
                                 {
                                     podsFoundCount--;
                                 }
                                 break;
                             }
                             if (ri == 0 && rep == 0 && podPlayList.Contains(ph))
                             {
                                 podsHeardCount++;
                             }
                             rep++;
                         }
                     }
                 }
                 if (rep < 0 || rep != ri)
                 {
                     continue;
                 }
                 podPlayList.Add(pc);
             }
         }
     }
 }