diff --git a/PdfScribe/GhostScript64.cs b/PdfScribe/GhostScript64.cs
index 535fcae..b9eba8e 100644
--- a/PdfScribe/GhostScript64.cs
+++ b/PdfScribe/GhostScript64.cs
@@ -10,6 +10,8 @@ namespace PdfScribe
{
/*
This code was adapted from Matthew Ephraim's Ghostscript.Net project
+ external dll definitions moved into NativeMethods to
+ satisfy FxCop requirements
https://github.com/mephraim/ghostscriptsharp
*/
diff --git a/PdfScribe/NativeMethods.cs b/PdfScribe/NativeMethods.cs
index db8cdb1..17dd90b 100644
--- a/PdfScribe/NativeMethods.cs
+++ b/PdfScribe/NativeMethods.cs
@@ -6,7 +6,13 @@ namespace PdfScribe
{
internal static class NativeMethods
{
-
+ /*
+ This code was adapted from Matthew Ephraim's Ghostscript.Net project -
+ external dll definitions moved into NativeMethods to
+ satisfy FxCop requirements
+ https://github.com/mephraim/ghostscriptsharp
+ */
+
#region Hooks into Ghostscript DLL
[DllImport("gsdll64.dll", EntryPoint = "gsapi_new_instance")]
internal static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);
diff --git a/PdfScribe/Program.cs b/PdfScribe/Program.cs
index 5802a1f..407f8c0 100644
--- a/PdfScribe/Program.cs
+++ b/PdfScribe/Program.cs
@@ -18,7 +18,9 @@ namespace PdfScribe
[STAThread]
static void Main(string[] args)
{
-
+ // Install the global exception handler
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Application_UnhandledException);
+
var activityWindowThread = new Thread(new ThreadStart(() =>
{
activityWindow = new Application();
@@ -34,10 +36,11 @@ namespace PdfScribe
String standardInputFilename = Path.GetTempFileName();
String outputFilename = Path.Combine(Path.GetTempPath(), "OAISISSOFTSCAN.PDF");
- String[] ghostScriptArguments = { "-dBATCH", "-dNOPAUSE", "-dSAFER", "-dCompatibilityLevel=1.4", "-dPDFSETTINGS=/prepress", "-sDEVICE=pdfwrite",
+ // Only set absolute minimum parameters, let the postscript input
+ // dictate as much as possible
+ String[] ghostScriptArguments = { "-dBATCH", "-dNOPAUSE", "-dSAFER", "-sDEVICE=pdfwrite",
String.Format("-sOutputFile={0}", outputFilename), standardInputFilename };
-
try
{
// Remove the existing OAISISSOFTSCAN.PDF file if present
@@ -75,5 +78,15 @@ namespace PdfScribe
activityWindow.Dispatcher.InvokeShutdown();
}
}
+
+ ///
+ /// All unhandled exceptions will bubble their way up here
+ ///
+ ///
+ ///
+ static void Application_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/PdfScribeCore/PdfScribeInstaller.cs b/PdfScribeCore/PdfScribeInstaller.cs
index 7e65c9b..25097d5 100644
--- a/PdfScribeCore/PdfScribeInstaller.cs
+++ b/PdfScribeCore/PdfScribeInstaller.cs
@@ -353,6 +353,7 @@ namespace PdfScribeCore
RemovePDFScribePrinterDriver();
DeletePdfScribePort(PORTNAME);
RemovePdfScribePortMonitor();
+ RemovePdfScribePortConfig();
return printerUninstalled;
}
@@ -571,6 +572,24 @@ namespace PdfScribeCore
return registryChangesMade;
}
+
+ private bool RemovePdfScribePortConfig()
+ {
+ bool registryEntriesRemoved = false;
+
+ try
+ {
+ Registry.LocalMachine.DeleteSubKey("SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors\\" +
+ PORTMONITOR + "\\Ports\\" + PORTNAME, false);
+ registryEntriesRemoved = true;
+ }
+ catch (UnauthorizedAccessException)
+ { }
+
+ return registryEntriesRemoved;
+
+ }
+
#endregion
}