Пример #1
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary>
 internal ExportedFile(HashSet <Type> typesToExport, string fileName, InspectedReferences references, ExportContext context)
 {
     _context             = context;
     TypesToExport        = typesToExport;
     FileName             = fileName;
     AllTypesIsSingleFile = !_context.Hierarchical;
     References           = references;
     TypeResolver         = new TypeResolver(this);
     AddReferencesFromTypes();
 }
        private void InspectGlobalReferences()
        {
            var assemblies = SourceAssemblies;
            var references = assemblies.Where(c => c.GetCustomAttributes <TsReferenceAttribute>().Any())
                             .SelectMany(c => c.GetCustomAttributes <TsReferenceAttribute>())
                             .Select(c => c.ToReference())
                             .Union(Project.References);

            if (Global.UseModules)
            {
                var imports = assemblies.Where(c => c.GetCustomAttributes <TsImportAttribute>().Any())
                              .SelectMany(c => c.GetCustomAttributes <TsImportAttribute>())
                              .Select(c => c.ToImport())
                              .Union(Project.Imports);
                _globalReferences = new InspectedReferences(references, imports);
                return;
            }
            _globalReferences = new InspectedReferences(references);
        }