Exemple #1
0
        public object Clone()
        {
            var project = new SolutionProject(this.ProjectTypeId, this.ProjectId, this.Name, this.Path, this.ParentProject);

            foreach (var section in this.Sections)
            {
                project.Sections.Add(section.Clone() as Section);
            }
            return(project);
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            SolutionProject project = obj as SolutionProject;

            if (project != null)
            {
                return(this.ProjectTypeId == project.ProjectTypeId &&
                       this.ProjectId == project.ProjectId &&
                       this.Name == project.Name &&
                       this.Path == project.Path);
            }
            return(base.Equals(obj));
        }
Exemple #3
0
        public string GetSolutionFolderPath(SolutionProject project)
        {
            if (!project.IsFolder)
            {
                throw new InvalidOperationException("GetSolutionFolderPath requires folder project");
            }

            string path            = project.Name;
            Guid?  parentProjectId = project.ParentProjectId;

            while (parentProjectId != null)
            {
                var parentProject = this.FindProject(parentProjectId.Value);
                if (parentProject != null)
                {
                    path            = string.Format("{0}.{1}", parentProject.Path, path);
                    parentProjectId = parentProject.ParentProjectId;
                }
            }
            return(path);
        }
Exemple #4
0
        public SolutionProject(Guid projectTypeId, Guid projectId, string name, string path, SolutionProject parent)
            : this()
        {
            if (parent != null && projectId == parent.ProjectId)
            {
                throw new ArgumentException("Project can not assign itself as its parent", "parent");
            }

            this.ProjectTypeId = projectTypeId;
            this.ProjectId     = projectId;
            this.ParentProject = parent;
            this.Name          = name;
            this.Path          = path;
        }