Exemplo n.º 1
0
        public static object Unbox(IntPtr cPtr, bool ownMemory, NativeTypeInfo info)
        {
            object value = null;

            UnboxDelegate unboxFunction;

            if (_unboxFunctions.TryGetValue(info.Type, out unboxFunction))
            {
                value = unboxFunction(cPtr);
            }
            else if (info.Type == typeof(Boxed <Enum>))
            {
                int            enumValue    = 0;
                IntPtr         enumType     = NoesisGUI_.Unbox_CustomEnum(cPtr, ref enumValue);
                NativeTypeInfo enumTypeInfo = GetNativeTypeInfo(enumType);
                value = Enum.ToObject(enumTypeInfo.Type, enumValue);
            }
            else
            {
                Log.Error("Can't unbox native pointer");
            }

            if (ownMemory)
            {
                BaseComponent.Release(cPtr);
            }

            return(value);
        }
Exemplo n.º 2
0
        public static object Unbox(IntPtr cPtr, NativeTypeInfo info)
        {
            UnboxDelegate unboxFunction;

            if (_unboxFunctions.TryGetValue(info.Type, out unboxFunction))
            {
                return(unboxFunction(cPtr));
            }

            throw new InvalidOperationException("Can't unbox native pointer");
        }
Exemplo n.º 3
0
        public static object Unbox(IntPtr cPtr, bool ownMemory, NativeTypeInfo info)
        {
            object value = null;

            UnboxDelegate unboxFunction;

            if (_unboxFunctions.TryGetValue(info.Type, out unboxFunction))
            {
                value = unboxFunction(cPtr);
            }
            else
            {
                Log.Error("Can't unbox native pointer");
            }

            if (ownMemory)
            {
                BaseComponent.Release(cPtr);
            }

            return(value);
        }