private void ExtractReferences() { if (_isAnalyzed) { return; } _settings.Documentation = new DocumentationManager(_settings.GenerateDocumentation ? _settings.DocumentationFilePath : null); var fluentConfigurationPresents = _settings.ConfigurationMethod != null; if (fluentConfigurationPresents) { var configurationBuilder = new ConfigurationBuilder(); _settings.ConfigurationMethod(configurationBuilder); _configurationRepository = configurationBuilder.Build(); ConfigurationRepository.Instance = _configurationRepository; foreach (var additionalDocumentationPath in _configurationRepository.AdditionalDocumentationPathes) { _settings.Documentation.CacheDocumentation(additionalDocumentationPath); } } _allTypes = _settings.SourceAssemblies .SelectMany(c => c.GetTypes().Where(d => d.GetCustomAttribute <TsAttributeBase>(false) != null)) .Union(ConfigurationRepository.Instance.AttributesForType.Keys).Distinct() .ToList(); _allTypesHash = new HashSet <Type>(_allTypes); if (_settings.Hierarchical) { foreach (var type in _allTypesHash) { ConfigurationRepository.Instance.AddFileSeparationSettings(type); } } var grp = _allTypes.GroupBy(c => c.GetNamespace(true)); _namespace = grp.Where(g => !string.IsNullOrEmpty(g.Key)) // avoid anonymous types .ToDictionary(k => k.Key, v => v.ToList()); _settings.SourceAssemblies.Where(c => c.GetCustomAttributes <TsReferenceAttribute>().Any()) .SelectMany(c => c.GetCustomAttributes <TsReferenceAttribute>()) .Select(c => string.Format("/// <reference path=\"{0}\"/>", c.Path)) .Union( ConfigurationRepository.Instance.References.Select( c => string.Format("/// <reference path=\"{0}\"/>", c))) .ToList() .ForEach(a => _referenceBuilder.AppendLine(a)); _settings.References = _referenceBuilder.ToString(); _isAnalyzed = true; }
private void ExtractReferences() { if (_isAnalyzed) { return; } _context.Documentation = new DocumentationManager(_context.GenerateDocumentation ? _context.DocumentationFilePath : null, _context.Warnings); var fluentConfigurationPresents = _context.ConfigurationMethod != null; if (fluentConfigurationPresents) { var configurationBuilder = new ConfigurationBuilder(); _context.ConfigurationMethod(configurationBuilder); _configurationRepository = configurationBuilder.Build(); ConfigurationRepository.Instance = _configurationRepository; foreach (var additionalDocumentationPath in _configurationRepository.AdditionalDocumentationPathes) { _context.Documentation.CacheDocumentation(additionalDocumentationPath, _context.Warnings); } } _allTypes = _context.SourceAssemblies .SelectMany(c => c.GetTypes().Where(d => d.GetCustomAttribute <TsAttributeBase>(false) != null)) .Union(ConfigurationRepository.Instance.AttributesForType.Keys).Distinct() .ToList(); _allTypesHash = new HashSet <Type>(_allTypes); if (_context.Hierarchical) { foreach (var type in _allTypesHash) { ConfigurationRepository.Instance.AddFileSeparationSettings(type); } } _context.SourceAssemblies.Where(c => c.GetCustomAttributes <TsReferenceAttribute>().Any()) .SelectMany(c => c.GetCustomAttributes <TsReferenceAttribute>()) .Select(c => string.Format("/// <reference path=\"{0}\"/>", c.Path)) .Union( ConfigurationRepository.Instance.References.Select( c => string.Format("/// <reference path=\"{0}\"/>", c))) .ToList() .ForEach(a => _referenceBuilder.AppendLine(a)); _context.References = _referenceBuilder.ToString(); _isAnalyzed = true; }