Ejemplo n.º 1
0
        public static Class ResolveType1(string typeName)
        {
            Type type = null;

            if (!typeName.Contains("."))
            {
                lock (ShortNameType)
                {
                    if (ShortNameType.TryGetValue(typeName, out type))
                    {
                        return(type);
                    }
                }
            }
            type = type ?? Type.GetType(typeName, false, false) ?? Type.GetType(typeName, false, true);
            if (type == null)
            {
                foreach (Assembly loaded in AssembliesLoaded)
                {
                    Type t = loaded.GetType(typeName, false);
                    if (t != null)
                    {
                        return(t);
                    }
                }
                Type obj = null;
#if USE_IKVM
                try
                {
                    obj = Class.forName(typeName);
                }
                catch (java.lang.ClassNotFoundException e)
                {
                }
                catch (Exception e)
                {
                }
                if (obj != null)
                {
                    type = ikvm.runtime.Util.getInstanceTypeFromClass((Class)obj);
                }
#endif
                if (type == null)
                {
                    type = getPrimitiveType(typeName);
                }
                if (type == null)
                {
                    type = Type.GetTypeFromProgID(typeName);
                }
                if (type == null)
                {
                    try
                    {
                        type = Type.GetTypeFromCLSID(new Guid(typeName));
                    }
                    catch (FormatException)
                    {
                    }
                }
            }
            return(type);
        }