1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 05:57:19 +08:00

Merge branch 'master' into ctb-improvements

This commit is contained in:
Dean Herbert 2017-09-18 12:57:53 +09:00 committed by GitHub
commit 83579138d2
4 changed files with 25 additions and 28 deletions

View File

@ -26,7 +26,7 @@ namespace osu.Game.Beatmaps.IO
// no-op
}
public override IEnumerable<string> Filenames => Directory.GetFiles(path).Select(Path.GetFileName).ToArray();
public override IEnumerable<string> Filenames => Directory.GetFiles(path, "*", SearchOption.AllDirectories).Select(Path.GetFileName).ToArray();
public override Stream GetUnderlyingStream() => null;
}

View File

@ -27,42 +27,45 @@ namespace osu.Game.Online.API
internal bool AuthenticateWithLogin(string username, string password)
{
var req = new AccessTokenRequestPassword(username, password)
using (var req = new AccessTokenRequestPassword(username, password)
{
Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.POST,
ClientId = clientId,
ClientSecret = clientSecret
};
try
})
{
req.BlockingPerform();
}
catch
{
return false;
}
try
{
req.BlockingPerform();
}
catch
{
return false;
}
Token = req.ResponseObject;
return true;
Token = req.ResponseObject;
return true;
}
}
internal bool AuthenticateWithRefresh(string refresh)
{
try
{
var req = new AccessTokenRequestRefresh(refresh)
using (var req = new AccessTokenRequestRefresh(refresh)
{
Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.POST,
ClientId = clientId,
ClientSecret = clientSecret
};
req.BlockingPerform();
})
{
req.BlockingPerform();
Token = req.ResponseObject;
return true;
Token = req.ResponseObject;
return true;
}
}
catch
{

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.IO.Network;
using osu.Game.Beatmaps;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;
@ -19,6 +18,9 @@ namespace osu.Game.Online.API.Requests
public GetScoresRequest(BeatmapInfo beatmap)
{
if (!beatmap.OnlineBeatmapID.HasValue)
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
this.beatmap = beatmap;
Success += onSuccess;
@ -30,14 +32,6 @@ namespace osu.Game.Online.API.Requests
score.ApplyBeatmap(beatmap);
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
//req.AddParameter(@"c", beatmap.Hash);
//req.AddParameter(@"f", beatmap.Path);
return req;
}
protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
}

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Scores = null;
getScoresRequest?.Cancel();
if (api == null || Beatmap == null) return;
if (api == null || Beatmap?.OnlineBeatmapID == null) return;
loading.Show();