當前位置: 首頁>>代碼示例>>C#>>正文


C# ProjectCreateInformation.ShouldCreate方法代碼示例

本文整理匯總了C#中MonoDevelop.Projects.ProjectCreateInformation.ShouldCreate方法的典型用法代碼示例。如果您正苦於以下問題:C# ProjectCreateInformation.ShouldCreate方法的具體用法?C# ProjectCreateInformation.ShouldCreate怎麽用?C# ProjectCreateInformation.ShouldCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoDevelop.Projects.ProjectCreateInformation的用法示例。


在下文中一共展示了ProjectCreateInformation.ShouldCreate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetPackageReferences

		public IList<ProjectTemplatePackageReference> GetPackageReferences (ProjectCreateInformation projectCreateInformation)
		{
			return packageReferences
				.Where (packageReference => projectCreateInformation.ShouldCreate (packageReference.CreateCondition))
				.ToList ();
		}
開發者ID:FreeBSD-DotNet,項目名稱:monodevelop,代碼行數:6,代碼來源:ProjectDescriptor.cs

示例2: ShouldCreateProject

		public bool ShouldCreateProject (ProjectCreateInformation projectCreateInformation)
		{
			return projectCreateInformation.ShouldCreate (createCondition);
		}
開發者ID:FreeBSD-DotNet,項目名稱:monodevelop,代碼行數:4,代碼來源:ProjectDescriptor.cs

示例3: InitializeItem

		public void InitializeItem (SolutionFolderItem policyParent, ProjectCreateInformation projectCreateInformation, string defaultLanguage, SolutionItem item)
		{
			MonoDevelop.Projects.Project project = item as MonoDevelop.Projects.Project;

			if (project == null) {
				MessageService.ShowError (GettextCatalog.GetString ("Can't create project with type: {0}", type));
				return;
			}

			// Set the file before setting the name, to make sure the file extension is kept
			project.FileName = Path.Combine (projectCreateInformation.ProjectBasePath, projectCreateInformation.ProjectName);
			project.Name = projectCreateInformation.ProjectName;

			var dnp = project as DotNetProject;
			if (dnp != null) {
				if (policyParent.ParentSolution != null && !policyParent.ParentSolution.FileFormat.SupportsFramework (dnp.TargetFramework)) {
					SetClosestSupportedTargetFramework (policyParent.ParentSolution.FileFormat, dnp);
				}
				var substitution = new string[,] { { "ProjectName", GetProjectNameForSubstitution (projectCreateInformation) } };
				foreach (var desc in references) {
					if (!projectCreateInformation.ShouldCreate (desc.CreateCondition))
						continue;
					var pr = desc.Create ();
					if (pr.ReferenceType == ReferenceType.Project) {
						string referencedProjectName = ReplaceParameters (pr.Reference, substitution, projectCreateInformation);
						var parsedReference = ProjectReference.RenameReference (pr, referencedProjectName);
						dnp.References.Add (parsedReference);
					} else
						dnp.References.Add (pr);
				}
			}

			foreach (SingleFileDescriptionTemplate resourceTemplate in resources) {
				try {
					if (!projectCreateInformation.ShouldCreate (resourceTemplate.CreateCondition))
						continue;
					var projectFile = new ProjectFile (resourceTemplate.SaveFile (policyParent, project, defaultLanguage, project.BaseDirectory, null));
					projectFile.BuildAction = BuildAction.EmbeddedResource;
					project.Files.Add (projectFile);
				} catch (Exception ex) {
					if (!IdeApp.IsInitialized)
						throw;
					MessageService.ShowError (GettextCatalog.GetString ("File {0} could not be written.", resourceTemplate.Name), ex);
				}
			}

			foreach (FileDescriptionTemplate fileTemplate in files) {
				try {
					if (!projectCreateInformation.ShouldCreate (fileTemplate.CreateCondition))
						continue;
					fileTemplate.SetProjectTagModel (projectCreateInformation.Parameters);
					fileTemplate.AddToProject (policyParent, project, defaultLanguage, project.BaseDirectory, null);
				} catch (Exception ex) {
					if (!IdeApp.IsInitialized)
						throw;
					MessageService.ShowError (GettextCatalog.GetString ("File {0} could not be written.", fileTemplate.Name), ex);
				} finally {
					fileTemplate.SetProjectTagModel (null);
				}
			}
		}
開發者ID:FreeBSD-DotNet,項目名稱:monodevelop,代碼行數:61,代碼來源:ProjectDescriptor.cs


注:本文中的MonoDevelop.Projects.ProjectCreateInformation.ShouldCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。