Example #1
0
        private void AddProject(string projectLine)
        {
            string pattern = @"^Project\(""(?<unknown>\S+)""\) = ""(?<name>\S+)"", ""(?<path>\S+)"", ""(?<id>\S+)""";
            Regex  regex   = new Regex(pattern);
            Match  match   = regex.Match(projectLine);

            if (match.Success)
            {
                string unknown = match.Groups["unknown"].Value;
                string name    = match.Groups["name"].Value;
                string path    = match.Groups["path"].Value;
                string id      = match.Groups["id"].Value;

                path = ResolvePath(path);

                if (unknown == commonProjectId)
                {
                    Project project = new Project(this, new Guid(id), name);

                    string absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    project.Read(absoluteProjectPath);

                    string relativeProjectPath = Path.GetDirectoryName(path);
                    project.RelativePath = relativeProjectPath;

                    if (project.ProjectType == "C# Local" ||
                        project.ProjectType == "C# Web" ||
                        project.ProjectType == "VB Local" ||
                        project.ProjectType == "VB Web")
                    {
                        _Projects.Add(project.ID, project);
                    }
                }
                else if (unknown == enterproseProjectId)
                {
                    EnterpriseProject etpProject          = new EnterpriseProject(this, new Guid(id), name);
                    string            absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    etpProject.Read(absoluteProjectPath);

                    // get the list of projects from enterprise projects
                    foreach (Project project in etpProject.GetProjects())
                    {
                        _Projects.Add(project.ID, project);
                    }
                }
            }
        }
Example #2
0
        public IList GetProjects()
        {
            if (_Projects == null)
            {
                _Projects = new ArrayList();

                foreach (string file in GetFiles())
                {
                    string extension = Path.GetExtension(file);

                    if (extension == ".csproj" || extension == ".vcproj")
                    {
                        string name = Path.GetFileNameWithoutExtension(file);
                        string id   = GetReferenceID(file);
                        string path = _Solution.ResolvePath(file);

                        Project project = new Project(_Solution, new Guid(id), name);

                        string absoluteProjectPath = Path.Combine(_RelativePath, path);
                        project.Read(absoluteProjectPath);

                        string relativeProjectPath = Path.GetDirectoryName(absoluteProjectPath);
                        project.RelativePath = relativeProjectPath;

                        if (project.ProjectType == "C# Local" ||
                            project.ProjectType == "C# Web")
                        {
                            _Projects.Add(project);
                        }
                    }
                }

                foreach (EnterpriseProject project in _SubProjects)
                {
                    _Projects.AddRange(project.GetProjects());
                }
            }

            return(_Projects);
        }
Example #3
0
        public IList GetProjects() {
            if (_Projects == null) {
                _Projects = new ArrayList();

                foreach (string file in GetFiles()) {
                    string extension = Path.GetExtension(file);

                    if (extension == ".csproj" || extension == ".vcproj") {
                        string name = Path.GetFileNameWithoutExtension(file);
                        string id = GetReferenceID(file);
                        string path = _Solution.ResolvePath(file);

                        Project project = new Project(_Solution, new Guid(id), name);

                        string absoluteProjectPath = Path.Combine(_RelativePath, path);
                        project.Read(absoluteProjectPath);

                        string relativeProjectPath = Path.GetDirectoryName(absoluteProjectPath);
                        project.RelativePath = relativeProjectPath;

                        if (project.ProjectType == "C# Local" ||
                            project.ProjectType == "C# Web") {
                            _Projects.Add(project);
                        }
                    }
                }

                foreach (EnterpriseProject project in _SubProjects) {
                    _Projects.AddRange(project.GetProjects());
                }
            }

            return _Projects;
        }
Example #4
0
        private void AddProject(string projectLine) {
            string pattern = @"^Project\(""(?<unknown>\S+)""\) = ""(?<name>\S+)"", ""(?<path>\S+)"", ""(?<id>\S+)""";
            Regex regex = new Regex(pattern);
            Match match = regex.Match(projectLine);

            if (match.Success) {
                string unknown = match.Groups["unknown"].Value;
                string name = match.Groups["name"].Value;
                string path = match.Groups["path"].Value;
                string id = match.Groups["id"].Value;

                path = ResolvePath(path);

                if (unknown == commonProjectId) {
                    Project project = new Project(this, new Guid(id), name);

                    string absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    project.Read(absoluteProjectPath);

                    string relativeProjectPath = Path.GetDirectoryName(path);
                    project.RelativePath = relativeProjectPath;

                    if (project.ProjectType == "C# Local" ||
                        project.ProjectType == "C# Web" ||
                        project.ProjectType == "VB Local" ||
                        project.ProjectType == "VB Web") {
                        _Projects.Add(project.ID, project);
                    }
                } 
                else if (unknown == enterproseProjectId) {
                    EnterpriseProject etpProject = new EnterpriseProject(this, new Guid(id), name);
                    string absoluteProjectPath = Path.Combine(SolutionDirectory, path);
                    etpProject.Read(absoluteProjectPath);

                    // get the list of projects from enterprise projects
                    foreach(Project project in etpProject.GetProjects()) {
                        _Projects.Add(project.ID, project);
                    }
                }
            }
        }