示例#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);
            }
        }