예제 #1
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));
            }
        }
예제 #2
0
        public static void OnParse(ProjectOptions options)
        {
            var projectPath = options.ProjectPath;
            var project     = Project.Read(projectPath);

            switch (options.Command)
            {
            case "open":
                Open();
                break;

            case "build":
                Build();
                break;

            case "test":
                Test();
                break;

            case "get-version":
                GetProjectVersion();
                break;

            case "get-editor-version":
                GetProjectEditorVersion();
                break;
            }

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

                Environment.Exit(exitCode);
            }

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

                Environment.Exit(exitCode);
            }

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

                Environment.Exit(exitCode);
            }

            void GetProjectVersion()
            {
                Console.WriteLine(project.Version);
            }

            void GetProjectEditorVersion()
            {
                Console.WriteLine(project.EditorVersion);
            }
        }