Fix closure removal in Download.cs
This commit is contained in:
@@ -21,7 +21,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static string FormatErrorMessage(Exception e)
|
public static string FormatErrorMessage(Exception e)
|
||||||
{
|
{
|
||||||
var ex = e as System.Net.WebException;
|
var ex = e as WebException;
|
||||||
if (ex == null)
|
if (ex == null)
|
||||||
return e.Message;
|
return e.Message;
|
||||||
|
|
||||||
@@ -46,15 +46,15 @@ namespace OpenRA
|
|||||||
wc.DownloadProgressChanged += (_, a) => onProgress(a);
|
wc.DownloadProgressChanged += (_, a) => onProgress(a);
|
||||||
wc.DownloadFileCompleted += (_, a) => onComplete(a, cancelled);
|
wc.DownloadFileCompleted += (_, a) => onComplete(a, cancelled);
|
||||||
|
|
||||||
Game.OnQuit += () => Cancel();
|
Game.OnQuit += Cancel;
|
||||||
wc.DownloadFileCompleted += (_, a) => { Game.OnQuit -= () => Cancel(); };
|
wc.DownloadFileCompleted += (_, a) => { Game.OnQuit -= Cancel; };
|
||||||
|
|
||||||
wc.DownloadFileAsync(new Uri(url), path);
|
wc.DownloadFileAsync(new Uri(url), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cancel()
|
public void Cancel()
|
||||||
{
|
{
|
||||||
Game.OnQuit -= () => Cancel();
|
Game.OnQuit -= Cancel;
|
||||||
wc.CancelAsync();
|
wc.CancelAsync();
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user