예제 #1
0
        public static void AddExportMethod(string exportClassName, MethodInfo info)
        {
            ExportClass ec = GetExportClass(exportClassName);

            ec.fullClassName   = info.DeclaringType.ToString();
            ec.className       = Rolance.Utils.cutNamespace(info.DeclaringType.ToString());
            ec.exportClassName = exportClassName;
            bool isGetter = false;
            bool isSetter = false;
            //因为有函数重载,所以这里不能直接使用名字,避免名字重复
            string methodName = info.Name + info.GetHashCode();

            isGetter = info.Name.StartsWith("get_");
            isSetter = info.Name.StartsWith("set_");
            if (isGetter || isSetter)
            {
                methodName = info.Name.Substring(4);
            }
            ExportMethod em = ec.GetMethod(methodName);

            em.isGetter   = em.isGetter || isGetter;
            em.isSetter   = em.isSetter || isSetter;
            em.methodName = methodName;

            //方法的处理
            em.isStaticFunc = info.IsStatic;
            em.info         = info;
        }
예제 #2
0
        public static void AddExportProperty(string exportClassName, FieldInfo info)
        {
            ExportClass ec = GetExportClass(exportClassName);

            ec.fullClassName   = info.DeclaringType.ToString();
            ec.className       = Rolance.Utils.cutNamespace(info.DeclaringType.ToString());
            ec.exportClassName = exportClassName;

            string         propertyName = info.Name;
            ExportProperty ep           = ec.GetProperty(propertyName);

            ep.propertyName = propertyName;

            ep.fi = info;
        }
예제 #3
0
        public static void AddExportEnum(string exportClassName, FieldInfo info)
        {
            ExportClass ec = GetExportClass(exportClassName);

            ec.fullClassName   = info.DeclaringType.ToString();
            ec.className       = Rolance.Utils.cutNamespace(info.DeclaringType.ToString());
            ec.exportClassName = exportClassName;

            string     enumName = info.Name;
            ExportEnum ep       = ec.GetEnum(enumName);

            ep.enumName = enumName;

            ep.fi = info;
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="className"></param>
        /// <returns></returns>
        private static ExportClass GetExportClass(string className)
        {
            ExportClass ec;

            if (cacheDict.ContainsKey(className))
            {
                ec = cacheDict[className];
            }
            else
            {
                ec = new ExportClass();

                cacheDict.Add(className, ec);
            }

            return(ec);
        }
예제 #5
0
        public static void AddExportClass(string exportClassName, Type t)
        {
            ExportClass ec = GetExportClass(exportClassName);

            ec.type = t;
        }
예제 #6
0
        public static void ExportClass(string className)
        {
            ExportClass ec = cacheDict[className];

            ec.Export();
        }