예제 #1
0
        public void RegisterNativeClass(Type classType, string pkgNameRegTo)
        {
            if (!classType.IsClass)
            {
                throw new RuntimeException("Require class type");
            }

            var pkg = GetPackageByName(pkgNameRegTo);

            if (pkg == null)
            {
                pkg = AddPackage(new Package(pkgNameRegTo, true));
            }

            Type instClass;
            var  classAttr = GetCustomAttribute <NativeWrapperClassAttribute>(classType);

            // 自动生成代码绑定
            if (classAttr != null)
            {
                instClass = classAttr.BindingClass;
            }
            else
            {
                instClass = classType;
            }

            var lanClass = new ValueNativeClassType(pkg, instClass, new ObjectName(pkg.Name, instClass.Name));

            lanClass.BuildMember(instClass.Name, classType);

            // 还需要扫描实例类本体有手动添加的
            if (instClass != classType)
            {
                lanClass.BuildMember(instClass.Name, instClass);
            }

            AddClassType(lanClass);
        }
예제 #2
0
 internal ValueNativeClassIns(ValueNativeClassType t, object nativeIns)
 {
     _type = t;
     _data = nativeIns;
 }