periodic commit
This commit is contained in:
parent
8604972520
commit
ba10c1d0a6
@ -17,19 +17,26 @@ namespace PdfScribeInstallCustomAction
|
|||||||
public class CustomActions
|
public class CustomActions
|
||||||
{
|
{
|
||||||
|
|
||||||
static readonly String traceSourceName = "PdfScribeInstaller";
|
|
||||||
|
|
||||||
[CustomAction]
|
[CustomAction]
|
||||||
public static ActionResult CheckIfPrinterNotInstalled(Session session)
|
public static ActionResult CheckIfPrinterNotInstalled(Session session)
|
||||||
{
|
{
|
||||||
ActionResult resultCode;
|
ActionResult resultCode;
|
||||||
TextWriterTraceListener installTraceListener = new TextWriterTraceListener("C:\\testout.txt");
|
SessionLogWriterTraceListener installTraceListener = new SessionLogWriterTraceListener(session);
|
||||||
PdfScribeInstaller installer = new PdfScribeInstaller();
|
PdfScribeInstaller installer = new PdfScribeInstaller();
|
||||||
installer.AddTraceListener(installTraceListener);
|
installer.AddTraceListener(installTraceListener);
|
||||||
if (installer.IsPdfScribePrinterInstalled())
|
try
|
||||||
resultCode = ActionResult.Success;
|
{
|
||||||
else
|
if (installer.IsPdfScribePrinterInstalled())
|
||||||
resultCode = ActionResult.Failure;
|
resultCode = ActionResult.Success;
|
||||||
|
else
|
||||||
|
resultCode = ActionResult.Failure;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (installTraceListener != null)
|
||||||
|
installTraceListener.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
||||||
@ -64,23 +71,37 @@ namespace PdfScribeInstallCustomAction
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (installTraceListener != null) installTraceListener.Dispose();
|
if (installTraceListener != null)
|
||||||
|
installTraceListener.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
return printerInstalled;
|
return printerInstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[CustomAction]
|
[CustomAction]
|
||||||
public static ActionResult UninstallPdfScribePrinter()
|
public static ActionResult UninstallPdfScribePrinter(Session session)
|
||||||
{
|
{
|
||||||
ActionResult printerUninstalled;
|
ActionResult printerUninstalled;
|
||||||
|
|
||||||
PdfScribeInstaller installer = new PdfScribeInstaller();
|
SessionLogWriterTraceListener installTraceListener = new SessionLogWriterTraceListener(session);
|
||||||
if (installer.UninstallPdfScribePrinter())
|
installTraceListener.TraceOutputOptions = TraceOptions.DateTime;
|
||||||
printerUninstalled = ActionResult.Success;
|
|
||||||
else
|
|
||||||
printerUninstalled = ActionResult.Failure;
|
|
||||||
|
|
||||||
|
PdfScribeInstaller installer = new PdfScribeInstaller();
|
||||||
|
installer.AddTraceListener(installTraceListener);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (installer.UninstallPdfScribePrinter())
|
||||||
|
printerUninstalled = ActionResult.Success;
|
||||||
|
else
|
||||||
|
printerUninstalled = ActionResult.Failure;
|
||||||
|
installTraceListener.CloseAndWriteLog();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (installTraceListener != null)
|
||||||
|
installTraceListener.Dispose();
|
||||||
|
}
|
||||||
return printerUninstalled;
|
return printerUninstalled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,12 @@ namespace PdfScribeInstallCustomAction
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Releases resources held by the listener -
|
/// Releases resources held by the listener -
|
||||||
/// Note will not automatically flush and write
|
/// will not automatically flush and write
|
||||||
/// trace data to the install session -
|
/// trace data to the install session log -
|
||||||
/// call CloseAndWriteLog() before disposing
|
/// call CloseAndWriteLog() before disposing
|
||||||
|
/// to ensure data is written
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public new void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
@ -70,7 +71,7 @@ namespace PdfScribeInstallCustomAction
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the listener and writes accumulated
|
/// Closes the listener and writes accumulated
|
||||||
/// trace data to the install session's log (Session.Log)
|
/// trace data to the install session's log (Session.Log)
|
||||||
/// The listener will no longer be usable after calling
|
/// The listener should not be used after calling
|
||||||
/// this method, and should be disposed of.
|
/// this method, and should be disposed of.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CloseAndWriteLog()
|
public void CloseAndWriteLog()
|
||||||
@ -79,7 +80,6 @@ namespace PdfScribeInstallCustomAction
|
|||||||
this.installSession != null)
|
this.installSession != null)
|
||||||
{
|
{
|
||||||
this.Flush();
|
this.Flush();
|
||||||
this.Close();
|
|
||||||
if (this.listenerStream.Length > 0)
|
if (this.listenerStream.Length > 0)
|
||||||
{
|
{
|
||||||
listenerStream.Position = 0;
|
listenerStream.Position = 0;
|
||||||
@ -88,7 +88,9 @@ namespace PdfScribeInstallCustomAction
|
|||||||
this.installSession.Log(listenerStreamReader.ReadToEnd());
|
this.installSession.Log(listenerStreamReader.ReadToEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.Close();
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
|
this.installSession = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user