本文整理汇总了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 ();
}
示例2: ShouldCreateProject
public bool ShouldCreateProject (ProjectCreateInformation projectCreateInformation)
{
return projectCreateInformation.ShouldCreate (createCondition);
}
示例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);
}
}
}