mirror of https://github.com/ppy/osu
Add ability to change the flie extension of API download requests
This commit is contained in:
parent
73a83e7f05
commit
52c7ed9960
|
@ -10,9 +10,18 @@ public abstract class APIDownloadRequest : APIRequest
|
||||||
{
|
{
|
||||||
private string filename;
|
private string filename;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the extension of the file outputted by this request.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string FileExtension { get; } = @".tmp";
|
||||||
|
|
||||||
protected override WebRequest CreateWebRequest()
|
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;
|
request.DownloadProgress += request_Progress;
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue