예제 #1
0
파일: Program.cs 프로젝트: yheno/osu
        public static int Main(string[] args)
        {
            LegacyFilesystemReader.Register();

            using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
            {
                if (!host.IsPrimaryInstance)
                {
                    var importer = new BeatmapImporter(host);

                    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
                {
                    Ruleset.Register(new OsuRuleset());
                    Ruleset.Register(new TaikoRuleset());
                    Ruleset.Register(new ManiaRuleset());
                    Ruleset.Register(new CatchRuleset());

                    BaseGame osu = new OsuGame(args);
                    host.Add(osu);
                    host.Run();
                }
                return 0;
            }
        }
예제 #2
0
        public void TestImportOverIPC()
        {
            using (HeadlessGameHost host = new HeadlessGameHost("host", true))
            using (HeadlessGameHost client = new HeadlessGameHost("client", true))
            {
                Assert.IsTrue(host.IsPrimaryInstance);
                Assert.IsTrue(!client.IsPrimaryInstance);

                var osu = loadOsu(host);

                var importer = new BeatmapImporter(client);
                if (!importer.Import(osz_path).Wait(1000))
                    Assert.Fail(@"IPC took too long to send");

                ensureLoaded(osu, 10000);
            }
        }