1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 03:02:54 +08:00

Use existing HandleLink flow rather than reimplmenting

This commit is contained in:
Dean Herbert 2022-02-23 17:02:39 +09:00
parent 1a358698fb
commit 5d73691de4

View File

@ -906,7 +906,7 @@ namespace osu.Game
if (firstPath.StartsWith(OSU_PROTOCOL, StringComparison.Ordinal))
{
handleOsuProtocolUrl(firstPath);
HandleLink(firstPath);
}
else
{
@ -916,30 +916,6 @@ namespace osu.Game
}
}
private void handleOsuProtocolUrl(string url)
{
if (!url.StartsWith(OSU_PROTOCOL, StringComparison.Ordinal))
throw new ArgumentException("Invalid osu URL provided.", nameof(url));
// note that `StringSplitOptions.RemoveEmptyEntries` is not explicitly specified here
// in order to ensure that the protocol URL is valid (i.e. it has two slashes in the `osu://` part,
// causing the link content to be stored to the 2nd index rather than the 1st).
string[] pieces = url.Split('/');
switch (pieces[2])
{
case "s":
if (int.TryParse(pieces[3], out int beatmapSetId))
ShowBeatmapSet(beatmapSetId);
break;
case "b":
if (int.TryParse(pieces[3], out int beatmapId))
ShowBeatmap(beatmapId);
break;
}
}
private void showOverlayAboveOthers(OverlayContainer overlay, OverlayContainer[] otherOverlays)
{
otherOverlays.Where(o => o != overlay).ForEach(o => o.Hide());