File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ public String GetAlbumArtUrl(AlbumArtSize size)
7575 }
7676 return "" ;
7777 }
78+
7879 /// <summary>
7980 /// Returns a Bitmap of the album cover in the provided size asynchronous
8081 /// </summary>
@@ -95,6 +96,24 @@ public async Task<Bitmap> GetAlbumArtAsync(AlbumArtSize size)
9596 }
9697 }
9798 }
99+
100+ /// <summary>
101+ /// Returns a byte[] of the the album cover in the provided size asynchronous
102+ /// </summary>
103+ /// <param name="size">AlbumArtSize (160,320,640)</param>
104+ /// <returns>A byte[], which is the albumart in binary data</returns>
105+ public async Task < byte [ ] > GetAlbumArtAsByteArrayAsync ( AlbumArtSize size )
106+ {
107+ using ( WebClient wc = new WebClient ( ) )
108+ {
109+ wc . Proxy = null ;
110+ String url = GetAlbumArtUrl ( size ) ;
111+ if ( url == "" )
112+ return null ;
113+ return await wc . DownloadDataTaskAsync ( url ) ;
114+ }
115+ }
116+
98117 /// <summary>
99118 /// Returns a Bitmap of the album cover in the provided size
100119 /// </summary>
@@ -115,5 +134,22 @@ public Bitmap GetAlbumArt(AlbumArtSize size)
115134 }
116135 }
117136 }
137+
138+ /// <summary>
139+ /// Returns a byte[] of the album cover in the provided size
140+ /// </summary>
141+ /// <param name="size">AlbumArtSize (160,320,640)</param>
142+ /// <returns>A byte[], which is the albumart in binary data</returns>
143+ public byte [ ] GetAlbumArtAsByteArray ( AlbumArtSize size )
144+ {
145+ using ( WebClient wc = new WebClient ( ) )
146+ {
147+ wc . Proxy = null ;
148+ String url = GetAlbumArtUrl ( size ) ;
149+ if ( url == "" )
150+ return null ;
151+ return wc . DownloadData ( url ) ;
152+ }
153+ }
118154 }
119155}
You can’t perform that action at this time.
0 commit comments