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