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)
75
75
}
76
76
return "" ;
77
77
}
78
+
78
79
/// <summary>
79
80
/// Returns a Bitmap of the album cover in the provided size asynchronous
80
81
/// </summary>
@@ -95,6 +96,24 @@ public async Task<Bitmap> GetAlbumArtAsync(AlbumArtSize size)
95
96
}
96
97
}
97
98
}
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
+
98
117
/// <summary>
99
118
/// Returns a Bitmap of the album cover in the provided size
100
119
/// </summary>
@@ -115,5 +134,22 @@ public Bitmap GetAlbumArt(AlbumArtSize size)
115
134
}
116
135
}
117
136
}
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
+ }
118
154
}
119
155
}
You can’t perform that action at this time.
0 commit comments