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
|
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
|
https://github.com/mephraim/ghostscriptsharp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -6,7 +6,13 @@ namespace PdfScribe
|
|||||||
{
|
{
|
||||||
internal static class NativeMethods
|
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
|
#region Hooks into Ghostscript DLL
|
||||||
[DllImport("gsdll64.dll", EntryPoint = "gsapi_new_instance")]
|
[DllImport("gsdll64.dll", EntryPoint = "gsapi_new_instance")]
|
||||||
internal static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);
|
internal static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);
|
||||||
|
@ -18,7 +18,9 @@ namespace PdfScribe
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// Install the global exception handler
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Application_UnhandledException);
|
||||||
|
|
||||||
var activityWindowThread = new Thread(new ThreadStart(() =>
|
var activityWindowThread = new Thread(new ThreadStart(() =>
|
||||||
{
|
{
|
||||||
activityWindow = new Application();
|
activityWindow = new Application();
|
||||||
@ -34,10 +36,11 @@ namespace PdfScribe
|
|||||||
String standardInputFilename = Path.GetTempFileName();
|
String standardInputFilename = Path.GetTempFileName();
|
||||||
String outputFilename = Path.Combine(Path.GetTempPath(), "OAISISSOFTSCAN.PDF");
|
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 };
|
String.Format("-sOutputFile={0}", outputFilename), standardInputFilename };
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Remove the existing OAISISSOFTSCAN.PDF file if present
|
// Remove the existing OAISISSOFTSCAN.PDF file if present
|
||||||
@ -75,5 +78,15 @@ namespace PdfScribe
|
|||||||
activityWindow.Dispatcher.InvokeShutdown();
|
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();
|
RemovePDFScribePrinterDriver();
|
||||||
DeletePdfScribePort(PORTNAME);
|
DeletePdfScribePort(PORTNAME);
|
||||||
RemovePdfScribePortMonitor();
|
RemovePdfScribePortMonitor();
|
||||||
|
RemovePdfScribePortConfig();
|
||||||
return printerUninstalled;
|
return printerUninstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,6 +572,24 @@ namespace PdfScribeCore
|
|||||||
|
|
||||||
return registryChangesMade;
|
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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user