Пример #1
0
        public static string GetClassName(Type type)
        {
            string className = ClassManager.GetClassAlias(type);

            if (className == null)
            {
                className = type.FullName.Replace('.', '_').Replace('+', '_');
                int index = className.IndexOf('`');
                if (index > 0)
                {
                    className = className.Substring(0, index);
                }
                ClassManager.Register(type, className);
            }
            return(className);
        }
Пример #2
0
        public static Type GetClass(string className)
        {
            if (ClassManager.ContainsClass(className))
            {
                return(ClassManager.GetClass(className));
            }
#if !(dotNET10 || dotNET11 || dotNETCF10)
            List <int> positions = new List <int>();
#else
            ArrayList positions = new ArrayList();
#endif
            int pos = className.IndexOf('_');
            while (pos > -1)
            {
                positions.Add(pos);
                pos = className.IndexOf('_', pos + 1);
            }
            Type type;
            if (positions.Count > 0)
            {
                StringBuilder name = new StringBuilder(className);
                type = GetType(name, positions, 0, '.');
                if (type == null)
                {
                    type = GetType(name, positions, 0, '_');
                }
                if (type == null)
                {
                    type = GetNestedType(name, positions, 0, '+');
                }
            }
            else
            {
                type = GetType(className.ToString());
            }
            ClassManager.Register(type, className);
            return(type);
        }