public byte[] ToByteArray(bool binary) { using (new NSAutoreleasePool()) { var pobject = Convert(); NSPropertyListFormat format = binary? NSPropertyListFormat.Binary : NSPropertyListFormat.Xml; var data = PObject.DataFromPropertyList(pobject, format, 0); if (data == null) { throw new Exception("Could not convert the NSDictionary to the specified format"); } return(data.ToArray()); } }
internal static NSData DataFromPropertyList(NSObject pobject, NSPropertyListFormat format, int options) { IntPtr errorPtr; var ptr = IntPtr_objc_msgSend_IntPtr_Int_Int_OutIntPtr( cls_NSPropertyListSerialization, sel_dataFromPropertyList_format_options_error, pobject.Handle, (int)format, options, out errorPtr); if (errorPtr != IntPtr.Zero) { var error = (NSError)MonoMac.ObjCRuntime.Runtime.GetNSObject(errorPtr); throw new Exception(error.LocalizedDescription); } if (ptr == IntPtr.Zero) { return(null); } return((NSData)MonoMac.ObjCRuntime.Runtime.GetNSObject(ptr)); }
internal static NSObject PropertyListWithData(NSData data, int options, out NSPropertyListFormat format) { IntPtr errorPtr; int formatInt; var ptr = IntPtr_objc_msgSend_IntPtr_Int_OutInt_OutIntPtr( cls_NSPropertyListSerialization, sel_propertyListWithData_options_format_error, data.Handle, options, out formatInt, out errorPtr); format = (NSPropertyListFormat)formatInt; if (errorPtr != IntPtr.Zero) { var error = (NSError)MonoMac.ObjCRuntime.Runtime.GetNSObject(errorPtr); throw new Exception(error.LocalizedDescription); } if (ptr == IntPtr.Zero) { return(null); } return(MonoMac.ObjCRuntime.Runtime.GetNSObject(ptr)); }
public static NSObject PropertyListWithStream(NSInputStream stream, ref NSPropertyListFormat format, out NSError error) { return(PropertyListWithStream(stream, NSPropertyListReadOptions.Immutable, ref format, out error)); }
public static int WritePropertyList(NSObject plist, NSOutputStream stream, NSPropertyListFormat format, out NSError error) { return(WritePropertyList(plist, stream, format, NSPropertyListWriteOptions.Immutable, out error)); }
public static NSObject PropertyListWithData(NSData data, ref NSPropertyListFormat format, out NSError error) { return(PropertyListWithData(data, NSPropertyListReadOptions.Immutable, ref format, out error)); }
public static NSObject PropertyListWithStream (NSInputStream stream, ref NSPropertyListFormat format, out NSError error) { return PropertyListWithStream (stream, NSPropertyListReadOptions.Immutable, ref format, out error); }
public static NSData DataWithPropertyList(NSObject plist, NSPropertyListFormat format, out NSError error) { return(DataWithPropertyList(plist, format, NSPropertyListWriteOptions.Immutable, out error)); }
public static int WritePropertyList (NSObject plist, NSOutputStream stream, NSPropertyListFormat format, out NSError error) { return WritePropertyList (plist, stream, format, NSPropertyListWriteOptions.Immutable, out error); }
public static NSObject PropertyListWithData (NSData data, ref NSPropertyListFormat format, out NSError error) { return PropertyListWithData (data, NSPropertyListReadOptions.Immutable, ref format, out error); }
public static NSData DataWithPropertyList (NSObject plist, NSPropertyListFormat format, out NSError error) { return DataWithPropertyList (plist, format, NSPropertyListWriteOptions.Immutable, out error); }
public static bool PropertyList(AnyObject plist, NSPropertyListFormat isValidForFormat) { return(default(bool)); }
public static int WritePropertyList(AnyObject plist, NSOutputStream toStream, NSPropertyListFormat format, NSPropertyListWriteOptions options, NSErrorPointer error) { return(default(int)); }
public static NSData DataWithPropertyList(AnyObject plist, NSPropertyListFormat format, NSPropertyListWriteOptions options, NSErrorPointer error) { return(default(NSData)); }
public static NSData DataFromPropertyList(AnyObject plist, NSPropertyListFormat format, UnsafeMutablePointer <string> errorDescription) { return(default(NSData)); }