Exemple #1
0
        private void ProcessFolder()   //2
                                       // csPaths = string.Empty;
                                       //  bool isSoluiton = TryGetSolutionFiles(solutionFolderInfo, out slnPath, out cspath);
        {
            MyMessageProcessor.Setup();

            List <string> unexpectedFiles = GetUnexpectedFiles(solutionFolderInfo);

            if (unexpectedFiles.Count > 0)
            {
                MyMessageProcessor.ConsoleWrite("There are unexpected files!", ConsoleColor.Red, true);
                foreach (var fl in unexpectedFiles)
                {
                    MyMessageProcessor.ConsoleWrite(fl, ConsoleColor.Red, true);
                }
            }
            string[] solutionFiles = TryGetSolutionFiles(solutionFolderInfo);
            var      solutionCount = solutionFiles.Count();

            if (solutionCount > 0)
            {
                slnPath = solutionFiles[0];
            }
            if (solutionCount > 1)
            {
                MyMessageProcessor.ConsoleWrite("There are many sln files!", ConsoleColor.Red);
                MyMessageProcessor.ConsoleWriteLine();
            }

            string[] projectFiles  = TryGetProjectFiles(solutionFolderInfo);
            int      projectsCount = projectFiles.Count();

            switch (projectsCount)
            {
            case 1:
                csPaths = new List <string>()
                {
                    projectFiles[0]
                };
                WorkWithSolution();
                break;

            case 0:
                OpenFolder();
                break;

            default:
                var dxPaths = FindDXCsprojs(projectFiles);
                if (dxPaths.Count > 0)
                {
                    csPaths = dxPaths;
                    WorkWithSolution();
                }
                else
                {
                    OpenFolder();
                }
                break;
            }
        }