本文整理汇总了C#中MonoDevelop.Projects.Project.GetProjectTypes方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetProjectTypes方法的具体用法?C# Project.GetProjectTypes怎么用?C# Project.GetProjectTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Projects.Project
的用法示例。
在下文中一共展示了Project.GetProjectTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCategoryPropertyKey
static string GetCategoryPropertyKey(Project proj)
{
string key = "Dialogs.NewFileDialog.LastSelectedCategory";
if (proj != null) {
key += "." + proj.GetProjectTypes ().First ();
var dnp = proj as DotNetProject;
if (dnp != null)
key += "." + dnp.LanguageName;
}
return key;
}
示例2: IsValidForProject
protected virtual bool IsValidForProject (Project project, string projectPath)
{
// When there is no project, only single template files can be created.
if (project == null) {
foreach (FileDescriptionTemplate f in files)
if (!(f is SingleFileDescriptionTemplate))
return false;
}
// Filter on templates
foreach (FileDescriptionTemplate f in files)
if (!f.SupportsProject (project, projectPath))
return false;
//filter on conditions
if (project != null) {
if (!string.IsNullOrEmpty (projecttype) && project.GetProjectTypes ().All (p => p != projecttype))
return false;
foreach (FileTemplateCondition condition in conditions)
if (!condition.ShouldEnableFor (project, projectPath))
return false;
}
return true;
}
示例3: ShouldEnableFor
public override bool ShouldEnableFor(Project proj, string projectPath)
{
if (proj == null)
return !requireExists;
if (projectType != null && proj.GetProjectTypes ().All (p => p != projectType))
return false;
//check for permitted creation paths
if (permittedCreationPaths != null) {
bool noMatches = true;
foreach (string path in permittedCreationPaths) {
string matchPath = Path.Combine (proj.BaseDirectory, path);
if (Path.GetFullPath (matchPath) == Path.GetFullPath (projectPath))
noMatches = false;
}
if (noMatches)
return false;
}
//check for excluded creation paths
if (excludedCreationPaths != null) {
bool foundMatch = false;
foreach (string path in excludedCreationPaths) {
string matchPath = Path.Combine (proj.BaseDirectory, path);
if (Path.GetFullPath (matchPath) == Path.GetFullPath (projectPath))
foundMatch = true;
}
if (foundMatch)
return false;
}
//check for required files
if (requiredFiles != null) {
bool requiredFileNotFound = true;
foreach (string f in requiredFiles) {
string requiredFile = (f[0] == '/')?
Path.Combine (proj.BaseDirectory, f.Substring(1))
: Path.Combine (projectPath, f);
if (proj.Files.GetFile (requiredFile) != null)
requiredFileNotFound = true;
}
if (requiredFileNotFound)
return false;
}
//check for excluded files
if (excludedFiles != null) {
bool foundExcludedFile = false;
foreach (string f in excludedFiles) {
string excludedFile = (f[0] == '/')?
Path.Combine (proj.BaseDirectory, f.Substring(1))
: Path.Combine (projectPath, f);
if (proj.Files.GetFile (excludedFile) != null)
foundExcludedFile = true;
}
if (foundExcludedFile)
return false;
}
return true;
}