Esempio n. 1
0
        public static IntPtr GetSize <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            IntPtr result = IntPtr.Zero;

            unsafe {
                Native.Call(obj.GetInfo(param_name, (IntPtr)0, IntPtr.Zero, &result));
            }
            return(result);
        }
Esempio n. 2
0
        public static ImageFormat Get_ImageFormat <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            ImageFormat result = new ImageFormat();

            unsafe {
                Native.Call(obj.GetInfo(param_name, (IntPtr)sizeof(ImageFormat), (IntPtr)(&result), null));
            }
            return(result);
        }
Esempio n. 3
0
        public static ulong Get_ulong <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            ulong result = 0;

            unsafe {
                Native.Call(obj.GetInfo(param_name, (IntPtr)sizeof(ulong), (IntPtr)(&result), null));
            }
            return(result);
        }
Esempio n. 4
0
        public static int Get_int <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            int result = 0;

            unsafe {
                Native.Call(obj.GetInfo(param_name, (IntPtr)sizeof(int), (IntPtr)(&result), null));
            }
            return(result);
        }
Esempio n. 5
0
        public static IntPtr Get_IntPtr <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            IntPtr result = IntPtr.Zero;

            unsafe {
                Native.Call(obj.GetInfo(param_name, (IntPtr)sizeof(IntPtr), (IntPtr)(&result), null));
            }
            return(result);
        }
Esempio n. 6
0
        public static uint[] Get_uintArray <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            unsafe {
                IntPtr size   = GetSize(obj, param_name);
                uint   count  = (uint)size / sizeof(uint);
                uint[] result = new uint[count];
                fixed(uint *p_result = result)
                {
                    Native.Call(obj.GetInfo(param_name, size, (IntPtr)p_result, null));
                }

                return(result);
            }
        }
Esempio n. 7
0
        public static string Get_string <KeyType>(IHasInfo <KeyType> obj, KeyType param_name)
        {
            string result = null;

            unsafe {
                IntPtr size   = GetSize(obj, param_name);
                IntPtr strBuf = Marshal.AllocHGlobal((int)size + 1);                 //leave room for a null terminator
                try{
                    Native.Call(obj.GetInfo(param_name, size, strBuf, null));
                    ((byte *)strBuf)[(int)size] = 0;                    //make sure the string is null terminated
                    result = Marshal.PtrToStringAnsi(strBuf);
                }
                finally{
                    Marshal.FreeHGlobal(strBuf);
                }
            }
            return(result);
        }