Пример #1
0
        public override bool Execute(AddInput input)
        {
            input.AssertValid();

            if (input.ListFlag)
            {
                Templating.Library.Graph.FindCategory("add").WriteDescriptionToConsole();
                return(true);
            }

            var solutionFile = input.SolutionFlag ?? SolutionFinder.FindSolutionFile();

            if (solutionFile.IsEmpty())
            {
                return(false);
            }

            try
            {
                var request = BuildTemplateRequest(input, solutionFile);
                var plan    = Templating.BuildPlan(request);
                Templating.ExecutePlan(plan);
            }
            catch (Exception)
            {
                Console.WriteLine("Template planning failed.  The valid options for this command are:");
                Templating.Library.Graph.FindCategory("add").WriteDescriptionToConsole();
                Console.WriteLine();
                Console.WriteLine();
                throw;
            }

            return(true);
        }
Пример #2
0
        public override bool Execute(NewCommandInput input)
        {
            if (input.ListFlag)
            {
                Templating.Library.Graph.FindCategory("new").WriteDescriptionToConsole();
                return(true);
            }

            try
            {
                var request = input.CreateRequestForSolution();
                var plan    = Templating.BuildPlan(request);
                executePlan(input, plan, request);
            }
            catch (Exception)
            {
                Console.WriteLine("Template planning failed.  The valid options for this command are:");
                Templating.Library.Graph.FindCategory("new").WriteDescriptionToConsole();
                Console.WriteLine();
                Console.WriteLine();
                throw;
            }


            return(true);
        }
Пример #3
0
        public override bool Execute(EnhanceInput input)
        {
            var solutionFile = SolutionFinder.FindSolutionFile();

            if (solutionFile == null)
            {
                return(false);
            }

            var request = BuildTemplateRequest(input, solutionFile);

            var plan = Templating.BuildPlan(request);

            plan.Solution = Solution.LoadFrom(solutionFile);

            Templating.ExecutePlan(plan);

            return(true);
        }
Пример #4
0
        private static void executePlan(NewCommandInput input, TemplatePlan plan, TemplateRequest request)
        {
            if (input.PreviewFlag)
            {
                Console.WriteLine("To solution directory " + input.SolutionDirectory());
                Console.WriteLine();

                plan.WritePreview();
            }
            else
            {
                prepareTargetDirectory(input, request);

                Templating.ExecutePlan(plan);

                if (RemoteOperations.Enabled)
                {
                    var solutionPath = plan.SourceDirectory.AppendPath(request.SolutionName + ".sln");

                    Process.Start(solutionPath);
                }
            }
        }