コード例 #1
0
        public static Type findType(Instance instance, string csharpId)
        {
            lock (_mutex)
            {
                Type t;
                if (_typeTable.TryGetValue(csharpId, out t))
                {
                    return(t);
                }
#if COMPACT || SILVERLIGHT
                string[] assemblies = instance.factoryAssemblies();
                for (int i = 0; i < assemblies.Length; ++i)
                {
                    string s = csharpId + "," + assemblies[i];
                    if ((t = Type.GetType(s)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return(t);
                    }
                }
                //
                // As a last resort, look for the type in the standard Ice assemblies.
                // This avoids the need for a program to set a property such as:
                //
                // Ice.FactoryAssemblies=Ice
                //
                foreach (string a in _iceAssemblies)
                {
                    string s = csharpId + "," + a;
                    if ((t = Type.GetType(s)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return(t);
                    }
                }
#else
                loadAssemblies(); // Lazy initialization
                foreach (Assembly a in _loadedAssemblies.Values)
                {
                    if ((t = a.GetType(csharpId)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return(t);
                    }
                }
#endif
            }
            return(null);
        }
コード例 #2
0
ファイル: AssemblyUtil.cs プロジェクト: joshmoore/ice
        public static Type findType(Instance instance, string csharpId)
        {
            lock(_mutex)
            {
                Type t;
                if (_typeTable.TryGetValue(csharpId, out t))
                {
                    return t;
                }
#if COMPACT || SILVERLIGHT
                string[] assemblies = instance.factoryAssemblies();
                for(int i = 0; i < assemblies.Length; ++i)
                {
                    string s = csharpId + "," + assemblies[i];
                    if((t = Type.GetType(s)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return t;
                    }
                }
                //
                // As a last resort, look for the type in the standard Ice assemblies.
                // This avoids the need for a program to set a property such as:
                //
                // Ice.FactoryAssemblies=Ice
                //
                foreach(string a in _iceAssemblies)
                {
                    string s = csharpId + "," + a;
                    if((t = Type.GetType(s)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return t;
                    }
                }
#else
                loadAssemblies(); // Lazy initialization
                foreach (Assembly a in _loadedAssemblies.Values)
                {
                    if((t = a.GetType(csharpId)) != null)
                    {
                        _typeTable[csharpId] = t;
                        return t;
                    }
                }
#endif
            }
            return null;
        }