Пример #1
0
        private static Version GetNativeVersion()
        {
            // Get the Ghostscript version.
            //      GPL Ghostscript
            //      Copyright Some Company
            //      815
            //      20040922
            // Extracted as a structure but we're only interested in the 3rd field (815).
            GhostscriptNativeMethods.GhostscriptVersion ghostscriptVersion = new GhostscriptNativeMethods.GhostscriptVersion();
            try
            {
                GhostscriptNativeMethods.GetRevision(ref ghostscriptVersion, Marshal.SizeOf(ghostscriptVersion));
            }
            catch (DllNotFoundException)
            {
                return(null);
            }
            catch (MissingMethodException)
            {
                return(null);
            }

            // Convert version from integer such as '914' to Version object 9.14
            string versionText = ((double)ghostscriptVersion.Revision / 100).ToString(CultureInfo.InvariantCulture);

            return(new Version(versionText));
        }
Пример #2
0
        private static Version GetNativeVersion()
        {
            // Get the Ghostscript version.
            //      GPL Ghostscript
            //      Copyright Some Company
            //      815
            //      20040922
            // Extracted as a structure but we're only interested in the 3rd field (815).
            GhostscriptNativeMethods.GhostscriptVersion ghostscriptVersion = new GhostscriptNativeMethods.GhostscriptVersion();
            try
            {
                GhostscriptNativeMethods.GetRevision(ref ghostscriptVersion, Marshal.SizeOf(ghostscriptVersion));
            }
            catch(DllNotFoundException)
            {
                return null;
            }
            catch(MissingMethodException)
            {
                return null;
            }

            // Convert version from integer such as '914' to Version object 9.14
            string versionText = ((double)ghostscriptVersion.Revision / 100).ToString(CultureInfo.InvariantCulture);
            return new Version(versionText);
        }