예제 #1
0
        public static Uri GetBestArtworkSoruce(this ArtworkInfo artworkInfo)
        {
            Uri uri     = artworkInfo.MediaSource;
            var appData = new AppData(artworkInfo.LocalArtworkPath, FolderLocation.Local);

            if (appData.CheckFileExists())
            {
                return(new Uri(appData.FullPath));
            }
            return(uri);
        }
예제 #2
0
        public async static void SaveToFile(this ArtworkInfo artworkInfo, string FileName = null)
        {
            if (string.IsNullOrWhiteSpace(FileName))
            {
                FileName = Guid.NewGuid().ToString().ToLower();
            }
            FileName = FileName.ToSafeWindowsNameString() + Path.GetExtension(artworkInfo.MediaSource.GetAbsoluteFileName());
            var appData  = new AppData(FileName, FolderLocation.Local);
            var filePath = await appData.SaveToFileAsync(artworkInfo.MediaBytes, CreationCollisionOption.ReplaceExisting);

            artworkInfo.LocalArtworkPath = FileName;
        }