예제 #1
0
 protected void SetBooleanValue(NSString key, bool?value)
 {
     if (NullCheckAndRemoveKey(key, !value.HasValue))
     {
         CFMutableDictionary.SetValue(Dictionary.Handle, key.Handle, value.Value ? CFBoolean.TrueHandle : CFBoolean.FalseHandle);
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
파일: Items.cs 프로젝트: stretyak/mono
        public SecRecord(SecKind secKind)
        {
            var kind = SecClass.FromSecKind(secKind);

            _queryDict = CFMutableDictionary.Create();
            _queryDict.SetValue(SecClassKey, kind);
        }
예제 #4
0
 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);
     }
 }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
            }
        }
예제 #10
0
        // '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
        }
예제 #11
0
        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);
        }
예제 #12
0
파일: Items.cs 프로젝트: stretyak/mono
 internal void SetValue(IntPtr key, IntPtr value)
 {
     _queryDict.SetValue(key, value);
 }