public static CFProxy[] GetProxiesForAutoConfigurationScript(NSString proxyAutoConfigurationScript, NSUrl targetURL) { if (proxyAutoConfigurationScript == null) { throw new ArgumentNullException("proxyAutoConfigurationScript"); } if (targetURL == null) { throw new ArgumentNullException("targetURL"); } NSArray array = CopyProxiesForAutoConfigurationScript(proxyAutoConfigurationScript, targetURL); if (array == null) { return(null); } NSDictionary[] dictionaries = NSArray.ArrayFromHandle <NSDictionary> (array.Handle); array.Dispose(); if (dictionaries == null) { return(null); } CFProxy[] proxies = new CFProxy [dictionaries.Length]; for (int i = 0; i < dictionaries.Length; i++) { proxies[i] = new CFProxy(dictionaries[i]); } return(proxies); }
public static ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport[]? GetAllSupportedPublicKeyCredentialDescriptorTransports() { NSString[]? nsStringArray = NSArray.ArrayFromHandle <NSString> (ASAuthorizationAllSupportedPublicKeyCredentialDescriptorTransports()); if (nsStringArray is null) { return(null); } ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport[] asArray = new ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport[nsStringArray.Count()]; for (var i = 0; i < nsStringArray.Count(); i++) { switch (nsStringArray[i].Description) { case "usb": asArray[i] = ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport.Usb; break; case "nfc": asArray[i] = ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport.Nfc; break; case "ble": asArray[i] = ASAuthorizationSecurityKeyPublicKeyCredentialDescriptorTransport.Bluetooth; break; default: break; } } return(asArray); }
public void PasteImage(NSObject sender) { // Initialize the pasteboard NSPasteboard pasteboard = NSPasteboard.GeneralPasteboard; NSArray classArray = NSArray.FromObjects(new Class("NSImage")); // TODO: Sending messages directly to the base Objective-C API because of this defect: // https://bugzilla.xamarin.com/show_bug.cgi?id=31760 // Check to see if an image is on the pasteboard bool ok = bool_objc_msgSend_IntPtr_IntPtr(pasteboard.Handle, Selector.GetHandle("canReadObjectForClasses:options:"), classArray.Handle, IntPtr.Zero); if (ok) { // Read the image off of the pasteboard NSObject [] objectsToPaste = NSArray.ArrayFromHandle <Foundation.NSObject>(IntPtr_objc_msgSend_IntPtr_IntPtr(pasteboard.Handle, Selector.GetHandle("readObjectsForClasses:options:"), classArray.Handle, IntPtr.Zero)); NSImage image = (NSImage)objectsToPaste[0]; // Display the new image ImageView.Image = image; } var classArrayPtrs = new [] { Class.GetHandle(typeof(ImageInfo)) }; classArray = NSArray.FromIntPtrs(classArrayPtrs); ok = bool_objc_msgSend_IntPtr_IntPtr(pasteboard.Handle, Selector.GetHandle("canReadObjectForClasses:options:"), classArray.Handle, IntPtr.Zero); if (ok) { // Read the image off of the pasteboard NSObject [] objectsToPaste = NSArray.ArrayFromHandle <Foundation.NSObject>(IntPtr_objc_msgSend_IntPtr_IntPtr(pasteboard.Handle, Selector.GetHandle("readObjectsForClasses:options:"), classArray.Handle, IntPtr.Zero)); Info = (ImageInfo)objectsToPaste[0]; } }
static public VTVideoEncoder [] GetEncoderList() { IntPtr array; if (VTCopyVideoEncoderList(IntPtr.Zero, out array) != VTStatus.Ok) { return(null); } var dicts = NSArray.ArrayFromHandle <NSDictionary> (array); var ret = new VTVideoEncoder [dicts.Length]; int i = 0; foreach (var dict in dicts) { ret [i] = new VTVideoEncoder( dict [VTVideoEncoderList.CodecType] as NSNumber, dict [VTVideoEncoderList.CodecName] as NSString, dict [VTVideoEncoderList.DisplayName] as NSString, dict [VTVideoEncoderList.EncoderID] as NSString, dict [VTVideoEncoderList.EncoderName] as NSString); i++; } CFObject.CFRelease(array); return(ret); }
public List <string> GetScannerList() { SbtSdkApi = (SbtSdkApiWrapper)Zebra.SbtSdkFactory.CreateInstance(); SbtSdkApi.SbtSetDelegate(new MyDelegate()); SbtSdkApi.SetOperationalMode(OperationalMode.Mfi); var bob = SbtSdkApi.EnableAvailableScannersDetection(true); var availableReaders = new NSMutableArray(); var availableHandle = availableReaders.Handle; var n = SbtSdkApi.GetAvailableScannersList(ref availableHandle); var scanners = NSArray.ArrayFromHandle <ScannerInfo>(availableHandle); var availableReaders2 = new NSMutableArray(); var availableHandle2 = availableReaders2.Handle; var m = SbtSdkApi.GetActiveScannersList(ref availableHandle2); var scanners2 = NSArray.ArrayFromHandle <ScannerInfo>(availableHandle2); List <string> result = new List <string>(); SbtSdkApi.EstablishCommunicationSession(0); return(result); }
public float[] this [NSString key] { get { if (key == null) { throw new ArgumentNullException(nameof(key)); } var a = CFDictionary.GetValue(Dictionary.Handle, key.Handle); return(NSArray.ArrayFromHandle <float> (a, input => { return new NSNumber(input).FloatValue; })); } set { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (value == null) { RemoveValue(key); } else { Dictionary [key] = NSArray.From(value); } } }
public ABGroup [] GetGroups() { AssertValid(); IntPtr cfArrayRef = ABAddressBookCopyArrayOfAllGroups(Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABGroup(h))); }
public ABRecord [] GetMembers (ABPersonSortBy sortOrdering) { var cfArrayRef = ABGroupCopyArrayOfAllMembersWithSortOrdering (Handle, sortOrdering); if (cfArrayRef == IntPtr.Zero) return new ABRecord [0]; return NSArray.ArrayFromHandle (cfArrayRef, h => ABRecord.FromHandle (h, AddressBook)); }
public static NSArray <NSValue> [] ConvertPdfLinesToViewLines(NSArray <NSValue> [] lines, PSPDFPageInfo pageInfo, CGRect viewBounds) { var arr = NSArray.FromNSObjects(lines); var ret = _ConvertPDFLinesToViewLines(arr.Handle, pageInfo.Handle, viewBounds); return(NSArray.ArrayFromHandle <NSArray <NSValue> > (ret)); }
public static CFProxy[] GetProxiesForURL(NSUrl url, CFProxySettings proxySettings) { if (url == null) { throw new ArgumentNullException("url"); } if (proxySettings == null) { proxySettings = GetSystemProxySettings(); } NSArray array = CopyProxiesForURL(url, proxySettings.Dictionary); if (array == null) { return(null); } NSDictionary[] dictionaries = NSArray.ArrayFromHandle <NSDictionary> (array.Handle); array.Dispose(); if (dictionaries == null) { return(null); } CFProxy[] proxies = new CFProxy [dictionaries.Length]; for (int i = 0; i < dictionaries.Length; i++) { proxies[i] = new CFProxy(dictionaries[i]); } return(proxies); }
public static NSValue [] ConvertViewLineToPdfLines(NSValue [] line, PSPDFPageInfo pageInfo, CGRect bounds) { var arr = NSArray.FromNSObjects(line); var ret = _ConvertViewLineToPDFLines(arr.Handle, pageInfo.Handle, bounds); return(NSArray.ArrayFromHandle <NSValue> (ret)); }
public override bool Reload(string fileName) { if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException("fileName"); } var pool = new NSAutoreleasePool(); SuppressChangeEvents = true; try { list.Clear(); var nsa = NSArray.FromFile(fileName); if (nsa != null) { var arr = NSArray.ArrayFromHandle <NSObject> (nsa.Handle); foreach (var f in arr) { Add(PDictionary.FromNSObject(f)); } } else { return(false); } } finally { SuppressChangeEvents = false; pool.Dispose(); } OnChanged(EventArgs.Empty); return(true); }
public static IMTLDevice [] GetAllDevices(ref NSObject observer, MTLDeviceNotificationHandler handler) { if (observer == null) { throw new ArgumentNullException("observer"); } IntPtr handle = observer.Handle; unsafe { BlockLiteral *block_ptr_handler; BlockLiteral block_handler; block_handler = new BlockLiteral(); block_ptr_handler = &block_handler; block_handler.SetupBlockUnsafe(static_notificationHandler, handler); var rv = MTLCopyAllDevicesWithObserver(ref handle, (void *)block_ptr_handler); var obj = NSArray.ArrayFromHandle <IMTLDevice> (rv); if (handle != observer.Handle) { observer = Runtime.GetNSObject(handle); } return(obj); } }
public ABPerson [] GetPeople() { ThrowIfDisposed(); IntPtr cfArrayRef = ABAddressBookCopyArrayOfAllPeople(Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABPerson(h, this))); }
public ABSource [] GetAllSources() { ThrowIfDisposed(); IntPtr cfArrayRef = ABAddressBookCopyArrayOfAllSources(Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABSource(h, this))); }
public ABGroup [] GetGroups() { ThrowIfDisposed(); IntPtr cfArrayRef = ABAddressBookCopyArrayOfAllGroups(Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABGroup(h, this))); }
public virtual NSObject[] ListImages(string ipAddress, string folder) { if (ipAddress == null) { throw new ArgumentNullException("ipAddress"); } if (folder == null) { throw new ArgumentNullException("folder"); } var nsipAddress = NSString.CreateNative(ipAddress); var nsfolder = NSString.CreateNative(folder); NSObject[] ret; if (IsDirectBinding) { ret = NSArray.ArrayFromHandle <NSObject>(global::ApiDefinition.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(this.Handle, Selector.GetHandle("listImages:workFolder:"), nsipAddress, nsfolder)); } else { ret = NSArray.ArrayFromHandle <NSObject>(global::ApiDefinition.Messaging.IntPtr_objc_msgSendSuper_IntPtr_IntPtr(this.SuperHandle, Selector.GetHandle("listImages:workFolder:"), nsipAddress, nsfolder)); } NSString.ReleaseNative(nsipAddress); NSString.ReleaseNative(nsfolder); return(ret); }
public ABPerson [] GetPeople() { AssertValid(); IntPtr cfArrayRef = ABAddressBookCopyArrayOfAllPeople(Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABPerson(h))); }
public static NSError [] RegisterFontsForUrl(NSUrl [] fontUrls, CTFontManagerScope scope) { if (fontUrls == null) { throw new ArgumentNullException("fontUrls"); } foreach (var furl in fontUrls) { if (furl == null) { throw new ArgumentException("contains a null entry", "fontUrls"); } } using (var arr = NSArray.FromNSObjects(fontUrls)) { IntPtr error_array = IntPtr.Zero; try { if (CTFontManagerRegisterFontsForURLs(arr.Handle, scope, ref error_array)) { return(null); } else { return(NSArray.ArrayFromHandle <NSError> (error_array)); } } finally { if (error_array != IntPtr.Zero) { NSObject.DangerousRelease(error_array); } } } }
public static NSArray <NSValue> [] ConvertPdfLinesToViewLines(NSArray <NSValue> [] lines, CGRect cropBox, nuint rotation, CGRect bounds) { var arr = NSArray.FromNSObjects(lines); var ret = _ConvertPDFLinesToViewLines(arr.Handle, cropBox, rotation, bounds); return(NSArray.ArrayFromHandle <NSArray <NSValue> > (ret)); }
public virtual T [] GetResults <T> () where T : VNObservation { // From docs: If the request failed, this property will be nil; // otherwise, it will be an array of zero or more VNObservation // subclasses specific to the VNRequest subclass. // ArrayFromHandle<T> does the null checking for us. return(NSArray.ArrayFromHandle <T> (_Results)); }
public ABPerson [] GetPeopleWithName(string name) { IntPtr cfArrayRef; using (var s = new NSString(name)) cfArrayRef = ABAddressBookCopyPeopleWithName(Handle, s.Handle); return(NSArray.ArrayFromHandle(cfArrayRef, h => new ABPerson(h, this))); }
public static IMTLDevice [] GetAllDevices() { var rv = MTLCopyAllDevices(); var devices = NSArray.ArrayFromHandle <IMTLDevice> (rv); NSObject.DangerousRelease(rv); return(devices); }
public static NSObject[] AllHUDsForView(global::UIKit.UIView view) { if (view == null) { throw new ArgumentNullException("view"); } return(NSArray.ArrayFromHandle <NSObject>(global::ApiDefinition.Messaging.IntPtr_objc_msgSend_IntPtr(class_ptr, Selector.GetHandle("allHUDsForView:"), view.Handle))); }
public static NSObject[] GetParamList(NSData data) { if (data == null) { throw new ArgumentNullException("data"); } return(NSArray.ArrayFromHandle <NSObject>(global::ApiDefinition.Messaging.IntPtr_objc_msgSend_IntPtr(class_ptr, Selector.GetHandle("getParamList:"), data.Handle))); }
public static NdefRecord[] ParseData(NSData data, bool ignoreMbMe) { if (data == null) { throw new ArgumentNullException("data"); } return(NSArray.ArrayFromHandle <NdefRecord>(global::ApiDefinitions.Messaging.IntPtr_objc_msgSend_IntPtr_bool(class_ptr, Selector.GetHandle("parseData:andIgnoreMbMe:"), data.Handle, ignoreMbMe))); }
public static LPMessageEntity[] HandleConsumerMessagesResponse(EngagementHistoryConsumerMessagesResponse response) { if (response == null) { throw new ArgumentNullException("response"); } return(NSArray.ArrayFromHandle <LPMessageEntity>(global::ApiDefinition.Messaging.IntPtr_objc_msgSend_IntPtr(class_ptr, Selector.GetHandle("handleConsumerMessagesResponse:"), response.Handle))); }
public static NSWindow[] OrderedWindows(this NSApplication self) { var selector = new ObjCRuntime.Selector("orderedWindows"); var ptr = LibObjc.IntPtr_objc_msgSend(self.Handle, selector.Handle); var array = NSArray.ArrayFromHandle <NSWindow>(ptr); return(array); }
public static T [] GetShuffledArray <T> (this NSArray This, GKRandomSource randomSource) where T : class, INativeObject { if (randomSource == null) { throw new ArgumentNullException(nameof(randomSource)); } return(NSArray.ArrayFromHandle <T> (Messaging.IntPtr_objc_msgSend_IntPtr(This.Handle, Selector.GetHandle("shuffledArrayWithRandomSource:"), randomSource.Handle))); }
public void INativeObjects() { using (var policy = SecPolicy.CreateSslPolicy(true, "mail.xamarin.com")) { using (var a = NSArray.FromObjects(policy)) { var b = NSArray.ArrayFromHandle <SecPolicy> (a.Handle); Assert.AreNotSame(a, b); } } }