protected void SetBooleanValue(NSString key, bool?value) { if (NullCheckAndRemoveKey(key, !value.HasValue)) { CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, value.Value ? CFBoolean.TrueHandle : CFBoolean.FalseHandle); } }
protected void SetNativeValue(NSString key, INativeObject value, bool removeNullValue = true) { if (NullCheckAndRemoveKey(key, removeNullValue && value == null)) { CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, value == null ? IntPtr.Zero : value.Handle); } }
public SecRecord(SecKind secKind) { var kind = SecClass.FromSecKind(secKind); _queryDict = CFMutableDictionary.Create(); _queryDict.SetValue(SecClassKey, kind); }
protected void SetArrayValue(NSString key, INativeObject[] values) { if (NullCheckAndRemoveKey(key, values == null)) { CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, CFArray.FromNativeObjects(values).Handle); } }
// 'Value must be a CFArray of CFNumberRefs' - System/Library/Frameworks/CoreText.framework/Headers/CTStringAttributes.h public void SetWritingDirection(params CTWritingDirection[] writingDirections) { var ptrs = new IntPtr [writingDirections.Length]; for (int i = 0; i < writingDirections.Length; ++i) { ptrs[i] = (new NSNumber((int)writingDirections[i])).Handle; } var array = CFArray.Create(ptrs); CFMutableDictionary.SetValue(Dictionary.Handle, CTStringAttributeKey.WritingDirection.Handle, array); }
public static void SetNativeValue(NSDictionary dictionary, NSObject key, INativeObject value) { if (value != null) { AssertWritable(dictionary); CFMutableDictionary.SetValue(dictionary.Handle, key.Handle, value.Handle); } else { IDictionary <NSObject, NSObject> d = dictionary; d.Remove(key); } }
protected void SetBooleanValue(NSString key, bool?value) { if (key == null) { throw new ArgumentNullException("key"); } if (value == null) { RemoveValue(key); return; } CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, value.Value ? CFBoolean.True.Handle : CFBoolean.False.Handle); }
protected void SetArrayValue(NSString key, INativeObject[] values) { if (key == null) { throw new ArgumentNullException("key"); } if (values == null) { RemoveValue(key); return; } CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, CFArray.FromNativeObjects(values).Handle); }
protected void SetNativeValue(NSString key, INativeObject value, bool removeNullValue = true) { if (key == null) { throw new ArgumentNullException("key"); } if (value == null && removeNullValue) { RemoveValue(key); } else { CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, value == null ? IntPtr.Zero : value.Handle); } }
// 'Value must be a CFArray of CFNumberRefs' - System/Library/Frameworks/CoreText.framework/Headers/CTStringAttributes.h public void SetWritingDirection(params CTWritingDirection[] writingDirections) { var ptrs = new NativeHandle [writingDirections.Length]; var numbers = new NSNumber [writingDirections.Length]; for (int i = 0; i < writingDirections.Length; ++i) { numbers [i] = new NSNumber((int)writingDirections [i]); ptrs [i] = numbers [i].Handle; } var array = CFArray.Create(ptrs); CFMutableDictionary.SetValue(Dictionary.Handle, CTStringAttributeKey.WritingDirection.Handle, array); GC.KeepAlive(numbers); // make sure the numbers aren't freed until we're done with them }
static CFNumber SetLimit(CFMutableDictionary dict, int max) { CFNumber n = null; IntPtr val; if (max == -1) { val = MatchLimitAll; } else if (max == 1) { val = MatchLimitOne; } else { n = CFNumber.FromInt32(max); val = n.Handle; } dict.SetValue(val, SecKeyChain.MatchLimit); return(n); }
internal void SetValue(IntPtr key, IntPtr value) { _queryDict.SetValue(key, value); }