From 7c1d23d41173fdaae8802f17087b58e2c389e841 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 11 Oct 2018 09:14:48 -0500 Subject: [PATCH] Bind 2 high visibility PrintCore APIs (#4933) - https://github.com/xamarin/xamarin-macios/issues/4713 --- src/PrintCore/PrintCore.cs | 20 ++++++++++++++++++++ tests/xtro-sharpie/macOS-PrintCore.ignore | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/PrintCore/PrintCore.cs b/src/PrintCore/PrintCore.cs index 6707dbc65032..3295e97dc5f0 100644 --- a/src/PrintCore/PrintCore.cs +++ b/src/PrintCore/PrintCore.cs @@ -753,6 +753,26 @@ public bool IsRemote { } } + [DllImport (Constants.PrintCoreLibrary)] + extern static IntPtr PMPrinterGetID (IntPtr printer); + + public string Id { + get { + return CFString.FetchString (PMPrinterGetID (handle)); + } + } + + [DllImport (Constants.PrintCoreLibrary)] + extern static PMStatusCode PMPrinterCopyHostName (IntPtr printer, out IntPtr hostName); + + public string HostName { + get { + PMStatusCode code = PMPrinterCopyHostName (handle, out IntPtr hostName); + if (code != PMStatusCode.Ok) + return null; + return CFString.FetchString (hostName, true); + } + } } public class PMServer : PMPrintCoreBase { diff --git a/tests/xtro-sharpie/macOS-PrintCore.ignore b/tests/xtro-sharpie/macOS-PrintCore.ignore index 8dc51237478f..1b4c5ffcd801 100644 --- a/tests/xtro-sharpie/macOS-PrintCore.ignore +++ b/tests/xtro-sharpie/macOS-PrintCore.ignore @@ -21,13 +21,11 @@ !missing-pinvoke! PMPresetCreatePrintSettings is not bound !missing-pinvoke! PMPresetGetAttributes is not bound !missing-pinvoke! PMPrinterCopyDescriptionURL is not bound -!missing-pinvoke! PMPrinterCopyHostName is not bound !missing-pinvoke! PMPrinterCopyPresets is not bound !missing-pinvoke! PMPrinterCopyState is not bound !missing-pinvoke! PMPrinterGetCommInfo is not bound !missing-pinvoke! PMPrinterGetDriverCreator is not bound !missing-pinvoke! PMPrinterGetDriverReleaseInfo is not bound -!missing-pinvoke! PMPrinterGetID is not bound !missing-pinvoke! PMPrinterGetIndexedPrinterResolution is not bound !missing-pinvoke! PMPrinterGetLanguageInfo is not bound !missing-pinvoke! PMPrinterGetLocation is not bound