Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 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 ();
            }
        }
Ejemplo n.º 4
0
 public bool ContainsKey(string key)
 {
     using (var str = new CFString(key)) {
         return(CFDictionaryContainsKey(Handle, str.Handle));
     }
 }
Ejemplo n.º 5
0
 public IntPtr GetIntPtrValue(string key)
 {
     using (var str = new CFString(key)) {
         return(CFDictionaryGetValue(Handle, str.Handle));
     }
 }
Ejemplo n.º 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 ();
         }
     }
 }
Ejemplo n.º 7
0
 public IntPtr GetIntPtrValue(string key)
 {
     using (var str = new CFString (key)) {
         return CFDictionaryGetValue (Handle, str.Handle);
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 10
0
 public bool ContainsKey(string key)
 {
     using (var str = new CFString (key)) {
         return CFDictionaryContainsKey (Handle, str.Handle);
     }
 }