internal sealed override RuntimeTypeInfo UncachedGetTypeCoreCaseSensitive(string fullName) { string[] parts = fullName.Split('.'); int numNamespaceParts = parts.Length - 1; string[] namespaceParts = new string[numNamespaceParts]; for (int i = 0; i < numNamespaceParts; i++) { namespaceParts[numNamespaceParts - i - 1] = parts[i]; } string name = parts[numNamespaceParts]; foreach (QScopeDefinition scopeDefinition in AllScopes) { MetadataReader reader = scopeDefinition.Reader; ScopeDefinitionHandle scopeDefinitionHandle = scopeDefinition.Handle; NamespaceDefinition namespaceDefinition; if (!TryResolveNamespaceDefinitionCaseSensitive(reader, namespaceParts, scopeDefinitionHandle, out namespaceDefinition)) { continue; } // We've successfully drilled down the namespace chain. Now look for a top-level type matching the type name. TypeDefinitionHandleCollection candidateTypes = namespaceDefinition.TypeDefinitions; foreach (TypeDefinitionHandle candidateType in candidateTypes) { TypeDefinition typeDefinition = candidateType.GetTypeDefinition(reader); if (typeDefinition.Name.StringEquals(name, reader)) { return(candidateType.ResolveTypeDefinition(reader)); } } // No match found in this assembly - see if there's a matching type forwarder. TypeForwarderHandleCollection candidateTypeForwarders = namespaceDefinition.TypeForwarders; foreach (TypeForwarderHandle typeForwarderHandle in candidateTypeForwarders) { TypeForwarder typeForwarder = typeForwarderHandle.GetTypeForwarder(reader); if (typeForwarder.Name.StringEquals(name, reader)) { RuntimeAssemblyName redirectedAssemblyName = typeForwarder.Scope.ToRuntimeAssemblyName(reader); RuntimeAssemblyInfo redirectedAssembly = RuntimeAssemblyInfo.GetRuntimeAssemblyIfExists(redirectedAssemblyName); if (redirectedAssembly == null) { return(null); } return(redirectedAssembly.GetTypeCoreCaseSensitive(fullName)); } } } return(null); }
} // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandleCollection values) { values = new TypeForwarderHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return(offset); } // Read
} // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandleCollection values) { values = new TypeForwarderHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read