Ejemplo n.º 1
0
        public static int Main(string[] args)
        {
            LegacyFilesystemReader.Register();

            // Back up the cwd before DesktopGameHost changes it
            var cwd = Environment.CurrentDirectory;

            using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
            {
                if (!host.IsPrimaryInstance)
                {
                    var importer = new BeatmapIPCChannel(host);
                    // Restore the cwd so relative paths given at the command line work correctly
                    Directory.SetCurrentDirectory(cwd);
                    foreach (var file in args)
                    {
                        Console.WriteLine(@"Importing {0}", file);
                        if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
                        {
                            throw new TimeoutException(@"IPC took too long to send");
                        }
                    }
                }
                else
                {
                    host.Run(new OsuGameDesktop(args));
                }
                return(0);
            }
        }
Ejemplo n.º 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 temp = prepareTempCopy(osz_path);

                    Assert.IsTrue(File.Exists(temp));

                    var importer = new BeatmapIPCChannel(client);
                    if (!importer.ImportAsync(temp).Wait(5000))
                    {
                        Assert.Fail(@"IPC took too long to send");
                    }

                    ensureLoaded(osu);

                    Assert.IsFalse(File.Exists(temp));
                }
        }
Ejemplo n.º 3
0
        public void TestImportOverIPC()
        {
            using (HeadlessGameHost host = new CleanRunHeadlessGameHost("host", true))
                using (HeadlessGameHost client = new CleanRunHeadlessGameHost("client", true))
                {
                    try
                    {
                        Assert.IsTrue(host.IsPrimaryInstance);
                        Assert.IsFalse(client.IsPrimaryInstance);

                        var osu = loadOsu(host);

                        var temp = prepareTempCopy(osz_path);
                        Assert.IsTrue(File.Exists(temp));

                        var importer = new BeatmapIPCChannel(client);
                        if (!importer.ImportAsync(temp).Wait(10000))
                        {
                            Assert.Fail(@"IPC took too long to send");
                        }

                        ensureLoaded(osu);

                        waitForOrAssert(() => !File.Exists(temp), "Temporary still exists after IPC import", 5000);
                    }
                    finally
                    {
                        host.Exit();
                    }
                }
        }
Ejemplo n.º 4
0
        public static int Main(string[] args)
        {
            // Back up the cwd before DesktopGameHost changes it
            var cwd = Environment.CurrentDirectory;

            using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
            {
                if (!host.IsPrimaryInstance)
                {
                    var importer = new BeatmapIPCChannel(host);
                    // Restore the cwd so relative paths given at the command line work correctly
                    Directory.SetCurrentDirectory(cwd);
                    foreach (var file in args)
                    {
                        Console.WriteLine(@"Importing {0}", file);
                        if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
                        {
                            throw new TimeoutException(@"IPC took too long to send");
                        }
                    }
                }
                else
                {
#if DEBUG
                    host.Run(new OsuTestBrowser());
#else
                    switch (args.FirstOrDefault() ?? string.Empty)
                    {
                    case "--tests":
                        host.Run(new OsuTestBrowser());
                        break;

                    default:
                        host.Run(new OsuGameDesktop(args));
                        break;
                    }
#endif
                }
                return(0);
            }
        }