Inheritance: INativeObject, IDisposable
		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;
			}
		}
Exemple #2
0
		public override void Dispose (CTParagraphStyleSettingValue[] values, int index)
		{
			values [index].pointer = IntPtr.Zero;
			value.Dispose ();
			value = null;
		}
Exemple #3
0
		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;
			}
		}
Exemple #4
0
		public CTParagraphStyleSpecifierIntPtrsValue (CTParagraphStyleSpecifier spec, IntPtr[] value)
			: base (spec)
		{
			this.value = CFArray.FromIntPtrs (value);
		}
Exemple #5
0
		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;
			}
		}