static AccessoryInfo[] ExtractAccessoryInfo (IntPtr ptr, NSString id, NSString description) { using (var array = new CFArray (ptr)) { var res = new AccessoryInfo [array.Count]; for (int i = 0; i < res.Length; ++i) { var dict = array.GetValue (i); var n = new NSNumber (CFDictionary.GetValue (dict, id.Handle)); var desc = CFString.FetchString (CFDictionary.GetValue (dict, description.Handle)); res [i] = new AccessoryInfo ((int) n, desc); id.Dispose (); } return res; } }
public override void Dispose (CTParagraphStyleSettingValue[] values, int index) { values [index].pointer = IntPtr.Zero; value.Dispose (); value = null; }
public IOHIDElement[] GetAllElements () { ThrowIfDisposed (); var arrayRef = IOHIDDeviceCopyMatchingElements (Handle, IntPtr.Zero, 0); if (arrayRef == IntPtr.Zero) return null; using (var array = new CFArray (arrayRef, true)) { var elements = new IOHIDElement[array.Count]; for (int i = 0; i < elements.Length; i++) elements [i] = new IOHIDElement (array.GetValue (i), true); return elements; } }
public CTParagraphStyleSpecifierIntPtrsValue (CTParagraphStyleSpecifier spec, IntPtr[] value) : base (spec) { this.value = CFArray.FromIntPtrs (value); }
public IOHIDElement[] GetMatchingElements (IDictionary<string, ValueType> matchingDictionary) { ThrowIfDisposed (); if (matchingDictionary == null) throw new ArgumentNullException ("matchingDictionary"); var matching = NSDictionary.FromObjectsAndKeys (matchingDictionary.Values.ToArray (), matchingDictionary.Keys.ToArray ()); var arrayRef = IOHIDDeviceCopyMatchingElements (Handle, matching.Handle, 0); if (arrayRef == IntPtr.Zero) return null; using (var array = new CFArray (arrayRef, true)) { var elements = new IOHIDElement[array.Count]; for (int i = 0; i < elements.Length; i++) elements [i] = new IOHIDElement(array.GetValue (i), true); return elements; } }