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}"; }