예제 #1
0
        public int GetInt32Value(string key)
        {
            int value = 0;

            using (var str = new CFString(key)) {
                if (!CFNumberGetValue(CFDictionaryGetValue(Handle, str.Handle), /* kCFNumberSInt32Type */ 3, out value))
                {
                    throw new System.Collections.Generic.KeyNotFoundException(string.Format("Key {0} not found", key));
                }
                return(value);
            }
        }
예제 #2
0
        static string GetError(OSStatus status)
        {
            CFString str = null;

            try {
                str = new CFString(SecCopyErrorMessageString(status, IntPtr.Zero), true);
                return(str.ToString());
            } catch {
                return(status.ToString());
            } finally {
                if (str != null)
                {
                    str.Dispose();
                }
            }
        }
예제 #3
0
        static string GetError(OSStatus status)
        {
            CFString str = null;

            try {
                str = new CFString (SecCopyErrorMessageString (status, IntPtr.Zero), true);
                return str.ToString ();
            } catch {
                return status.ToString ();
            } finally {
                if (str != null)
                    str.Dispose ();
            }
        }
예제 #4
0
 public bool ContainsKey(string key)
 {
     using (var str = new CFString(key)) {
         return(CFDictionaryContainsKey(Handle, str.Handle));
     }
 }
예제 #5
0
 public IntPtr GetIntPtrValue(string key)
 {
     using (var str = new CFString(key)) {
         return(CFDictionaryGetValue(Handle, str.Handle));
     }
 }
예제 #6
0
 //        public static bool GetBooleanValue (IntPtr theDict, IntPtr key)
 //        {
 //            var value = GetValue (theDict, key);
 //            if (value == IntPtr.Zero)
 //                return false;
 //            return CFBoolean.GetValue (value);
 //        }
 public string GetStringValue(string key)
 {
     using (var str = new CFString (key)) {
         using (var value = new CFString (CFDictionaryGetValue (Handle, str.Handle))) {
             return value.ToString ();
         }
     }
 }
예제 #7
0
 public IntPtr GetIntPtrValue(string key)
 {
     using (var str = new CFString (key)) {
         return CFDictionaryGetValue (Handle, str.Handle);
     }
 }
예제 #8
0
 public int GetInt32Value(string key)
 {
     int value = 0;
     using (var str = new CFString (key)) {
         if (!CFNumberGetValue (CFDictionaryGetValue (Handle, str.Handle), /* kCFNumberSInt32Type */ 3, out value))
             throw new System.Collections.Generic.KeyNotFoundException (string.Format ("Key {0} not found", key));
         return value;
     }
 }
예제 #9
0
 public CFDictionary GetDictionaryValue(string key)
 {
     using (var str = new CFString (key)) {
         var ptr = CFDictionaryGetValue (Handle, str.Handle);
         return ptr == IntPtr.Zero ? null : new CFDictionary (ptr);
     }
 }
예제 #10
0
 public bool ContainsKey(string key)
 {
     using (var str = new CFString (key)) {
         return CFDictionaryContainsKey (Handle, str.Handle);
     }
 }