Visual Studio NewLine Change

This commit is contained in:
2015-10-31 11:56:27 +01:00
parent 6190a6f0da
commit f9d92de0ab
+39 -34
View File
@@ -41,40 +41,45 @@ namespace MusicPlayer
streamResponse.Close();
streamRead.Close();
return o;
}
public MemoryStream downloadArtwork(string album)
{
try
{
WebRequest req = WebRequest.Create((ip + "/music/artwork/"+album).Replace(" ", "%20"));
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
//Download in chuncks
byte[] buffer = new byte[1024]; //Get Total Size
int dataLength = (int)response.ContentLength;
//Download to memory
MemoryStream memStream = new MemoryStream();
while (true)
{
//Try to read the data
int bytesRead = stream.Read(buffer, 0, buffer.Length);
if (bytesRead == 0)
{
break;
}
else
{ memStream.Write(buffer, 0, bytesRead);
}
} //Clean up
stream.Close();
//Convert the downloaded stream to a byte array
return memStream;
}
catch (Exception)
{ return null;
}
}
public MemoryStream downloadArtwork(string album)
{
try
{
WebRequest req = WebRequest.Create((ip + "/music/artwork/"+album).Replace(" ", "%20"));
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
//Download in chuncks
byte[] buffer = new byte[1024];
//Get Total Size
int dataLength = (int)response.ContentLength;
//Download to memory
MemoryStream memStream = new MemoryStream();
while (true)
{
//Try to read the data
int bytesRead = stream.Read(buffer, 0, buffer.Length);
if (bytesRead == 0)
{
break;
}
else
{
memStream.Write(buffer, 0, bytesRead);
}
}
//Clean up
stream.Close();
//Convert the downloaded stream to a byte array
return memStream;
}
catch (Exception)
{
return null;
}
}
}
}