public CameraStorageInformation[] GetStorageInformation(Context context) { int num = 0; IntPtr p = new IntPtr(); Error.CheckError(gp_camera_get_storageinfo(this.Handle, ref p, ref num, context.Handle)); CameraStorageInformation[] info_structs = new CameraStorageInformation[num]; for (int i = 0; i < num; i++) { IntPtr ptrStruct = new IntPtr(p.ToInt64() + Marshal.SizeOf(typeof(CameraStorageInformation)) * i); info_structs[i] = (CameraStorageInformation)Marshal.PtrToStructure(ptrStruct, typeof(CameraStorageInformation)); } // Free the unmanaged array Marshal.FreeHGlobal(p); return(info_structs); }
public CameraStorageInformation[] GetStorageInformation(Context context) { int num = 0; IntPtr p = new IntPtr(); Error.CheckError(gp_camera_get_storageinfo (this.Handle, ref p, ref num, context.Handle)); CameraStorageInformation[] info_structs = new CameraStorageInformation[num]; for (int i = 0; i < num; i++) { IntPtr ptrStruct = new IntPtr(p.ToInt64() + Marshal.SizeOf(typeof(CameraStorageInformation)) * i); info_structs[i] = (CameraStorageInformation)Marshal.PtrToStructure(ptrStruct, typeof(CameraStorageInformation) ); } // Free the unmanaged array Marshal.FreeHGlobal(p); return info_structs; }