Example #1
0
        // Extracts simple meta data from the path and fills a new AudioFile
        // information about the audio source. If it fails in the downloader or here,
        // we simply return null.
        private async Task <AudioFile> GetAudioFileAsync(string path)
        {
            try // We put this in a try catch block.
            {
                AudioFile song = await m_AudioDownloader.GetAudioFileInfo(path);

                if (song != null) // We check for a local available version.
                {
                    string filename = m_AudioDownloader.GetItem(song.Title);
                    if (filename != null) // We found a local version.
                    {
                        song.FileName     = filename;
                        song.IsNetwork    = false; // Network is now false.
                        song.IsDownloaded = true;
                    }
                }
                return(song);
            }
            catch
            {
                return(null);
            }
        }