Esempio n. 1
0
        public Object Read(int key, Object obj, int update = 0)
        {
            try
            {
                IntPtr buffer;
                buffer = Marshal.AllocHGlobal(Marshal.SizeOf(obj.GetType()));

                CppToCsharpAdapter.read(my_hash_file_pointer, key, buffer, update);
                Marshal.PtrToStructure(buffer, obj);

                //Marshal.FreeHGlobal(buffer);

                return(obj);
            }
            catch (SEHException ex)
            {
                string message = CppToCsharpAdapter.GetLastErrorMessage(this.my_hash_file_pointer);
                throw new Exception(message);
            }
            catch
            {
                throw;
            }
        }