// renames the current trackimage from the selection list and deletes old ones and it's thumbnail // from disk public void CheckRenameArt() { string FilePath = _artfullpath; string ThumbFilePath = _thumbfullpath; // delete thumbnail if (ThumbFilePath.Trim().Length > 0) { FileInfo thumbFile = new FileInfo(ThumbFilePath); if (thumbFile.Exists) { try { string newname = GenerateName(ThumbFilePath); thumbFile.CopyTo(newname); thumbFile.Delete(); _thumbfullpath = newname; } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) { throw e; } } } } StringList temp = new StringList(); foreach (string str in AlternateArts) { FileInfo File = new FileInfo(str); if (File.Exists) { try { string newname = GenerateName(str); File.CopyTo(newname); File.Delete(); temp.Add(newname); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) { throw e; } } } } if (temp.Count > 0) { AlternateArts.Clear(); AlternateArts.AddRange(temp); _artfullpath = AlternateArts[0]; commitNeeded = true; } }
// Attempts to load track art for this Basic from a given URL. Optionally // ignores minimum resolution restrictions public ImageLoadResults AddArtFromURL(string url, bool ignoreRestrictions) { ImageLoadResults status; BasicArt newBasic = BasicArt.FromUrl(this, url, ignoreRestrictions, out status); if (status != ImageLoadResults.SUCCESS && status != ImageLoadResults.SUCCESS_REDUCED_SIZE) { return(status); } AlternateArts.Add(newBasic.Filename); GenerateThumbnail(); commitNeeded = true; return(ImageLoadResults.SUCCESS); }
// rotates the selected track art to the previous available track public void PreviousArt() { if (AlternateArts.Count <= 1) { return; } int index = AlternateArts.IndexOf(ArtFullPath) - 1; if (index < 0) { index = AlternateArts.Count - 1; } ArtFullPath = AlternateArts[index]; commitNeeded = true; }
// rotates the selected track art to the next available track public void NextArt() { if (AlternateArts.Count <= 1) { return; } int index = AlternateArts.IndexOf(ArtFullPath) + 1; if (index >= AlternateArts.Count) { index = 0; } ArtFullPath = AlternateArts[index]; commitNeeded = true; }
// removes the current trackimage from the selection list and deletes it and it's thumbnail // from disk public void DeleteCurrentArt() { string FilePath = ArtFullPath; string ThumbFilePath = ArtThumbFullPath; // delete thumbnail if (ThumbFilePath.Trim().Length > 0) { FileInfo thumbFile = new FileInfo(ThumbFilePath); if (thumbFile.Exists) { try { thumbFile.Delete(); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) { throw e; } } } } // If using a custom artwork folder then dont delete the artwork.... if ((ArtFullPath.Contains(mvCentralCore.Settings.CustomArtistArtFolder) && mvCentralCore.Settings.SearchCustomFolderForArtistArt) || (ArtFullPath.Contains(mvCentralCore.Settings.CustomAlbumArtFolder) && mvCentralCore.Settings.SearchCustomFolderForAlbumArt) || (ArtFullPath.Contains(mvCentralCore.Settings.CustomTrackArtFolder) && mvCentralCore.Settings.SearchCustomFolderForTrackArt)) { ArtFullPath = ""; AlternateArts.Remove(FilePath); commitNeeded = true; return; } // delete trackimage if (FilePath.Trim().Length > 0) { FileInfo File = new FileInfo(FilePath); if (File.Exists) { try { File.Delete(); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) { throw e; } } } } ArtFullPath = ""; AlternateArts.Remove(FilePath); commitNeeded = true; }