diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-05-07 13:43:28 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:39:35 -0700 |
commit | 6b99e7b1295d094323c10401f8b21c81c29554eb (patch) | |
tree | f80a2475c1726f219c362c65c5714f6cc217d4f4 /platform/winrt/gsview/ghostsharp.cs | |
parent | 5a46e015e177bc09769be1e6576845d567ebc70c (diff) | |
download | mupdf-6b99e7b1295d094323c10401f8b21c81c29554eb.tar.xz |
Addition of about window. Extraction of GS version and MuPDF version.
Diffstat (limited to 'platform/winrt/gsview/ghostsharp.cs')
-rw-r--r-- | platform/winrt/gsview/ghostsharp.cs | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/platform/winrt/gsview/ghostsharp.cs b/platform/winrt/gsview/ghostsharp.cs index 07099985..e4610d79 100644 --- a/platform/winrt/gsview/ghostsharp.cs +++ b/platform/winrt/gsview/ghostsharp.cs @@ -128,12 +128,12 @@ namespace gsview } /* from gs */ - struct gsapi_revision_t + public struct gsapi_revision_t { - IntPtr product; - IntPtr copyright; - long revision; - long revisiondate; + public IntPtr product; + public IntPtr copyright; + public int revision; + public int revisiondate; } public enum gsEncoding { @@ -155,7 +155,6 @@ namespace gsview public const int GS_READ_BUFFER = 32768; } - [SuppressUnmanagedCodeSecurity] class ghostsharp { @@ -166,7 +165,7 @@ namespace gsview /* Ghostscript API */ [DllImport("gsdll64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern int gsapi_revision(IntPtr stuct, int size); + public static extern int gsapi_revision(ref gsapi_revision_t vers, int size); [DllImport("gsdll64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] @@ -739,6 +738,29 @@ namespace gsview return gsStatus.GS_READY; } + public String GetVersion() + { + gsapi_revision_t vers; + vers.copyright = IntPtr.Zero; + vers.product = IntPtr.Zero; + vers.revision = 0; + vers.revisiondate = 0; + int size = System.Runtime.InteropServices.Marshal.SizeOf(vers); + + if (gsapi_revision(ref vers, size) == 0) + { + String product = Marshal.PtrToStringAnsi(vers.product); + String output; + int major = vers.revision / 100; + int minor = vers.revision - major * 100; + String versnum = major + "." + minor; + output = product + " " + versnum; + return output; + } + else + return null; + } + private gsStatus RunGhostscript(gsParams_t Params) { try |