예제 #1
0
            internal override void Write(Stream writer)
            {
                var type       = _val as TypeResolution;
                var typeHandle = new AddinTypeHandle(type.Assembly.Uid, type.MetadataToken);

                typeHandle.Write(writer);
            }
예제 #2
0
        public Type GetType(AddinTypeHandle addinTypeHandle)
        {
            Requires.Instance.NotNull(addinTypeHandle, "addinTypeHandle");

            var assembly = _asmResolver.GetOrLoadAssemblyByUid(addinTypeHandle.AssemblyUid);

            if (assembly == null)
            {
                return(null);
            }
            var modules = assembly.GetLoadedModules(false);

            foreach (var module in modules)
            {
                try
                {
                    // Module.ResolveType Method (Int32, Type[], Type[])
                    // To resolve a metadata token for a TypeSpec whose signature contains ELEMENT_TYPE_VAR or ELEMENT_TYPE_MVAR,
                    // use the ResolveType(Int32, Type[], Type[]) method overload, which allows you to supply the necessary context.
                    // That is, when you are resolving a metadata token for a type that depends on the generic type parameters of the
                    // generic type and/or the generic method in which the token is embedded, you must use the overload that allows
                    // you to supply those type parameters.
                    return(module.ResolveType(addinTypeHandle.MetadataToken));
                }
                catch
                {
                    continue;
                }
            }
            return(null);
        }
예제 #3
0
            internal override void Read(Stream reader)
            {
                var val = new AddinTypeHandle();

                val.Read(reader);
                _val = val;
            }