Custom action additions, slight refactoring
This commit is contained in:
parent
d4b652a22e
commit
3fafd9d411
@ -493,7 +493,9 @@ namespace PdfScribeCore
|
||||
/// <param name="driverFilesToCopy">An array containing the printer driver's filenames</param>
|
||||
/// <param name="dependentFilesToCopy">An array containing dependent filenames</param>
|
||||
/// <returns>true if installation suceeds, false if failed</returns>
|
||||
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)
|
||||
{
|
||||
|
@ -8,6 +8,10 @@ using PdfScribeCore;
|
||||
|
||||
namespace PdfScribeInstallCustomAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Lotsa notes from here:
|
||||
/// http://stackoverflow.com/questions/835624/how-do-i-pass-msiexec-properties-to-a-wix-c-sharp-custom-action
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user