Beispiel #1
0
        /// <summary>
        /// Clones the repository, runs the tests and then when the process has finished, reads the log file and emails the results
        /// </summary>
        /// <param name="projectDirectoryPath"></param>
        /// <param name="projectExeName"></param>
        private void TestProject(string projectGithubRepoName, string testProjectName, EventHandler logAndMessageEvent)
        {
            if (Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), projectGithubRepoName)))
            {
                DeleteGitRepo(Path.Combine(Directory.GetCurrentDirectory(), projectGithubRepoName));
            }

            CmdLineUtils.PerformCommand(CmdLineUtils.Git, "clone https://github.com/AlanWills/" + projectGithubRepoName + ".git " + projectGithubRepoName);
            Console.WriteLine("Checkout of " + projectGithubRepoName + " completed");

            string pathToSolution = Path.Combine(projectGithubRepoName, testProjectName, testProjectName) + ".csproj";

            CmdLineUtils.PerformCommand(CmdLineUtils.MSBuild, pathToSolution);

            // Start the test project and wait for it to close
            string  processPath = Path.Combine(Directory.GetCurrentDirectory(), projectGithubRepoName, projectGithubRepoName, @"bin\Windows\x86\Debug", testProjectName + ".exe");
            Process proc        = Process.Start(processPath);

            proc.WaitForExit();
            proc.Close();

            // Send the results
            logAndMessageEvent.Invoke(this, EventArgs.Empty);

            // Clean up all of the files we have checked out
            DeleteGitRepo(Path.Combine(Directory.GetCurrentDirectory(), projectGithubRepoName));
        }
Beispiel #2
0
        public void ScheduleShutdown(ShutdownArgs shutdownArgs)
        {
            string args = new ShutdownCommandArgumentsBuilder()
                          .Seconds(shutdownArgs.Seconds)
                          .OverrideExistingShutdown(shutdownArgs.OverrideExistingShutdown)
                          .ShowNotification(shutdownArgs.ShowNotification)
                          .Build();

            CmdLineUtils.InvokeCommandLineCommand(args);
        }
Beispiel #3
0
        IEnumerator Start()
        {
            if (!Mirror.NetworkManager.isHeadless)
            {
                yield break;
            }

            for (int i = 0; i < this.numFramesToWait; i++)
            {
                yield return(null);
            }

            ushort portNum = (ushort)NetManager.defaultListenPortNumber;

            CmdLineUtils.GetUshortArgument("portNum", ref portNum);

            string sceneName = "Main";

            CmdLineUtils.GetArgument("scene", ref sceneName);

            ushort maxNumPlayers = (ushort)NetManager.maxNumPlayers;

            CmdLineUtils.GetUshortArgument("maxNumPlayers", ref maxNumPlayers);

            string serverIp = "127.0.0.1";

            CmdLineUtils.GetArgument("serverIp", ref serverIp);

            string gameModeName = null;

            CmdLineUtils.GetArgument("gameMode", ref gameModeName);
            if (!string.IsNullOrWhiteSpace(gameModeName))
            {
                var gameModeInfo = GameModeManager.Instance.GameModes.FirstOrDefault(gm => gm.Name == gameModeName);
                if (gameModeInfo != null)
                {
                    GameModeManager.Instance.SelectGameMode(gameModeInfo);
                }
                else
                {
                    Debug.LogError($"Game mode with name '{gameModeName}' not found");
                }
            }

            if (CmdLineUtils.HasArgument("startServer"))
            {
                Debug.LogFormat("Starting server in headless mode, params: {0}, {1}, {2}", portNum, sceneName, maxNumPlayers);
                NetManager.StartServer(portNum, sceneName, maxNumPlayers, true, false);
            }
            else if (CmdLineUtils.HasArgument("startClient"))
            {
                Debug.LogFormat("Starting client in headless mode, params: {0}, {1}", serverIp, portNum);
                NetManager.StartClient(serverIp, portNum);
            }
        }
Beispiel #4
0
        IEnumerator Start()
        {
            if (!Mirror.NetworkManager.isHeadless)
            {
                yield break;
            }

            for (int i = 0; i < this.numFramesToWait; i++)
            {
                yield return(null);
            }

            ushort portNum = (ushort)NetManager.defaultListenPortNumber;

            CmdLineUtils.GetUshortArgument("portNum", ref portNum);

            string sceneName = "Main";

            CmdLineUtils.GetArgument("scene", ref sceneName);

            ushort maxNumPlayers = (ushort)NetManager.maxNumPlayers;

            CmdLineUtils.GetUshortArgument("maxNumPlayers", ref maxNumPlayers);

            string serverIp = "127.0.0.1";

            CmdLineUtils.GetArgument("serverIp", ref serverIp);

            if (CmdLineUtils.HasArgument("startServer"))
            {
                Debug.LogFormat("Starting server in headless mode, params: {0}, {1}, {2}", portNum, sceneName, maxNumPlayers);
                NetManager.StartServer(portNum, sceneName, maxNumPlayers, true, false);
            }
            else if (CmdLineUtils.HasArgument("startClient"))
            {
                Debug.LogFormat("Starting client in headless mode, params: {0}, {1}", serverIp, portNum);
                NetManager.StartClient(serverIp, portNum);
            }
        }
Beispiel #5
0
 public void CancelShutdown()
 {
     CmdLineUtils.InvokeCommandLineCommand("/C SHUTDOWN /A");
 }
Beispiel #6
0
 public void Hibernate()
 {
     CmdLineUtils.InvokeCommandLineCommand($"/C SHUTDOWN /H");
 }