Changed web client instances to dispose after use.

This commit is contained in:
streibeb 2015-01-02 17:49:39 -06:00
parent 3cf603b1ad
commit 6410c28594

View File

@ -137,9 +137,11 @@ namespace SpotifyAPI.SpotifyLocalAPI
try try
{ {
//Need to find a better solution //Need to find a better solution
var wc = new ExtendedWebClientInstance(); using (var wc = new ExtendedWebClientInstance())
if (SpotifyLocalAPIClass.IsSpotifyRunning()) {
response = "[ " + wc.DownloadString(a) + " ]"; if (SpotifyLocalAPIClass.IsSpotifyRunning())
response = "[ " + wc.DownloadString(a) + " ]";
}
} }
catch (Exception z) catch (Exception z)
{ {
@ -177,9 +179,11 @@ namespace SpotifyAPI.SpotifyLocalAPI
try try
{ {
//Need to find a better solution //Need to find a better solution
var wc = new ExtendedWebClientInstance(); using (var wc = new ExtendedWebClientInstance())
if (SpotifyLocalAPIClass.IsSpotifyRunning()) {
response = "[ " + await wc.DownloadStringTaskAsync(new Uri(a)) + " ]"; if (SpotifyLocalAPIClass.IsSpotifyRunning())
response = "[ " + await wc.DownloadStringTaskAsync(new Uri(a)) + " ]";
}
} }
catch (Exception ex) catch (Exception ex)
{ {