Exemple #1
0
        public int Run()
        {
            var helper = new UnityInstallationHelper();
            var args   = Args;

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

            return(Execute(editorPath, args));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }
        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));
            }
        }