コード例 #1
0
ファイル: TypeNameParser.cs プロジェクト: zpbappi/coreclr
        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);
        }
コード例 #2
0
        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);
        }
コード例 #4
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"));
            }
            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
ファイル: TypeNameParser.cs プロジェクト: l1183479157/coreclr
 private static extern void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString);
コード例 #11
0
ファイル: TypeNameParser.cs プロジェクト: l1183479157/coreclr
 private static extern void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
コード例 #12
0
ファイル: TypeNameParser.cs プロジェクト: l1183479157/coreclr
 private static extern void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
コード例 #13
0
ファイル: TypeNameParser.cs プロジェクト: l1183479157/coreclr
 private TypeNameParser(SafeTypeNameParserHandle handle)
 {
     m_NativeParser = handle;
 }
コード例 #14
0
 protected override bool ReleaseHandle()
 {
     SafeTypeNameParserHandle._ReleaseTypeNameParser(this.handle);
     this.handle = IntPtr.Zero;
     return(true);
 }