コード例 #1
0
        public void Main()
        {
            try
            {
                _consoleWriter.ConsoleWriteBackgroundColor("Initializing project graph", ConsoleColor.DarkYellow);

                var compileWorker    = _provider.GetService <CompileWorker>();
                var projectProcessor = _provider.GetService <ProjectProcessor>();

                while (_nextProjectId < projectProcessor.NumberOfProjectsToProcess)
                {
                    if (!_continueWithProjectProcessing)
                    {
                        if (!compileWorker.Compile())
                        {
                            break;
                        }
                        projectProcessor.PrepareNextProj(_nextProjectId);
                    }

                    while (!compileWorker.Compile())
                    {
                        projectProcessor.UncommentMoreProjectFiles(_nextProjectId);
                    }
                    _nextProjectId++;
                }
            }
            catch (Exception ex)
            {
                _consoleWriter.ConsolePauseAndFix($"Fail to proceed: {ex}", ConsoleColor.DarkRed);
                throw;
            }
            _consoleWriter.ConsolePauseAndFix("Success!", ConsoleColor.DarkGreen);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jagasafari/DevTools
        public void Main()
        {
            while (true)
            {
                _consoleWriter.ConsolePauseAndFix("enter key when code implemented", ConsoleColor.Yellow);
                var executor = _executorProvider.Create <IFinishingProcessExecutor>();

                executor.Execute(_dnx, $@"-p ""{testProjectPath}"" test", x => x.Equals("Failed"));
            }
        }
コード例 #3
0
 public void PrepareNextProj(int projectIdx)
 {
     Parallel.ForEach(GetFiles(projectIdx, "*.cs"), f =>
     {
         string fileNamespace;
         FileWorker.ConvertLines(f, s => $"// {s}", out fileNamespace);
     });
     if (projectIdx == 0)
     {
         _consoleWriter.ConsolePauseAndFix($"Num projects: {NumberOfProjectsToProcess}. Uncomment Entry point manually", ConsoleColor.DarkCyan);
     }
 }
コード例 #4
0
        public void Main()
        {
            INextStep nxt = GetNextStep();

            while (!nxt.Completed())
            {
                _consoleWriter.ConsoleWriteBackgroundColor("in while loop", ConsoleColor.DarkYellow);
                try
                {
                    if (nxt.ExpectedComilationSucces() && !nxt.Compile())
                    {
                        _consoleWriter.ConsolePauseAndFix("Expected compilation success, but failed!", ConsoleColor.Red);
                    }
                    nxt = nxt.Uncomment();
                }
                catch (Exception exception)
                {
                    _consoleWriter.ConsolePauseAndFix("Do something about exception!", ConsoleColor.Red);
                    File.WriteAllText(_errorOut, $"{exception}");
                }
            }
        }
コード例 #5
0
        public bool Compile()
        {
            var executor    = _executorProvider.Create <IFinishingProcessExecutor>();
            var initialPath = Directory.GetCurrentDirectory();

            try
            {
                Directory.SetCurrentDirectory(_compileDirectory);
                executor.Execute(_msBuild, "", s => !s.Contains("0 Error(s)"));
            }
            catch (Exception ex)
            {
                _consoleWriter.ConsolePauseAndFix($"Compilation failed! For info look in {_outFile}: {ex}", ConsoleColor.DarkRed);
                return(false);
            }
            finally
            {
                File.WriteAllText(_outFile, executor.Output);
                Directory.SetCurrentDirectory(initialPath);
            }
            return(true);
        }