[1146] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Text;
|
---|
| 4 | using DaveSexton.DocProject;
|
---|
| 5 | using DaveSexton.DocProject.Engine;
|
---|
| 6 |
|
---|
| 7 | namespace IndianHealthService.BMXNet.GeneratedDocumentation
|
---|
| 8 | {
|
---|
| 9 | /// <summary>
|
---|
| 10 | /// Hooks into the DocProject build process for the project in which it's defined.
|
---|
| 11 | /// </summary>
|
---|
| 12 | /// <remarks>
|
---|
| 13 | /// <para>
|
---|
| 14 | /// This class must be registered with the DocProject in the <em>Active Projects</em>
|
---|
| 15 | /// tools options page in order for DocProject to instantiate it during a help build.
|
---|
| 16 | /// </para>
|
---|
| 17 | /// <para>
|
---|
| 18 | /// To cancel the build at any time call the <see cref="BuildContext.Cancel" />
|
---|
| 19 | /// method. The build process will end after the current step is executed,
|
---|
| 20 | /// unless the step is being executed in the background. In that case, it may
|
---|
| 21 | /// end immediately.
|
---|
| 22 | /// </para>
|
---|
| 23 | /// <para>
|
---|
| 24 | /// Note: Do not cache instances of the <see cref="BuildContext" /> class. A new
|
---|
| 25 | /// <see cref="BuildContext" /> is created each time the project is built.
|
---|
| 26 | /// </para>
|
---|
| 27 | /// </remarks>
|
---|
| 28 | public class BuildProcess : BuildProcessComponent
|
---|
| 29 | {
|
---|
| 30 | DateTime buildStart, stepStart;
|
---|
| 31 |
|
---|
| 32 | /// <summary>
|
---|
| 33 | /// Called before the project's help build starts.
|
---|
| 34 | /// </summary>
|
---|
| 35 | /// <param name="context">Provides information about the build process.</param>
|
---|
| 36 | public override void BuildStarting(BuildContext context)
|
---|
| 37 | {
|
---|
| 38 | // Uncomment the following line to break into the debugger:
|
---|
| 39 | // System.Diagnostics.Debugger.Break();
|
---|
| 40 |
|
---|
| 41 | buildStart = DateTime.Now;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | /// <summary>
|
---|
| 45 | /// Called before a <paramref name="step" /> is executed during a help build.
|
---|
| 46 | /// </summary>
|
---|
| 47 | /// <param name="step"><see cref="IBuildStep" /> implementation to be executed.</param>
|
---|
| 48 | /// <param name="context">Provides information about the build process.</param>
|
---|
| 49 | /// <returns><b>true</b> indicates that the process should continue, otherwise,
|
---|
| 50 | /// <b>false</b> indicates that the process should skip this step.</returns>
|
---|
| 51 | public override bool BeforeExecuteStep(IBuildStep step, BuildContext context)
|
---|
| 52 | {
|
---|
| 53 | stepStart = DateTime.Now;
|
---|
| 54 | return true;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | /// <summary>
|
---|
| 58 | /// Called after a <paramref name="step" /> has been executed during a help build.
|
---|
| 59 | /// </summary>
|
---|
| 60 | /// <param name="step"><see cref="IBuildStep" /> implementation that was executed.</param>
|
---|
| 61 | /// <param name="context">Provides information about the build process.</param>
|
---|
| 62 | public override void AfterExecuteStep(IBuildStep step, BuildContext context)
|
---|
| 63 | {
|
---|
| 64 | TraceLine();
|
---|
| 65 | TraceLine("Step {0} Time Elapsed: {1}", context.CurrentStepIndex + 1, DateTime.Now - stepStart);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | /// <summary>
|
---|
| 69 | /// Called after the project's help build has finished.
|
---|
| 70 | /// </summary>
|
---|
| 71 | /// <remarks>
|
---|
| 72 | /// The <see cref="BuildContext.Cancel" /> method has no affect at this
|
---|
| 73 | /// point in the build process. This method is the final step before the
|
---|
| 74 | /// build statistics are displayed.
|
---|
| 75 | /// <para>
|
---|
| 76 | /// This method is always invoked if <see cref="BuildStarting" /> is invoked,
|
---|
| 77 | /// regardless of whether an exception is thrown in any of the other methods,
|
---|
| 78 | /// <see cref="BuildContext.Cancel" /> has been called, or an exeception has
|
---|
| 79 | /// been thrown by the build engine.
|
---|
| 80 | /// </para>
|
---|
| 81 | /// <para>
|
---|
| 82 | /// To determine whether a help build failed or succeeded, examine the value of the
|
---|
| 83 | /// <see cref="BuildContext.BuildState" /> property.
|
---|
| 84 | /// </para>
|
---|
| 85 | /// </remarks>
|
---|
| 86 | /// <param name="context">Provides information about the build process.</param>
|
---|
| 87 | public override void BuildCompleted(BuildContext context)
|
---|
| 88 | {
|
---|
| 89 | TraceLine();
|
---|
| 90 | TraceLine("Total Time Elapsed: {0}", DateTime.Now - buildStart);
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 | }
|
---|