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


C# Project.GetProjectTypes方法代碼示例

本文整理匯總了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;
 }
開發者ID:brantwedel,項目名稱:monodevelop,代碼行數:11,代碼來源:NewFileDialog.cs

示例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;
        }
開發者ID:riverans,項目名稱:monodevelop,代碼行數:26,代碼來源:FileTemplate.cs

示例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;
        }
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:62,代碼來源:ParentProjectFileTemplateCondition.cs


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