diff --git a/PdfScribeCore/PdfScribeInstaller.cs b/PdfScribeCore/PdfScribeInstaller.cs index 8db7f76..7a7be0a 100644 --- a/PdfScribeCore/PdfScribeInstaller.cs +++ b/PdfScribeCore/PdfScribeInstaller.cs @@ -493,7 +493,9 @@ namespace PdfScribeCore /// An array containing the printer driver's filenames /// An array containing dependent filenames /// true if installation suceeds, false if failed - public bool InstallPdfScribePrinter(String driverSourceDirectory) + public bool InstallPdfScribePrinter(String driverSourceDirectory, + String outputHandlerCommand, + String outputHandlerArguments) { bool printerInstalled = false; @@ -518,7 +520,7 @@ namespace PdfScribeCore if (AddPdfScribePrinter()) { undoInstallActions.Push(this.RemovePdfScribePortConfig); - if (ConfigurePdfScribePort()) + if (ConfigurePdfScribePort(outputHandlerCommand, outputHandlerArguments)) printerInstalled = true; else // Failed to configure port @@ -945,6 +947,8 @@ namespace PdfScribeCore return ConfigurePdfScribePort(String.Empty, String.Empty); } + + private bool ConfigurePdfScribePort(String commandValue, String argumentsValue) { diff --git a/PdfScribeInstallCustomAction/CustomAction.cs b/PdfScribeInstallCustomAction/CustomAction.cs index 3fd3413..e5a8fda 100644 --- a/PdfScribeInstallCustomAction/CustomAction.cs +++ b/PdfScribeInstallCustomAction/CustomAction.cs @@ -8,6 +8,10 @@ using PdfScribeCore; namespace PdfScribeInstallCustomAction { + /// + /// Lotsa notes from here: + /// http://stackoverflow.com/questions/835624/how-do-i-pass-msiexec-properties-to-a-wix-c-sharp-custom-action + /// public class CustomActions { @@ -18,15 +22,48 @@ namespace PdfScribeInstallCustomAction PdfScribeInstaller installer = new PdfScribeInstaller(); if (installer.IsPdfScribePrinterInstalled()) - { resultCode = ActionResult.Success; - } else - { resultCode = ActionResult.Failure; - } return resultCode; } + + + [CustomAction] + public static ActionResult InstallPdfScribePrinter(Session session) + { + ActionResult printerInstalled; + + String driverSourceDirectory = session.CustomActionData["DriverSourceDirectory"]; + String outputCommand = session.CustomActionData["OutputCommand"]; + String outputCommandArguments = session.CustomActionData["OutputCommandArguments"]; + + PdfScribeInstaller installer = new PdfScribeInstaller(); + + if (installer.InstallPdfScribePrinter(driverSourceDirectory, + outputCommand, + outputCommandArguments)) + printerInstalled = ActionResult.Success; + else + printerInstalled = ActionResult.Failure; + + return printerInstalled; + } + + + [CustomAction] + public static ActionResult UninstallPdfScribePrinter() + { + ActionResult printerUninstalled; + + PdfScribeInstaller installer = new PdfScribeInstaller(); + if (installer.UninstallPdfScribePrinter()) + printerUninstalled = ActionResult.Success; + else + printerUninstalled = ActionResult.Failure; + + return printerUninstalled; + } } } diff --git a/PdfScribeUnitTests/UnitTests.cs b/PdfScribeUnitTests/UnitTests.cs index 279edc2..6a0e737 100644 --- a/PdfScribeUnitTests/UnitTests.cs +++ b/PdfScribeUnitTests/UnitTests.cs @@ -50,7 +50,7 @@ namespace PdfScribeUnitTests public void Test_InstallPdfScribePrinter() { var scribeInstaller = new PdfScribeInstaller(); - scribeInstaller.InstallPdfScribePrinter(@"C:\Code\PdfScribe\Lib\"); + scribeInstaller.InstallPdfScribePrinter(@"C:\Code\PdfScribe\Lib\", String.Empty, String.Empty); } //[Test]