mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Improve beatmap import
This commit is contained in:
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using osu.Desktop.Beatmaps.IO;
|
using osu.Desktop.Beatmaps.IO;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Desktop;
|
using osu.Framework.Desktop;
|
||||||
@ -25,17 +26,22 @@ namespace osu.Desktop
|
|||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
LegacyFilesystemReader.Register();
|
LegacyFilesystemReader.Register();
|
||||||
|
|
||||||
|
var cwd = Directory.GetCurrentDirectory();
|
||||||
|
|
||||||
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
|
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
|
||||||
{
|
{
|
||||||
if (!host.IsPrimaryInstance)
|
if (!host.IsPrimaryInstance)
|
||||||
{
|
{
|
||||||
var importer = new BeatmapImporter(host);
|
var importer = new BeatmapImporter(host);
|
||||||
|
Directory.SetCurrentDirectory(cwd);
|
||||||
foreach (var file in args)
|
foreach (var file in args)
|
||||||
if (!importer.Import(file).Wait(1000))
|
{
|
||||||
|
Console.WriteLine(@"Importing {0}", file);
|
||||||
|
if (!importer.Import(Path.GetFullPath(file)).Wait(3000))
|
||||||
throw new TimeoutException(@"IPC took too long to send");
|
throw new TimeoutException(@"IPC took too long to send");
|
||||||
Console.WriteLine(@"Sent import requests to running instance");
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void onDatabaseOnBeatmapSetAdded(BeatmapSetInfo s)
|
private void onDatabaseOnBeatmapSetAdded(BeatmapSetInfo s)
|
||||||
{
|
{
|
||||||
Schedule(() => addBeatmapSet(s, Game));
|
Schedule(() => addBeatmapSet(s, Game, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(GameMode last)
|
protected override void OnEntering(GameMode last)
|
||||||
@ -334,7 +334,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game)
|
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game, bool select = false)
|
||||||
{
|
{
|
||||||
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.ID);
|
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.ID);
|
||||||
beatmapSet.Beatmaps.ForEach(b =>
|
beatmapSet.Beatmaps.ForEach(b =>
|
||||||
@ -359,7 +359,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
carousel.AddGroup(group);
|
carousel.AddGroup(group);
|
||||||
|
|
||||||
if (Beatmap == null)
|
if (Beatmap == null || select)
|
||||||
carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
|
carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user