Пример #1
0
        internal static Type GetType(
            string typeName,
            Func <AssemblyName, Assembly> assemblyResolver,
            Func <Assembly, string, bool, Type> typeResolver,
            bool throwOnError,
            bool ignoreCase,
            ref StackCrawlMark stackMark)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            if (typeName.Length > 0 && typeName[0] == '\0')
            {
                throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
            }
            Contract.EndContractBlock();

            Type ret = null;

            SafeTypeNameParserHandle handle = CreateTypeNameParser(typeName, throwOnError);

            if (handle != null)
            {
                // If we get here the typeName must have been successfully parsed.
                // Let's construct the Type object.
                using (TypeNameParser parser = new TypeNameParser(handle))
                {
                    ret = parser.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
                }
            }

            return(ret);
        }
        private static SafeTypeNameParserHandle CreateTypeNameParser(string typeName, bool throwOnError)
        {
            SafeTypeNameParserHandle o = null;

            _CreateTypeNameParser(typeName, JitHelpers.GetObjectHandleOnStack <SafeTypeNameParserHandle>(ref o), throwOnError);
            return(o);
        }
Пример #3
0
        internal static Type GetType(string typeName, Func <AssemblyName, Assembly> assemblyResolver, Func <Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            if (typeName.Length > 0 && (int)typeName[0] == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
            }
            Type type = (Type)null;
            SafeTypeNameParserHandle typeNameParser1 = TypeNameParser.CreateTypeNameParser(typeName, throwOnError);

            if (typeNameParser1 != null)
            {
                using (TypeNameParser typeNameParser2 = new TypeNameParser(typeNameParser1))
                    type = typeNameParser2.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
            }
            return(type);
        }
        internal static Type GetType(string typeName, Func <AssemblyName, Assembly> assemblyResolver, Func <Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            if ((typeName.Length > 0) && (typeName[0] == '\0'))
            {
                throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
            }
            Type type = null;
            SafeTypeNameParserHandle handle = CreateTypeNameParser(typeName, throwOnError);

            if (handle == null)
            {
                return(type);
            }
            using (TypeNameParser parser = new TypeNameParser(handle))
            {
                return(parser.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark));
            }
        }
Пример #5
0
 private static partial void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString);
Пример #6
0
 private static partial void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
Пример #7
0
 private static partial void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
Пример #8
0
 private static extern void _GetNames(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
Пример #9
0
        private static readonly char[] SPECIAL_CHARS = { ',', '[', ']', '&', '*', '+', '\\' }; /* see typeparse.h */
        #endregion

        #region Constructor and Disposer
        private TypeNameParser(SafeTypeNameParserHandle handle)
        {
            m_NativeParser = handle;
        }
Пример #10
0
 private static extern void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString);
Пример #11
0
 private static extern void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
Пример #12
0
 private static extern void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
Пример #13
0
 private TypeNameParser(SafeTypeNameParserHandle handle)
 {
     m_NativeParser = handle;
 }
Пример #14
0
 protected override bool ReleaseHandle()
 {
     SafeTypeNameParserHandle._ReleaseTypeNameParser(this.handle);
     this.handle = IntPtr.Zero;
     return(true);
 }