From 52c7ed99607028bef24a0f13073638866e09931f Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 13 Jun 2019 16:16:48 +0530 Subject: [PATCH 1/2] Add ability to change the flie extension of API download requests --- osu.Game/Online/API/APIDownloadRequest.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIDownloadRequest.cs b/osu.Game/Online/API/APIDownloadRequest.cs index efc832a71e..a8f768553b 100644 --- a/osu.Game/Online/API/APIDownloadRequest.cs +++ b/osu.Game/Online/API/APIDownloadRequest.cs @@ -10,9 +10,18 @@ public abstract class APIDownloadRequest : APIRequest { private string filename; + /// + /// Sets the extension of the file outputted by this request. + /// + protected virtual string FileExtension { get; } = @".tmp"; + protected override WebRequest CreateWebRequest() { - var request = new FileWebRequest(filename = Path.GetTempFileName(), Uri); + var file = Path.GetTempFileName(); + + File.Move(file, filename = Path.ChangeExtension(file, FileExtension)); + + var request = new FileWebRequest(filename, Uri); request.DownloadProgress += request_Progress; return request; } From aa7cae0879be9a0ca5ffb51f9f2af1c9fbab227e Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 13 Jun 2019 16:55:41 +0530 Subject: [PATCH 2/2] Rephrase xmldoc --- osu.Game/Online/API/APIDownloadRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIDownloadRequest.cs b/osu.Game/Online/API/APIDownloadRequest.cs index a8f768553b..940b9b4803 100644 --- a/osu.Game/Online/API/APIDownloadRequest.cs +++ b/osu.Game/Online/API/APIDownloadRequest.cs @@ -11,7 +11,7 @@ public abstract class APIDownloadRequest : APIRequest private string filename; /// - /// Sets the extension of the file outputted by this request. + /// Used to set the extension of the file returned by this request. /// protected virtual string FileExtension { get; } = @".tmp";