예제 #1
0
        Type _GetTypeWithASM(string typeName, AsmInfo info, string namespaceName)
        {
            Type type;

            if (_shortTypeNames.TryGetValue(typeName, out type))
            {
                return(type);
            }

            string fullName = null;

            if (!string.IsNullOrEmpty(namespaceName))
            {
                fullName = namespaceName + "." + typeName;
            }

            type = Type.GetType(typeName);
            if (type == null && info != null)
            {
                type = info._asm.GetType(typeName);
                if (type == null && fullName != null)
                {
                    //CSLog.D ("full name:" + fullName + ":");
                    type = info._asm.GetType(fullName);
                    if (type == null)
                    {
                        type = Type.GetType(fullName);
                    }
                }
            }

            if (type == null)
            {
                //still cannot find it. all search...
                int len = _assemblies.Length;
                for (int i = 0; i < len; ++i)
                {
                    Assembly asm = _assemblies[i];
                    type = asm.GetType(typeName);
                    if (type != null)
                    {
                        break;
                    }
                    if (fullName != null)
                    {
                        type = asm.GetType(fullName);
                        if (type != null)
                        {
                            break;
                        }
                    }
                }
            }
            return(type);
        }
예제 #2
0
        void InitializeAssemblyLookup()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            _assemblies = currentDomain.GetAssemblies();

            int len = _assemblies.Length;

            for (int i = 0; i < len; ++i)
            {
                Assembly asm  = _assemblies[i];
                string   name = asm.GetCleanName();

                AsmInfo info = new AsmInfo()
                {
                    _name = name,
                    _asm  = asm,
                };
                //CSLog.D ("adding: " + name);
                _assemblyLookup[name] = info;
            }
        }