예제 #1
0
        private void BuildFunctions()
        {
            if (m_functions != null)
            {
                return;
            }

            int count = InterfaceTypeNative.GetFunctionCount(m_nativeInstance);

            m_functions = new InterfaceFunction[count];
            for (int functionIndex = 0; functionIndex < count; functionIndex++)
            {
                InterfaceFunction func;
                func.Name       = Marshal.PtrToStringAnsi(InterfaceTypeNative.GetFunctionName(m_nativeInstance, functionIndex));
                func.ReturnType = m_collection.GetTypeFromHandle(InterfaceTypeNative.GetFunctionReturnType(m_nativeInstance, functionIndex));

                int parameterCount = InterfaceTypeNative.GetFunctionParameterCount(m_nativeInstance, functionIndex);
                func.Parameters = new InterfaceFunctionParameter[parameterCount];
                for (int parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++)
                {
                    InterfaceFunctionParameter param;
                    param.Name = Marshal.PtrToStringAnsi(InterfaceTypeNative.GetFunctionParameterName(m_nativeInstance, functionIndex, parameterIndex));
                    param.Type = m_collection.GetTypeFromHandle(InterfaceTypeNative.GetFunctionParameterType(m_nativeInstance, functionIndex, parameterIndex));

                    func.Parameters[parameterIndex] = param;
                }

                m_functions[functionIndex] = func;
            }
        }
예제 #2
0
        private void BuildProperties()
        {
            if (m_properties != null)
            {
                return;
            }

            int count = InterfaceTypeNative.GetPropertyCount(m_nativeInstance);

            m_properties = new InterfaceProperty[count];
            for (int i = 0; i < count; i++)
            {
                InterfaceProperty prop;
                prop.Name      = Marshal.PtrToStringAnsi(InterfaceTypeNative.GetPropertyName(m_nativeInstance, i));
                prop.Type      = m_collection.GetTypeFromHandle(InterfaceTypeNative.GetPropertyType(m_nativeInstance, i));
                prop.HasGetter = InterfaceTypeNative.GetPropertyHasGetter(m_nativeInstance, i);
                prop.HasSetter = InterfaceTypeNative.GetPropertyHasSetter(m_nativeInstance, i);

                m_properties[i] = prop;
            }
        }