//-------------------------------------------------------------------------------------------------
// <copyright file="Melter.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
// </copyright>
//
// <summary>
// Decompiles an msi database into WiX source.
// </summary>
//-------------------------------------------------------------------------------------------------
namespace Microsoft.Tools.WindowsInstallerXml{
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using Wix = Microsoft.Tools.WindowsInstallerXml.Serialize;
/// <summary>
/// Melts a Module Wix document into a ComponentGroup representation.
/// </summary>
public sealed class MelterCore : IMessageHandler
{
private bool encounteredError;
/// <summary>
/// Instantiate a new melter core.
/// </summary>
/// <param name="messageHandler">The message handler.</param>
public MelterCore(MessageEventHandler messageHandler)
{
this.MessageHandler = messageHandler;
}
/// <summary>
/// Gets whether the melter core encoutered an error while processing.
/// </summary>
/// <value>Flag if core encountered and error during processing.</value>
public bool EncounteredError
{
get { return this.encounteredError; }
}
/// <summary>
/// Event for messages.
/// </summary>
private event MessageEventHandler MessageHandler;
/// <summary>
/// Sends a message to the message delegate if there is one.
/// </summary>
/// <param name="mea">Message event arguments.</param>
public void OnMessage(MessageEventArgs e)
{
WixErrorEventArgs errorEventArgs = e as WixErrorEventArgs;
if (null != errorEventArgs)
{
this.encounteredError = true;
}
if (null != this.MessageHandler)
{
this.MessageHandler(this, e);
if (MessageLevel.Error == e.Level)
{
this.encounteredError = true;
}
}
else if (null != errorEventArgs)
{
throw new WixException(errorEventArgs);
}
}
}
}
|