コード例 #1
0
        public int Run()
        {
            var helper = new UnityInstallationHelper();
            var args   = Args;

            var editorPath = UnityInstallationHelper.GetExecutablePath(helper.GetInstalledEditors().First());

            return(Execute(editorPath, args));
        }
コード例 #2
0
        public int Build(Project project)
        {
            var helper = new UnityInstallationHelper();
            var args   = GetDefaultArgsBatch(project);

            var editorPath = helper.GetBestEditor(project.EditorVersion);

            return(Execute(editorPath, args));
        }
コード例 #3
0
        public int Test(Project project)
        {
            var helper = new UnityInstallationHelper();
            var args   = GetDefaultArgsBatch(project, quit: false);

            if (!Args.RunTests)
            {
                args.Enqueue($"-runTests");
            }

            var editorPath = helper.GetBestEditor(project.EditorVersion);

            return(Execute(editorPath, args));
        }
コード例 #4
0
        public int Open(Project project)
        {
            var helper = new UnityInstallationHelper();
            var args   = new Queue <string>(Args);

            if (Args.ProjectPath is null)
            {
                args.Enqueue($"-projectPath");
                args.Enqueue($"{project.Path}");
            }

            var editorPath = helper.GetBestEditor(project.EditorVersion);

            return(Execute(editorPath, args));
        }
コード例 #5
0
        public static void OnParse(UnityOptions options)
        {
            switch (options.Command)
            {
            case "run":
                Run();
                break;

            case "list-installs":
                ListEditorInstalls();
                break;
            }

            void Run()
            {
                var unityArgs = new UnityArgs(Interpreter.Instance.PassthroughArgs);
                var exitCode  = new UnityRunner(unityArgs).Run();

                Environment.Exit(exitCode);
            }

            void ListEditorInstalls()
            {
                UnityInstallationHelper helper;

                if (options.Path is null)
                {
                    helper = new UnityInstallationHelper();
                }
                else
                {
                    helper = new UnityInstallationHelper(options.Path);
                }
                var editors = helper.GetInstalledEditors();

                Console.WriteLine(string.Join(Environment.NewLine, editors));
            }
        }