예제 #1
0
        /// <summary>
        /// Initializes the cdg library
        /// </summary>
        /// <param name="playlistItem"></param>
        private void InitializeCdgLibrary(PlaylistItem playlistItem)
        {
            IntPtr applicationHandle  = new WindowInteropHelper(Application.Current.MainWindow).Handle;
            IntPtr parentWindowHandle = new WindowInteropHelper(_videoPlayerWindow).Handle;

            string mp3FilePath = playlistItem.Song.FilePath;
            string cdgFilePath = playlistItem.Song.CdgFilePath;

            if (playlistItem.Song.Extension.Equals("zip"))
            {
                _zipFileHelper = new ZipFileHelper();
                Song tmpUnzippedSong = _zipFileHelper.ExtractFileTemporarily(mp3FilePath);
                mp3FilePath = tmpUnzippedSong.FilePath;
                cdgFilePath = tmpUnzippedSong.CdgFilePath;
            }

            _cdgLibDllHandle = CdgLibraryWrapper.CDGPlayerOpenExt(applicationHandle,
                                                                  cdgFilePath,
                                                                  parentWindowHandle,
                                                                  0);

            _videoPlayerWindow.VideoPlayer.Source = new Uri(mp3FilePath);

            _cdgWindowHeight = _videoPlayerWindow.Height;
            _cdgWindowWidth  = _videoPlayerWindow.Width;
            CdgLibraryWrapper.CDGPlayerHeightSet(_cdgLibDllHandle, (int)_cdgWindowHeight);
            CdgLibraryWrapper.CDGPlayerWidthSet(_cdgLibDllHandle, (int)_cdgWindowWidth);
        }
예제 #2
0
 /// <summary>
 /// Parses the given lists of video files and adds them to the library
 /// </summary>
 /// <param name="zipFiles"></param>
 /// <param name="extension">file extension</param>
 /// <param name="songsInLibrary">list is filled within this method</param>
 private static void ParseZipFiles(IEnumerable <string> zipFiles, string extension, ObservableCollection <Song> songsInLibrary)
 {
     foreach (string zipFilePath in zipFiles)
     {
         using (ZipFileHelper zipFileHelper = new ZipFileHelper())
         {
             Song zipFileSong = new Song {
                 FilePath = zipFilePath, Extension = extension
             };
             Song tmpSong = zipFileHelper.ExtractFileTemporarily(zipFilePath);
             if (string.IsNullOrEmpty(tmpSong.FilePath) == false &&
                 string.IsNullOrEmpty(tmpSong.CdgFilePath) == false)
             {
                 ParseArtistAndTitle(tmpSong.FilePath, zipFileSong);
                 songsInLibrary.Add(zipFileSong);
             }
         }
     }
 }