当前位置: 首页>>代码示例>>C#>>正文


C# Solution.GetProjectConfiguration方法代码示例

本文整理汇总了C#中ICSharpCode.SharpDevelop.Project.Solution.GetProjectConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.GetProjectConfiguration方法的具体用法?C# Solution.GetProjectConfiguration怎么用?C# Solution.GetProjectConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.SharpDevelop.Project.Solution的用法示例。


在下文中一共展示了Solution.GetProjectConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupSolutionLoadSolutionProjects

		static ProjectSection SetupSolutionLoadSolutionProjects(Solution newSolution, StreamReader sr, IProgressMonitor progressMonitor)
		{
			if (progressMonitor == null)
				throw new ArgumentNullException("progressMonitor");
			
			string solutionDirectory = Path.GetDirectoryName(newSolution.FileName);
			
			ProjectSection nestedProjectsSection = null;
			IList<ProjectLoadInformation> projectsToLoad = new List<ProjectLoadInformation>();
			IList<IList<ProjectSection>> readProjectSections = new List<IList<ProjectSection>>();
			
			// process the solution file contents
			while (true) {
				string line = sr.ReadLine();
				
				if (line == null) {
					break;
				}
				Match match = projectLinePattern.Match(line);
				if (match.Success) {
					string projectGuid  = match.Result("${ProjectGuid}");
					string title        = match.Result("${Title}");
					string location     = match.Result("${Location}");
					string guid         = match.Result("${Guid}");
					
					if (!FileUtility.IsUrl(location)) {
						location = FileUtility.NormalizePath(Path.Combine(solutionDirectory, location));
					}
					
					if (projectGuid == FolderGuid) {
						SolutionFolder newFolder = SolutionFolder.ReadFolder(sr, title, location, guid);
						newSolution.AddFolder(newFolder);
					} else {
						ProjectLoadInformation loadInfo = new ProjectLoadInformation(newSolution, location, title);
						loadInfo.TypeGuid = projectGuid;
						loadInfo.Guid = guid;
						projectsToLoad.Add(loadInfo);
						IList<ProjectSection> currentProjectSections = new List<ProjectSection>();
						ReadProjectSections(sr, currentProjectSections);
						readProjectSections.Add(currentProjectSections);
					}
					match = match.NextMatch();
				} else {
					match = globalSectionPattern.Match(line);
					if (match.Success) {
						ProjectSection newSection = ProjectSection.ReadGlobalSection(sr, match.Result("${Name}"), match.Result("${Type}"));
						// Don't put the NestedProjects section into the global sections list
						// because it's transformed to a tree representation and the tree representation
						// is transformed back to the NestedProjects section during save.
						if (newSection.Name == "NestedProjects") {
							nestedProjectsSection = newSection;
						} else {
							newSolution.Sections.Add(newSection);
						}
					}
				}
			}
			// load projects
			for(int i=0; i<projectsToLoad.Count; i++) {
				ProjectLoadInformation loadInfo = projectsToLoad[i];
				IList<ProjectSection> projectSections = readProjectSections[i];
				loadInfo.ProjectSections = projectSections;
				
				// set the target platform
				SolutionItem projectConfig = newSolution.GetProjectConfiguration(loadInfo.Guid);
				loadInfo.Platform = AbstractProject.GetPlatformNameFromKey(projectConfig.Location);
				
				loadInfo.ProgressMonitor = progressMonitor;
				progressMonitor.Progress = (double)i / projectsToLoad.Count;
				progressMonitor.TaskName = "Loading " + loadInfo.ProjectName;
				
				using (IProgressMonitor nestedProgressMonitor = progressMonitor.CreateSubTask(1.0 / projectsToLoad.Count)) {
					loadInfo.ProgressMonitor = nestedProgressMonitor;
					IProject newProject = ProjectBindingService.LoadProject(loadInfo);
					newProject.IdGuid = loadInfo.Guid;
					newProject.ProjectSections.AddRange(projectSections);
					newSolution.AddFolder(newProject);
				}
			}
			return nestedProjectsSection;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:81,代码来源:Solution.cs


注:本文中的ICSharpCode.SharpDevelop.Project.Solution.GetProjectConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。