2016-08-26 03:28:23 +00:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
2016-08-26 08:27:49 +00:00
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-08-26 03:28:23 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
2016-10-14 18:10:01 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework;
|
2016-08-26 03:28:23 +00:00
|
|
|
|
using osu.Framework.Desktop;
|
2016-10-21 09:25:22 +00:00
|
|
|
|
using osu.Framework.Desktop.Platform;
|
2016-10-07 03:49:53 +00:00
|
|
|
|
using osu.Framework.Platform;
|
2016-08-26 03:28:23 +00:00
|
|
|
|
using osu.Game;
|
2016-10-21 09:25:22 +00:00
|
|
|
|
using osu.Game.IPC;
|
2016-08-26 03:28:23 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Desktop
|
|
|
|
|
{
|
|
|
|
|
public static class Program
|
|
|
|
|
{
|
|
|
|
|
[STAThread]
|
2016-10-14 18:10:01 +00:00
|
|
|
|
public static int Main(string[] args)
|
2016-08-26 03:28:23 +00:00
|
|
|
|
{
|
2016-11-08 00:04:31 +00:00
|
|
|
|
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
|
2016-10-21 09:25:22 +00:00
|
|
|
|
{
|
2016-11-08 00:04:31 +00:00
|
|
|
|
if (!host.IsPrimaryInstance)
|
|
|
|
|
{
|
|
|
|
|
var importer = new BeatmapImporter(host);
|
2016-10-21 09:25:22 +00:00
|
|
|
|
|
2016-11-08 00:04:31 +00:00
|
|
|
|
foreach (var file in args)
|
|
|
|
|
if (!importer.Import(file).Wait(1000))
|
|
|
|
|
throw new TimeoutException(@"IPC took too long to send");
|
|
|
|
|
Console.WriteLine(@"Sent import requests to running instance");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BaseGame osu = new OsuGame(args);
|
|
|
|
|
host.Add(osu);
|
|
|
|
|
host.Run();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-08-26 03:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|