예제 #1
0
 public T4DeclaredAssembliesInfo([NotNull] IT4File baseFile)
 {
     foreach (var directive in baseFile.GetThisAndChildrenOfType <IT4AssemblyDirective>())
     {
         HandleAssemblyDirective(directive);
     }
 }
예제 #2
0
        protected override T4MacroResolutionRequest Build(IT4File file)
        {
            var macros = file
                         .GetThisAndChildrenOfType <IT4Macro>()
                         .Distinct(macro => macro.RawAttributeValue.GetText());

            return(new T4MacroResolutionRequest(macros.ToList()));
        }
예제 #3
0
        protected override T4IncludeData Build(IT4File file)
        {
            if (file.PhysicalPsiSourceFile?.IsBeingIndirectlyUpdated() == true)
            {
                // Since the contents of this file did not change,
                // the list of its direct includes did not change either,
                // so there's no point in doing anything here
                return(null);
            }

            return(new T4IncludeData(file
                                     .GetThisAndChildrenOfType <IT4IncludeDirective>()
                                     .Where(directive => directive.IsVisibleInDocument())
                                     .Select(directive => IncludeResolver.ResolvePath(directive.ResolvedPath))
                                     .Where(path => !path.IsEmpty)
                                     .Distinct()
                                     .ToList()
                                     ));
        }
        public static string GetTargetExtension([NotNull] this IT4File file)
        {
            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }

            var    extension       = T4DirectiveInfoManager.Output.ExtensionAttribute;
            string targetExtension = file
                                     .GetThisAndChildrenOfType <IT4OutputDirective>()
                                     .FirstOrDefault()
                                     ?.GetFirstAttribute(extension)
                                     ?.Value
                                     .GetText();

            if (targetExtension == null)
            {
                return(DefaultTargetExtension);
            }

            return(targetExtension.StartsWith(".", StringComparison.Ordinal)
                                ? targetExtension.Substring(1)
                                : targetExtension);
        }