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

Get handled file extensions from game itself, rather than duplicating locally

This commit is contained in:
Dean Herbert 2020-12-15 12:37:41 +09:00
parent 26fa010fed
commit cba4657021

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.IO; using System.IO;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -36,7 +37,7 @@ namespace osu.Game.Screens.Import
private const float button_vertical_margin = 15; private const float button_vertical_margin = 15;
[Resolved] [Resolved]
private OsuGameBase gameBase { get; set; } private OsuGameBase game { get; set; }
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -46,7 +47,6 @@ namespace osu.Game.Screens.Import
{ {
storage.GetStorageForDirectory("imports"); storage.GetStorageForDirectory("imports");
var originalPath = storage.GetFullPath("imports", true); var originalPath = storage.GetFullPath("imports", true);
string[] fileExtensions = { ".osk", ".osr", ".osz" };
InternalChild = contentContainer = new Container InternalChild = contentContainer = new Container
{ {
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Import
Colour = colours.GreySeafoamDark, Colour = colours.GreySeafoamDark,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
fileSelector = new FileSelector(initialPath: originalPath, validFileExtensions: fileExtensions) fileSelector = new FileSelector(originalPath, game.HandledExtensions.ToArray())
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.65f Width = 0.65f
@ -174,7 +174,7 @@ namespace osu.Game.Screens.Import
string[] paths = { path }; string[] paths = { path };
Task.Factory.StartNew(() => gameBase.Import(paths), TaskCreationOptions.LongRunning); Task.Factory.StartNew(() => game.Import(paths), TaskCreationOptions.LongRunning);
} }
} }
} }