예제 #1
0
        public OggFile GetPrevFile()
        {
            if (m_FileHeap == null)
            {
                return(null);
            }
            if (m_FileHeap.Count <= 0)
            {
                return(null);
            }
            if (m_PreviousFile == null)
            {
                return(null);
            }
            OggPlaylistFile tmp = m_CurrentFile;

            m_CurrentFile  = m_PreviousFile;
            m_PreviousFile = tmp;
            if (m_AutoUncache)
            {
                if (m_PreviousFile != null)
                {
                    m_PreviousFile.UnCacheFile();
                }
            }
            m_Position = m_FileHeap.IndexOf(m_CurrentFile);
            if (!m_CurrentFile.Cached)
            {
                m_CurrentFile.CacheFile();
            }
            return(m_CurrentFile.File);
        }
예제 #2
0
 // Constructor
 public OggPlaylist()
 {
     m_FileHeap        = new ArrayList();
     m_CurrentFile     = null;
     m_Position        = 0;
     m_AutoOrder       = true;
     m_Random          = false;
     m_RandomGenerator = new Random();
     m_Repeat          = false;
 }
예제 #3
0
        private bool m_Repeat; // Whether the playlist should repeat

        #endregion Fields

        #region Constructors

        // Constructor
        public OggPlaylist()
        {
            m_FileHeap = new ArrayList();
            m_CurrentFile = null;
            m_Position = 0;
            m_AutoOrder = true;
            m_Random = false;
            m_RandomGenerator = new Random();
            m_Repeat = false;
        }
예제 #4
0
 /// <summary>
 /// Remove a file from the Playlist
 /// </summary>
 /// <param name="Item">
 /// The <see cref="OggPlaylistFile"/> to remove
 /// </param>
 public void Remove(OggPlaylistFile Item)
 {
     if (m_FileHeap == null)
     {
         return;
     }
     m_FileHeap.Remove(Item);
     if (m_AutoOrder)
     {
         m_FileHeap.Sort();
     }
 }
예제 #5
0
 /// <summary>
 /// Retrieves the next file for playback & advance the internal pointers
 /// </summary>
 /// <returns>
 /// A <see cref="OggFile"/>
 /// </returns>
 public OggFile GetNextFile()
 {
     if (m_FileHeap == null)
     {
         return(null);
     }
     if (m_FileHeap.Count <= 0)
     {
         return(null);
     }
     m_PreviousFile = m_CurrentFile;
     if (m_AutoUncache)
     {
         if (m_PreviousFile != null)
         {
             m_PreviousFile.UnCacheFile();
         }
     }
     if (m_Random)
     {
         m_Position = m_RandomGenerator.Next(m_FileHeap.Count - 1);
     }
     else
     {
         m_Position++;
         if (m_Position >= m_FileHeap.Count)
         {
             if (m_Repeat)
             {
                 m_Position = 0;
             }
             else
             {
                 return(null);
             }
         }
     }
     m_CurrentFile        = (OggPlaylistFile)m_FileHeap[m_Position];
     m_CurrentFile.Played = true;
     if (!m_CurrentFile.Cached)
     {
         m_CurrentFile.CacheFile();
     }
     return(m_CurrentFile.File);
 }
예제 #6
0
        /// <summary>
        /// Implementation of IComparable.CompareTo interface
        /// </summary>
        int IComparable.CompareTo(object obj)
        {
            if (typeof(object) != typeof(OggPlaylistFile))
            {
                throw new System.InvalidCastException("OggPlaylistFile:CompareTo obj not an OggPlaylistFile");
            }
            OggPlaylistFile tmp = (OggPlaylistFile)obj;

            if (tmp.OrderNum > this.OrderNum)
            {
                return(1);
            }
            if (tmp.OrderNum < this.OrderNum)
            {
                return(-1);
            }
            return(0);
        }
예제 #7
0
 /// <summary>
 /// Remove a file from the Playlist
 /// </summary>
 /// <param name="Item">
 /// The <see cref="OggPlaylistFile"/> to remove
 /// </param>
 public void Remove(OggPlaylistFile Item)
 {
     if (m_FileHeap==null) { return; }
     m_FileHeap.Remove(Item);
     if (m_AutoOrder) { m_FileHeap.Sort(); }
 }
예제 #8
0
 public OggFile GetPrevFile()
 {
     if (m_FileHeap==null) { return null; }
     if (m_FileHeap.Count<=0) { return null; }
     if (m_PreviousFile==null) { return null; }
     OggPlaylistFile tmp = m_CurrentFile;
     m_CurrentFile = m_PreviousFile;
     m_PreviousFile = tmp;
     if (m_AutoUncache) { if (m_PreviousFile!=null) { m_PreviousFile.UnCacheFile(); } }
     m_Position = m_FileHeap.IndexOf(m_CurrentFile);
     if (!m_CurrentFile.Cached) { m_CurrentFile.CacheFile(); }
     return m_CurrentFile.File;
 }
예제 #9
0
 /// <summary>
 /// Retrieves the next file for playback & advance the internal pointers
 /// </summary>
 /// <returns>
 /// A <see cref="OggFile"/>
 /// </returns>
 public OggFile GetNextFile()
 {
     if (m_FileHeap==null) { return null; }
     if (m_FileHeap.Count<=0) { return null; }
     m_PreviousFile = m_CurrentFile;
     if (m_AutoUncache) { if (m_PreviousFile!=null) { m_PreviousFile.UnCacheFile(); } }
     if (m_Random)
     {
         m_Position = m_RandomGenerator.Next(m_FileHeap.Count-1);
     }
     else
     {
         m_Position++;
         if (m_Position >= m_FileHeap.Count)
         {
             if (m_Repeat) { m_Position = 0; } else { return null; }
         }
     }
     m_CurrentFile = (OggPlaylistFile)m_FileHeap[m_Position];
     m_CurrentFile.Played = true;
     if (!m_CurrentFile.Cached) { m_CurrentFile.CacheFile(); }
     return m_CurrentFile.File;
 }