Periodic checkin
This commit is contained in:
parent
ba345e9bf0
commit
f0f69a3ee1
@ -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
|
||||
*/
|
||||
|
||||
|
@ -6,6 +6,12 @@ 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")]
|
||||
|
@ -18,6 +18,8 @@ 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(() =>
|
||||
{
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All unhandled exceptions will bubble their way up here
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
static void Application_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user