diff options
author | Rob Mensching <rob@firegiant.com> | 2019-05-12 23:05:42 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2019-05-12 23:14:43 -0700 |
commit | 65b36792f09658a85401cd50a0efaee0fee698d9 (patch) | |
tree | 5f749a63e1542384b2b89d13ca15158549b81cc4 /src | |
parent | a8b388110d2914c1ebf610dd624f710e9874baf4 (diff) | |
download | wix-65b36792f09658a85401cd50a0efaee0fee698d9.tar.gz wix-65b36792f09658a85401cd50a0efaee0fee698d9.tar.bz2 wix-65b36792f09658a85401cd50a0efaee0fee698d9.zip |
Add the missing BaseLibrarianExtension
Diffstat (limited to '')
-rw-r--r-- | src/WixToolset.Extensibility/BaseLibrarianExtension.cs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs new file mode 100644 index 00000000..ffcb6684 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs | |||
@@ -0,0 +1,71 @@ | |||
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.Extensibility.Data; | ||
8 | using WixToolset.Extensibility.Services; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Base class for creating a librarian extension. | ||
12 | /// </summary> | ||
13 | public abstract class BaseLibrarianExtension : ILibrarianExtension | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Context for use by the extension. | ||
17 | /// </summary> | ||
18 | protected ILibraryContext Context { get; private set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Messaging for use by the extension. | ||
22 | /// </summary> | ||
23 | protected IMessaging Messaging { get; private set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Called at the beginning of combining. | ||
27 | /// </summary> | ||
28 | /// <param name="context">Librarian context.</param> | ||
29 | public virtual void PreCombine(ILibraryContext context) | ||
30 | { | ||
31 | this.Context = context; | ||
32 | |||
33 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Resolves a path to a file path on disk. | ||
38 | /// </summary> | ||
39 | /// <param name="sourceLineNumber">Source line number for the path to resolve.</param> | ||
40 | /// <param name="tupleDefinition">Tuple related to the path to resolve.</param> | ||
41 | /// <param name="path">Path to resolve.</param> | ||
42 | /// <returns>Optional resolved file result.</returns> | ||
43 | public virtual IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateTupleDefinition tupleDefinition, string path) | ||
44 | { | ||
45 | return null; | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Called at the end of combining. | ||
50 | /// </summary> | ||
51 | /// <param name="library">Combined library intermediate.</param> | ||
52 | public virtual void PostCombine(Intermediate library) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// Creates an IResolveFileResult. | ||
58 | /// </summary> | ||
59 | /// <param name="path">Optional resolved path to file.</param> | ||
60 | /// <param name="checkedPaths">Optional collection of paths checked for the file.</param> | ||
61 | /// <returns>Resolved file result.</returns> | ||
62 | protected IResolveFileResult CreateResolveFileResult(string path = null, IEnumerable<string> checkedPaths = null) | ||
63 | { | ||
64 | var result = this.Context.ServiceProvider.GetService<IResolveFileResult>(); | ||
65 | result.Path = path; | ||
66 | result.CheckedPaths = checkedPaths; | ||
67 | |||
68 | return result; | ||
69 | } | ||
70 | } | ||
71 | } | ||