Esempio n. 1
0
        public async Task<ImportPlaylistResult> ImportPlaylistsAsync(IList<string> fileNames)
        {
            ImportPlaylistResult finalResult = ImportPlaylistResult.Success;

            this.watcher.Suspend(); // Stop watching the playlist folder

            IList<ImportPlaylistResult> results = new List<ImportPlaylistResult>();

            foreach (string fileName in fileNames)
            {
                if (FileFormats.IsSupportedStaticPlaylistFile(fileName))
                {
                    results.Add(await this.ImportStaticPlaylistAsync(fileName));
                }
                else if (FileFormats.IsSupportedSmartPlaylistFile(fileName))
                {
                    results.Add(await this.ImportSmartPlaylistAsync(fileName));
                }
            }

            this.watcher.Resume(); // Start watching the playlist folder


            if (results.Any(x => x.Equals(ImportPlaylistResult.Success)))
            {
                this.PlaylistFolderChanged(this, new EventArgs());
            }

            return finalResult;
        }
        private async Task ImportDroppedSmartPlaylistFiles(IDropInfo dropInfo)
        {
            IList <string> allFilenames      = dropInfo.GetDroppedFilenames();
            IList <string> playlistFileNames = allFilenames.Select(f => f).Where(f => FileFormats.IsSupportedSmartPlaylistFile(f)).ToList();

            await this.ImportPlaylistsAsync(playlistFileNames);
        }