mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Override Import() instead.
This commit is contained in:
parent
d8838ddbfb
commit
aa7d22460d
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
@ -57,7 +58,7 @@ namespace osu.Android
|
||||
|
||||
var stream = ContentResolver.OpenInputStream(uri);
|
||||
if (stream != null)
|
||||
game.ScheduleImport(stream, cursor.GetString(filename_column));
|
||||
Task.Factory.StartNew(() => game.Import(stream, cursor.GetString(filename_column)), TaskCreationOptions.LongRunning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,12 +67,11 @@ namespace osu.Android
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schedules a file to be imported once the game is loaded.
|
||||
/// </summary>
|
||||
/// <param name="stream">A stream to the file to import.</param>
|
||||
/// <param name="filename">The filename of the file to import.</param>
|
||||
public void ScheduleImport(Stream stream, string filename) => WaitForReady(() => this, _ => Task.Run(() => Import(stream, filename)));
|
||||
public override Task Import(Stream stream, string filename)
|
||||
{
|
||||
WaitForReady(() => this, _ => Task.Run(() => base.Import(stream, filename)));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Database
|
||||
}
|
||||
|
||||
return import;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the user requests to view the resulting import.
|
||||
|
@ -395,7 +395,7 @@ namespace osu.Game
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Import(Stream stream, string filename)
|
||||
public virtual async Task Import(Stream stream, string filename)
|
||||
{
|
||||
var extension = Path.GetExtension(filename)?.ToLowerInvariant();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user