From ca6f38f8872d572a4afc3ad37de03c2fea3c214b Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 4 Oct 2018 16:10:30 -0500 Subject: [PATCH 1/3] Bind 2 high visibility PrintCore APIs - https://github.com/xamarin/xamarin-macios/issues/4713 --- src/PrintCore/PrintCore.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/PrintCore/PrintCore.cs b/src/PrintCore/PrintCore.cs index 6707dbc65032..29ed228799d0 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 { From 47bb97447d12b2bfd8014418cebd3ffad7be2271 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 5 Oct 2018 09:45:29 -0500 Subject: [PATCH 2/3] Remove 2 new APIs from xtro list --- tests/xtro-sharpie/macOS-PrintCore.ignore | 2 -- 1 file changed, 2 deletions(-) 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 From 0b9e01c425d5bd476fbd6b1d69b1a7d403544768 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Wed, 10 Oct 2018 16:12:08 -0500 Subject: [PATCH 3/3] Fix Id --- src/PrintCore/PrintCore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrintCore/PrintCore.cs b/src/PrintCore/PrintCore.cs index 29ed228799d0..3295e97dc5f0 100644 --- a/src/PrintCore/PrintCore.cs +++ b/src/PrintCore/PrintCore.cs @@ -756,7 +756,7 @@ public bool IsRemote { [DllImport (Constants.PrintCoreLibrary)] extern static IntPtr PMPrinterGetID (IntPtr printer); - public string ID { + public string Id { get { return CFString.FetchString (PMPrinterGetID (handle)); }