dispose res properly
This commit is contained in:
@@ -210,12 +210,13 @@ namespace OpenRA
|
|||||||
// Request the filename from the server
|
// Request the filename from the server
|
||||||
// Run in a worker thread to avoid network delays
|
// Run in a worker thread to avoid network delays
|
||||||
var mapUrl = Game.Settings.Game.MapRepository + Uid;
|
var mapUrl = Game.Settings.Game.MapRepository + Uid;
|
||||||
|
var mapPath = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = WebRequest.Create(mapUrl);
|
var request = WebRequest.Create(mapUrl);
|
||||||
request.Method = "HEAD";
|
request.Method = "HEAD";
|
||||||
var res = request.GetResponse();
|
using (var res = request.GetResponse())
|
||||||
|
{
|
||||||
// Map not found
|
// Map not found
|
||||||
if (res.Headers["Content-Disposition"] == null)
|
if (res.Headers["Content-Disposition"] == null)
|
||||||
{
|
{
|
||||||
@@ -223,7 +224,8 @@ namespace OpenRA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapPath = Path.Combine(baseMapPath, res.Headers["Content-Disposition"].Replace("attachment; filename = ", ""));
|
mapPath = Path.Combine(baseMapPath, res.Headers["Content-Disposition"].Replace("attachment; filename = ", ""));
|
||||||
|
}
|
||||||
|
|
||||||
Action<DownloadProgressChangedEventArgs> onDownloadProgress = i => { DownloadBytes = i.BytesReceived; DownloadPercentage = i.ProgressPercentage; };
|
Action<DownloadProgressChangedEventArgs> onDownloadProgress = i => { DownloadBytes = i.BytesReceived; DownloadPercentage = i.ProgressPercentage; };
|
||||||
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user