private void BuildTypesCache() { var allTypes = SourceAssemblies .SelectMany(c => c._GetTypes(Warnings) .Where(d => d.GetCustomAttribute <TsAttributeBase>(false) != null || d.GetCustomAttribute <TsThirdPartyAttribute>() != null)) .Union(Project.BlueprintedTypes) .Distinct() .ToList(); _allTypesHash = new HashSet <Type>(allTypes); if (Hierarchical) { foreach (var type in _allTypesHash) { Project.AddFileSeparationSettings(type); } } if (!Hierarchical) { TypesToFilesMap = new Dictionary <string, IEnumerable <Type> >(); } else { TypesToFilesMap = allTypes.Where(d => Project.Blueprint(d).ThirdParty == null) .GroupBy(c => GetPathForType(c, stripExtension: false)) .ToDictionary(c => c.Key, c => c.AsEnumerable()); } }
private TypeSig Import(TypeSig typeSig) { if (typeSig.DefinitionAssembly != null && SourceAssemblies.Contains(typeSig.DefinitionAssembly.Name)) { var baseTypeSig = typeSig; if (typeSig.IsSZArray || typeSig.IsByRef || typeSig.IsArray) { baseTypeSig = typeSig.Next; } else if (typeSig.IsFunctionPointer || typeSig.IsPointer || typeSig.IsPinned || typeSig.IsModuleSig || typeSig.IsGenericParameter || typeSig.IsGenericTypeParameter || typeSig.IsGenericInstanceType || typeSig.IsGenericMethodParameter || typeSig.IsValueArray) { throw new NotImplementedException(); } TypeSig importedTypeSig; if (baseTypeSig.IsGenericInstanceType) { importedTypeSig = RemapGenericInstSig(baseTypeSig.ToGenericInstSig()); } else { var name = baseTypeSig.FullName; var targetTypeDef = TargetModule.FindThrow(name, false); importedTypeSig = Module.Import(targetTypeDef).ToTypeSig(); if (Options.Resolve) { importedTypeSig.ToTypeDefOrRef().ResolveTypeDefThrow(); } } if (typeSig.IsSZArray) { return(new SZArraySig(importedTypeSig)); } else if (typeSig.IsByRef) { return(new ByRefSig(importedTypeSig)); } else if (typeSig.IsArray) { var arraySig = typeSig.ToArraySig(); return(new ArraySig(importedTypeSig, arraySig.Rank, arraySig.Sizes, arraySig.LowerBounds)); } else { return(importedTypeSig); } } return(typeSig); }
private void ProcessRecord(AssemblyInfoRecord record) { var assemblyName = new System.Reflection.AssemblyName(record.AssemblyFullName); if (SourceAssemblies.Contains(assemblyName.Name)) { record.AssemblyFullName = TargetModule.Assembly.FullName; } }
private void ProcessRecord(XmlnsPropertyRecord record) { string xmlNamespace = record.XmlNamespace; int assemblyStart = xmlNamespace.IndexOf(XmlnsAssemblyDefinition, StringComparison.Ordinal); if (assemblyStart == -1) { return; } // Make sure it is one of the merged assemblies string xmlAssembly = xmlNamespace.Substring(assemblyStart + XmlnsAssemblyDefinition.Length); if (!SourceAssemblies.Contains(xmlAssembly)) { return; } string xmlNsWithoutAssembly = xmlNamespace.Substring(0, assemblyStart); record.XmlNamespace = $"{xmlNsWithoutAssembly}{XmlnsAssemblyDefinition}{TargetModule.Assembly.Name}"; }