protected virtual void Dispose(bool disposing) { if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); handle = IntPtr.Zero; } }
public void Dispose(bool disposing) { if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); handle = IntPtr.Zero; } }
public virtual void Dispose(bool disposing) #endif { if (Handle != IntPtr.Zero) { CFObject.CFRelease(Handle); Handle = IntPtr.Zero; } }
protected virtual void Dispose(bool disposing) { if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); } handle = IntPtr.Zero; AddressBook = null; }
protected override bool ReleaseHandle() { if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); } SetHandle(IntPtr.Zero); return(true); }
public NSObject GetLocalizedAttribute (NSString attribute, out NSString language) { IntPtr lang; var o = Runtime.GetNSObject (CTFontDescriptorCopyLocalizedAttribute (handle, attribute.Handle, out lang)); o.DangerousRelease (); language = (NSString) Runtime.GetNSObject (lang); if (lang != IntPtr.Zero) CFObject.CFRelease (lang); return o; }
protected override bool ReleaseHandle() { if (owner != IntPtr.Zero) { CFObject.CFRelease(owner); owner = IntPtr.Zero; SetHandle(IntPtr.Zero); return(true); } return(base.ReleaseHandle()); }
public CTFontDescriptor[] GetMatchingFontDescriptors (NSSet mandatoryAttributes) { var cfArrayRef = CTFontDescriptorCreateMatchingFontDescriptors (handle, mandatoryAttributes == null ? IntPtr.Zero : mandatoryAttributes.Handle); if (cfArrayRef == IntPtr.Zero) return new CTFontDescriptor [0]; var matches = NSArray.ArrayFromHandle (cfArrayRef, fd => new CTFontDescriptor (cfArrayRef, false)); CFObject.CFRelease (cfArrayRef); return matches; }
protected virtual void Dispose(bool disposing) { if (handle != IntPtr.Zero) { lock (handles) handles.Remove(handle); CFObject.CFRelease(handle); handle = IntPtr.Zero; } }
static string ReturnString(IntPtr newStringHandle) { if (newStringHandle == IntPtr.Zero) { return(null); } var ret = CFString.FetchString(newStringHandle); CFObject.CFRelease(newStringHandle); return(ret); }
public NSObject GetLocalizedAttribute(NSString attribute, out NSString language) { IntPtr lang; var o = Runtime.GetNSObject(CTFontDescriptorCopyLocalizedAttribute(handle, attribute.Handle, out lang)); language = Runtime.GetNSObject <NSString> (lang); if (lang != IntPtr.Zero) { CFObject.CFRelease(lang); } return(o); }
protected virtual void Dispose(bool disposing) { if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); } if (sender.IsAllocated) { sender.Free(); } handle = IntPtr.Zero; }
protected virtual void Dispose(bool disposing) { if (invalidate.IsAllocated) { invalidate.Free(); } if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); handle = IntPtr.Zero; } }
public string[] GetSupportedLanguages() { var cfArrayRef = CTFontCopySupportedLanguages(handle); if (cfArrayRef == IntPtr.Zero) { return(new string [0]); } var languages = NSArray.ArrayFromHandle <string> (cfArrayRef, CFString.FetchString); CFObject.CFRelease(cfArrayRef); return(languages); }
protected virtual void Dispose(bool disposing) { queueObjects = null; if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); handle = IntPtr.Zero; } if (gch.IsAllocated) { gch.Free(); } }
// according to webkit source code (the only use I could find) this is an array of CFString // https://github.com/WebKit/webkit/blob/master/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp static public string[] GetPreferredCharacteristics() { var handle = MAAudibleMediaCopyPreferredCharacteristics(); if (handle == IntPtr.Zero) { return(null); } var result = NSArray.StringArrayFromHandle(handle); CFObject.CFRelease(handle); // *Copy* API return(result); }
public CTFontDescriptor[] GetMatchingFontDescriptors() { var cfArrayRef = CTFontCollectionCreateMatchingFontDescriptors(handle); if (cfArrayRef == IntPtr.Zero) { return(new CTFontDescriptor [0]); } var matches = NSArray.ArrayFromHandle(cfArrayRef, fd => new CTFontDescriptor(fd, false)); CFObject.CFRelease(cfArrayRef); return(matches); }
public CTFontDescriptor [] GetMatchingFontDescriptors(CTFontCollectionOptions options) { var cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsWithOptions(handle, options == null ? IntPtr.Zero : options.Dictionary.Handle); if (cfArrayRef == IntPtr.Zero) { return(Array.Empty <CTFontDescriptor> ()); } var matches = NSArray.ArrayFromHandle(cfArrayRef, fd => new CTFontDescriptor(fd, false)); CFObject.CFRelease(cfArrayRef); return(matches); }
static public SecStatusCode ImportPkcs12(CFData data, CFDictionary options, out CFDictionary [] array) { if (options == null) { throw new ArgumentNullException("options"); } IntPtr handle; SecStatusCode code = SecPKCS12Import(data.Handle, options.Handle, out handle); array = CFArray.ArrayFromHandle <CFDictionary> (handle, h => new CFDictionary(h, false)); CFObject.CFRelease(handle); return(code); }
public VTStatus CopyBlackPixelBuffer(out CVPixelBuffer pixelBuffer) { if (Handle == IntPtr.Zero) { throw new ObjectDisposedException("DecompressionSession"); } IntPtr ret; var result = VTDecompressionSessionCopyBlackPixelBuffer(Handle, out ret); pixelBuffer = Runtime.GetINativeObject <CVPixelBuffer> (ret, true); CFObject.CFRelease(ret); return(result); }
static public StatusCode TryGetSupportedInterfaces(out string[] supportedInterfaces) { IntPtr array = CNCopySupportedInterfaces(); if (array == IntPtr.Zero) { supportedInterfaces = null; return(StatusCodeError.SCError()); } supportedInterfaces = NSArray.StringArrayFromHandle(array); CFObject.CFRelease(array); return(StatusCode.OK); }
public CTFontFeatureSettings[] GetFeatureSettings() { var cfArrayRef = CTFontCopyFeatureSettings(handle); if (cfArrayRef == IntPtr.Zero) { return(new CTFontFeatureSettings [0]); } var featureSettings = NSArray.ArrayFromHandle(cfArrayRef, d => new CTFontFeatureSettings((NSDictionary)Runtime.GetNSObject(d))); CFObject.CFRelease(cfArrayRef); return(featureSettings); }
public CTFontVariationAxes[] GetVariationAxes() { var cfArrayRef = CTFontCopyVariationAxes(handle); if (cfArrayRef == IntPtr.Zero) { return(new CTFontVariationAxes [0]); } var axes = NSArray.ArrayFromHandle(cfArrayRef, d => new CTFontVariationAxes((NSDictionary)Runtime.GetNSObject(d))); CFObject.CFRelease(cfArrayRef); return(axes); }
public CTFontTable[] GetAvailableTables(CTFontTableOptions options) { var cfArrayRef = CTFontCopyAvailableTables(handle, options); if (cfArrayRef == IntPtr.Zero) { return(new CTFontTable [0]); } var tables = NSArray.ArrayFromHandle(cfArrayRef, v => { return((CTFontTable)(uint)v); }); CFObject.CFRelease(cfArrayRef); return(tables); }
public string[] GetEmailAddresses() { string[] results = null; IntPtr emails; if (SecCertificateCopyEmailAddresses(handle, out emails) == 0) { results = NSArray.StringArrayFromHandle(emails); if (emails != IntPtr.Zero) { CFObject.CFRelease(emails); } } return(results); }
static SecStatusCode ImportPkcs12(CFData data, CFDictionary options, out CFDictionary[] array) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var code = SecPKCS12Import(data.Handle, options.Handle, out var handle); array = CFArray.ArrayFromHandle <CFDictionary> (handle, h => new CFDictionary(h, false)); if (handle != IntPtr.Zero) { CFObject.CFRelease(handle); } return(code); }
public CFHTTPMessage GetResponseHeader() { var handle = GetProperty(_ResponseHeader); if (handle == IntPtr.Zero) { return(null); } if (CFType.GetTypeID(handle) != CFHTTPMessage.GetTypeID()) { CFObject.CFRelease(handle); throw new InvalidCastException(); } return(new CFHTTPMessage(handle)); }
static InitConstants() { // ensure we can init. CFObject.CFRelease(ABAddressBook.ABAddressBookCreate()); ABGroupProperty.Init(); ABLabel.Init(); ABPersonAddressKey.Init(); ABPersonDateLabel.Init(); ABPersonInstantMessageKey.Init(); ABPersonInstantMessageService.Init(); ABPersonKindId.Init(); ABPersonPhoneLabel.Init(); ABPersonPropertyId.Init(); ABPersonRelatedNamesLabel.Init(); ABPersonUrlLabel.Init(); }
public CFHTTPMessage?GetFinalRequest() { var handle = GetProperty(_FinalRequest); if (handle == IntPtr.Zero) { return(null); } if (CFType.GetTypeID(handle) != CFHTTPMessage.GetTypeID()) { CFObject.CFRelease(handle); throw new InvalidCastException(); } return(new CFHTTPMessage(handle, true)); }
public string GetLocalizedName(PMPrinter printer) { if (printer == null) { throw new ArgumentNullException(nameof(printer)); } IntPtr name; var code = PMPaperCreateLocalizedName(handle, printer.handle, out name); if (code != PMStatusCode.Ok) { return(null); } var str = CFString.FetchString(name); CFObject.CFRelease(name); return(str); }