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


C# IProjectFile.IsPreprocessedT4Template方法代码示例

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


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

示例1: OnProjectFileChanged

        /// <summary>
        /// Processes changes for specific project file and returns a list of corresponding source file changes.
        /// </summary>
        /// <param name="projectFile">The project file.</param>
        /// <param name="changeType">Type of the change.</param>
        /// <param name="changeBuilder">The change builder used to populate changes.</param>
        /// <returns>Whether the provider has handled the file change.</returns>
        internal bool OnProjectFileChanged(IProjectFile projectFile, ref PsiModuleChange.ChangeType changeType, PsiModuleChangeBuilder changeBuilder)
        {
            if (!_t4Environment.IsSupported)
                return false;

            _shellLocks.AssertWriteAccessAllowed();
            ModuleWrapper moduleWrapper;

            switch (changeType) {

                case PsiModuleChange.ChangeType.Added:
                    // Preprocessed .tt files should be handled by R# itself as if it's a normal project file,
                    // so that it has access to the current project types.
                    if (projectFile.LanguageType.Is<T4ProjectFileType>() && !projectFile.IsPreprocessedT4Template()) {
                        AddFile(projectFile, changeBuilder);
                        return true;
                    }
                    break;

                case PsiModuleChange.ChangeType.Removed:
                    if (_modules.TryGetValue(projectFile, out moduleWrapper)) {
                        RemoveFile(projectFile, changeBuilder, moduleWrapper);
                        return true;
                    }
                    break;

                case PsiModuleChange.ChangeType.Modified:
                    if (_modules.TryGetValue(projectFile, out moduleWrapper)) {
                        if (!projectFile.IsPreprocessedT4Template()) {
                            ModifyFile(changeBuilder, moduleWrapper);
                            return true;
                        }

                        // The T4 file went from Transformed to Preprocessed, it doesn't need a T4PsiModule anymore.
                        RemoveFile(projectFile, changeBuilder, moduleWrapper);
                        changeType = PsiModuleChange.ChangeType.Added;
                        return false;
                    }

                    // The T4 file went from Preprocessed to Transformed, it now needs a T4PsiModule.
                    if (projectFile.LanguageType.Is<T4ProjectFileType>() && !projectFile.IsPreprocessedT4Template()) {
                        AddFile(projectFile, changeBuilder);
                        changeType = PsiModuleChange.ChangeType.Removed;
                        return false;
                    }

                    break;

            }

            return false;
        }
开发者ID:remcoros,项目名称:ForTea,代码行数:59,代码来源:T4PsiModuleProvider.cs


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