mirror of
https://github.com/osukey/osukey.git
synced 2025-06-20 02:38:04 +09: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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
@ -57,7 +58,7 @@ namespace osu.Android
|
|||||||
|
|
||||||
var stream = ContentResolver.OpenInputStream(uri);
|
var stream = ContentResolver.OpenInputStream(uri);
|
||||||
if (stream != null)
|
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>
|
public override Task Import(Stream stream, string filename)
|
||||||
/// Schedules a file to be imported once the game is loaded.
|
{
|
||||||
/// </summary>
|
WaitForReady(() => this, _ => Task.Run(() => base.Import(stream, filename)));
|
||||||
/// <param name="stream">A stream to the file to import.</param>
|
return Task.CompletedTask;
|
||||||
/// <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)));
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
return import;
|
return import;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when the user requests to view the resulting import.
|
/// 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();
|
var extension = Path.GetExtension(filename)?.ToLowerInvariant();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user