public static T AEGetNthPtr <T> (ref AEDesc descList, int index, OSType desiredType) where T : struct { int len = Marshal.SizeOf(typeof(T)); IntPtr bufferPtr = Marshal.AllocHGlobal(len); try { CheckReturn(AEGetNthPtr(ref descList, index, desiredType, 0, 0, bufferPtr, len, 0)); T val = (T)Marshal.PtrToStructure(bufferPtr, typeof(T)); return(val); } finally{ Marshal.FreeHGlobal(bufferPtr); } }
public static void AECreateDesc(OSType typeCode, byte[] data, out AEDesc result) { CheckReturn(AECreateDesc(typeCode, data, data.Length, out result)); }
public static extern AEDescStatus AESizeOfNthItem(ref AEDesc descList, int index, ref OSType type, out int size);
static extern AEDescStatus AEGetNthPtr(ref AEDesc descList, int index, OSType desiredType, uint keyword, uint zero, out IntPtr outPtr, int bufferSize, int zero2);
static extern AEDescStatus AEGetNthPtr(ref AEDesc descList, int index, OSType desiredType, uint keyword, out CarbonEventParameterType actualType, IntPtr buffer, int bufferSize, out int actualSize);
static extern AEDescStatus AECreateDesc(OSType typeCode, byte[] data, int dataSize, out AEDesc desc);
static extern AEDescStatus AECreateDesc(OSType typeCode, IntPtr dataPtr, int dataSize, out AEDesc desc);
public static T[] GetListFromAEDesc <T, TRef> (ref AEDesc list, AEDescValueSelector <TRef, T> sel, OSType type) where TRef : struct { long count = AppleEvent.AECountItems(ref list); T[] arr = new T[count]; for (int i = 1; i <= count; i++) { TRef r = AppleEvent.AEGetNthPtr <TRef> (ref list, i, type); arr [i - 1] = sel(ref r); } return(arr); }
public static extern ComponentInstance OpenDefaultComponent(OSType componentType, OSType componentSubType);