| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Extensibility |
| 4 | { |
| 5 | using System.Collections.Generic; |
| 6 | using WixToolset.Data; |
| 7 | using WixToolset.Data.WindowsInstaller; |
| 8 | using WixToolset.Extensibility.Data; |
| 9 | using WixToolset.Extensibility.Services; |
| 10 | |
| 11 | /// <summary> |
| 12 | /// Base class for creating a windows installer decompiler extensions. |
| 13 | /// </summary> |
| 14 | public abstract class BaseWindowsInstallerDecompilerExtension : IWindowsInstallerDecompilerExtension |
| 15 | { |
| 16 | /// <summary> |
| 17 | /// Context for use by the extension. |
| 18 | /// </summary> |
| 19 | protected IWindowsInstallerDecompileContext Context { get; private set; } |
| 20 | |
| 21 | /// <summary> |
| 22 | /// Messaging for use by the extension. |
| 23 | /// </summary> |
| 24 | protected IMessaging Messaging { get; private set; } |
| 25 | |
| 26 | /// <summary> |
| 27 | /// Decompiler helper for use by the extension. |
| 28 | /// </summary> |
| 29 | protected IWindowsInstallerDecompilerHelper DecompilerHelper { get; private set; } |
| 30 | |
| 31 | /// <summary> |
| 32 | /// See <see cref="IWindowsInstallerDecompilerExtension.TableDefinitions"/> |
| 33 | /// </summary> |
| 34 | public virtual IReadOnlyCollection<TableDefinition> TableDefinitions { get; } |
| 35 | |
| 36 | /// <summary> |
| 37 | /// See <see cref="IWindowsInstallerDecompilerExtension.PostDecompile(IWindowsInstallerDecompileResult)"/> |
| 38 | /// </summary> |
| 39 | public virtual void PreDecompile(IWindowsInstallerDecompileContext context, IWindowsInstallerDecompilerHelper helper) |
| 40 | { |
| 41 | this.Context = context; |
| 42 | |
| 43 | this.DecompilerHelper = helper; |
| 44 | |
| 45 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); |
| 46 | } |
| 47 | |
| 48 | /// <summary> |
| 49 | /// See <see cref="IWindowsInstallerDecompilerExtension.PreDecompileTables(TableIndexedCollection)"/> |
| 50 | /// </summary> |
| 51 | public virtual void PreDecompileTables(TableIndexedCollection tables) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | /// <summary> |
| 56 | /// See <see cref="IWindowsInstallerDecompilerExtension.TryDecompileTable(Table)"/> |
| 57 | /// </summary> |
| 58 | public virtual bool TryDecompileTable(Table table) |
| 59 | { |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | /// <summary> |
| 64 | /// See <see cref="IWindowsInstallerDecompilerExtension.PostDecompileTables(TableIndexedCollection)"/> |
| 65 | /// </summary> |
| 66 | public virtual void PostDecompileTables(TableIndexedCollection tables) |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | /// <summary> |
| 71 | /// See <see cref="IWindowsInstallerDecompilerExtension.PostDecompile(IWindowsInstallerDecompileResult)"/> |
| 72 | /// </summary> |
| 73 | public virtual void PostDecompile(IWindowsInstallerDecompileResult result) |
| 74 | { |
| 75 | } |
| 76 | } |
| 77 | } |