/// <summary>
        /// Rebuild project after modifing
        /// </summary>
        /// <param name="inputProject"></param>
        /// <returns> path to .exe file </returns>
        private Tuple <string, LogProcess> RebuildProject(IProject inputProject)
        {
            CsprojFile csprojFile = Utils.SearchCsprojFile(inputProject.RootFolder);

            //rebuild project
            ProjectRebuilding projectRebuilding = new ProjectRebuilding();
            LogProcess        logBuilding       = projectRebuilding.Compile(csprojFile.Path);

            if (logBuilding.Output != null)
            {
                File.AppendAllText(@"..\..\Log Output\building.log", logBuilding.Output + NEW_LINE);
            }
            if (logBuilding.Error != null)
            {
                File.AppendAllText(@"..\..\Log Output\building.log", logBuilding.Error + NEW_LINE);
            }
            if (logBuilding.Error_count > 0 ||
                (logBuilding.Error != null && logBuilding.Error.Trim() != ""))
            {
                logger.Error("--Rebuild project fail: " + logBuilding.Error);
                return(new Tuple <string, LogProcess>(null, logBuilding));
            }

            string output = inputProject.RootFolder.Path + @"\bin\Debug";

            logger.Debug("Output path: " + output);
            ExeFile exeFile = FindExeFile(output);

            logger.Debug("Modified, Built successfully" + NEW_LINE +
                         "Get .exe file path: " + exeFile.Path);

            return(new Tuple <string, LogProcess>(exeFile.Path, logBuilding));
        }
        public static void HandleCsProjFile(string filePath, IFile parent)
        {
            CsprojFileAnalyzer csprojFileAnalyzer = new CsprojFileAnalyzer();
            CsprojFile         csProjFile         = csprojFileAnalyzer.ParseFileContent(filePath);

            csProjFile.Children = new List <IFile>();
            csProjFile.Parent   = parent;
            if (parent != null)
            {
                if (parent.Children == null)
                {
                    parent.Children = new List <IFile>();
                }
                parent.Children.Add(csProjFile);
            }
        }
        private static AbstractProject HandleProject(Folder projFolder)
        {
            CsprojFile csprojFile = Utils.SearchCsprojFile(projFolder);

            // determine Wpf project or Windows Form Application
            AbstractProject inputProj;

            if (csprojFile is CsprojWpfFile)
            {
                inputProj = new WpfProject();
            }
            else
            {
                inputProj = new WfaProject();
            }
            inputProj.RootFolder = projFolder;
            return(inputProj);
        }
Beispiel #4
0
        public CsprojFile ParseFileContent(string filePath)
        {
            string        fileContent      = Utils.ReadFileContent(filePath);
            CsprojFile    re               = null;
            List <String> projectTypeGuids = FindProjectTypeGuids(fileContent);

            if (projectTypeGuids != null && projectTypeGuids.Contains(CsprojFile.WPF_PROJECT_TYPE_GUID))
            {
                re = new CsprojWpfFile(filePath);
                ((CsprojWpfFile)re).ProjectTypeGuids = projectTypeGuids;
                //ParseFileContentWpf((CsprojWpfFile)re, fileContent);
            }
            else
            {
                re = new CsprojWfaFile(filePath);
                //ParseFileContentWfa((CsprojWfaFile)re, fileContent);
            }
            return(re);
        }