Improve beatmap import

This commit is contained in:
Drew DeVault
2017-01-17 17:05:06 -05:00
parent 7559fc593a
commit 46e7bcef8c
2 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using osu.Desktop.Beatmaps.IO;
using osu.Framework;
using osu.Framework.Desktop;
@ -25,17 +26,22 @@ namespace osu.Desktop
public static int Main(string[] args)
{
LegacyFilesystemReader.Register();
var cwd = Directory.GetCurrentDirectory();
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
{
if (!host.IsPrimaryInstance)
{
var importer = new BeatmapImporter(host);
Directory.SetCurrentDirectory(cwd);
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");
Console.WriteLine(@"Sent import requests to running instance");
Thread.Sleep(500);
}
}
else
{