Download failure error.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -33,6 +34,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[FluentReference]
|
[FluentReference]
|
||||||
const string UnknownHost = "label-unknown-host";
|
const string UnknownHost = "label-unknown-host";
|
||||||
|
|
||||||
|
[FluentReference]
|
||||||
|
const string DownloadFailed = "label-download-failed";
|
||||||
|
|
||||||
[FluentReference("host", "received", "suffix")]
|
[FluentReference("host", "received", "suffix")]
|
||||||
const string DownloadingFrom = "label-downloading-from";
|
const string DownloadingFrom = "label-downloading-from";
|
||||||
|
|
||||||
@@ -181,6 +185,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
|
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
OnError(FluentProvider.GetString(DownloadFailed));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.ReadWrite, 8192, true))
|
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.ReadWrite, 8192, true))
|
||||||
{
|
{
|
||||||
await response.ReadAsStreamWithProgress(fileStream, OnDownloadProgress, token);
|
await response.ReadAsStreamWithProgress(fileStream, OnDownloadProgress, token);
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ label-fetching-mirror-list = Fetching list of mirrors...
|
|||||||
label-downloading-from = Downloading from { $host } { $received } { $suffix }
|
label-downloading-from = Downloading from { $host } { $received } { $suffix }
|
||||||
label-downloading-from-progress = Downloading from { $host } { $received } / { $total } { $suffix } ({ $progress }%)
|
label-downloading-from-progress = Downloading from { $host } { $received } / { $total } { $suffix } ({ $progress }%)
|
||||||
label-unknown-host = unknown host
|
label-unknown-host = unknown host
|
||||||
|
label-download-failed = Download failed
|
||||||
label-verifying-archive = Verifying archive...
|
label-verifying-archive = Verifying archive...
|
||||||
label-archive-validation-failed = Archive validation failed
|
label-archive-validation-failed = Archive validation failed
|
||||||
label-extracting-archive = Extracting...
|
label-extracting-archive = Extracting...
|
||||||
|
|||||||
Reference in New Issue
Block a user