Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / Forth.NET

DocMounter 2: A tool to build VS.NET documentation (now with Sandcastle)

,
Rate me:
Please Sign up or sign in to vote.
4.94/5 (29 votes)
15 Nov 2010GPL314 min read 138.2K   1.4K   99  
Tool for creating MS Visual Studio documentation files - XML Summaries, HxS/MSHC help solutions and manuals.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MSHelpCompiler;
using TenTec.Utils;

namespace SandCastleHelpBuilder
{
	/// <summary>
	/// Redirects HXComp output.
	/// </summary>
	internal class HxCompError : IHxCompError
	{
		#region Methods

		/// <summary>
		/// Creates a new instance of HxCompError
		/// </summary>
		public HxCompError(ProcessStepDelegate progressCallback)
		{
			ProgressCallback = progressCallback;
		} 

		#endregion

		#region Properties

		/// <summary>
		/// Indicates whether a fatal compilation error has occured.
		/// </summary>
		public bool IsFailed
		{
			get;
			private set;
		}

		/// <summary>
		/// If the compile failed this holds whatever error message was return by HxComp.
		/// </summary>
		public string ErrorMessage
		{
			get;
			private set;
		}

		/// <summary>
		/// The delegate which is used to report progress.
		/// </summary>
		public ProcessStepDelegate ProgressCallback
		{
			get;
			private set;
		} 

		#endregion

		#region IHxCompError Interface

		HxCompStatus IHxCompError.QueryStatus()
		{
			//_compileFailed is only ever true if we get a fatal error message in report error
			if (IsFailed)
				return HxCompStatus.HxCompStatus_Cancel;
			else
				return HxCompStatus.HxCompStatus_Continue;
		}

		void IHxCompError.ReportError(String taskItemString, String fileName, Int32 lineNum, Int32 charNum, HxCompErrorSeverity severity, String descriptionString)
		{
			StringBuilder myMessage = new StringBuilder("HxComp error\n");

			myMessage.AppendFormat("\tTaskItemString={0}\n", taskItemString);
			myMessage.AppendFormat("\tFilename={0}\n", fileName);
			myMessage.AppendFormat("\tLineNum={0}\n", lineNum);
			myMessage.AppendFormat("\tCharNum={0}\n", charNum);
			myMessage.AppendFormat("\tSeverity={0}\n", severity);
			myMessage.AppendFormat("\tDescriptionString={0}\n", descriptionString);

			if (ProgressCallback != null)
				ProgressCallback(myMessage.ToString(), true);

			if (severity == HxCompErrorSeverity.HxCompErrorSeverity_Fatal)
			{
				IsFailed = true;
				ErrorMessage = descriptionString;
			}
		}

		void IHxCompError.ReportMessage(HxCompErrorSeverity severity, String descriptionString)
		{
			if (severity == HxCompErrorSeverity.HxCompErrorSeverity_Fatal)
			{
				string myMessage = string.Format("{0}: {1}", severity, descriptionString);

				if (ProgressCallback != null)
					ProgressCallback(myMessage.ToString(), true);

				IsFailed = true;
				ErrorMessage = descriptionString;
			}

		}

		#endregion
	}	
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Written By
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation

2 members

Comments and Discussions