Пример #1
0
        public override bool Play(string strFile)
        {
            _isCDA = false;
            if (strFile.IndexOf(".cda") >= 0)
            {
                string strTrack = "";
                int    pos      = strFile.IndexOf(".cda");
                if (pos >= 0)
                {
                    pos--;
                    while (Char.IsDigit(strFile[pos]) && pos > 0)
                    {
                        strTrack = strFile[pos] + strTrack;
                        pos--;
                    }
                }

                string strDrive = strFile.Substring(0, 1);
                strDrive += ":";
                strFile   = String.Format("{0}Track{1}.cda", strDrive, strTrack);
                _isCDA    = true;
            }

            m_winampController = new WinampController();
            m_bStoppedManualy  = false;
            if (m_winampController != null)
            {
                // stop other media which might be active until now.
                if (g_Player.Playing)
                {
                    g_Player.Stop();
                }

                m_strCurrentFile = strFile;
                m_winampController.ClearPlayList();
                m_winampController.Volume = m_volume;
                m_winampController.AppendToPlayList(strFile);
                m_winampController.Play();
                _notifyPlaying = true;
                return(true);
            }

            _notifyPlaying = false;
            return(false);
        }
Пример #2
0
    public override bool Play(string strFile)
    {
      _isCDA = false;
      if (strFile.IndexOf(".cda") >= 0)
      {
        string strTrack = "";
        int pos = strFile.IndexOf(".cda");
        if (pos >= 0)
        {
          pos--;
          while (Char.IsDigit(strFile[pos]) && pos > 0)
          {
            strTrack = strFile[pos] + strTrack;
            pos--;
          }
        }

        string strDrive = strFile.Substring(0, 1);
        strDrive += ":";
        strFile = String.Format("{0}Track{1}.cda", strDrive, strTrack);
        _isCDA = true;
      }

      m_winampController = new WinampController();
      m_bStoppedManualy = false;
      if (m_winampController != null)
      {
        // stop other media which might be active until now.
        if (g_Player.Playing)
        {
          g_Player.Stop();
        }

        m_strCurrentFile = strFile;
        m_winampController.ClearPlayList();
        m_winampController.Volume = m_volume;
        m_winampController.AppendToPlayList(strFile);
        m_winampController.Play();
        _notifyPlaying = true;
        return true;
      }

      _notifyPlaying = false;
      return false;
    }