aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Harvester.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Harvester.cs')
-rw-r--r--src/WixToolset.Core/Harvester.cs79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/WixToolset.Core/Harvester.cs b/src/WixToolset.Core/Harvester.cs
deleted file mode 100644
index 3399420c..00000000
--- a/src/WixToolset.Core/Harvester.cs
+++ /dev/null
@@ -1,79 +0,0 @@
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
3namespace WixToolset.Core
4{
5 using System;
6 using System.Diagnostics.CodeAnalysis;
7 using WixToolset.Data;
8 using Wix = WixToolset.Data.Serialize;
9
10 /// <summary>
11 /// The WiX Toolset harvester.
12 /// </summary>
13 public class Harvester
14 {
15 private HarvesterExtension harvesterExtension;
16
17 /// <summary>
18 /// Gets or sets the harvester core for the extension.
19 /// </summary>
20 /// <value>The harvester core for the extension.</value>
21 public IHarvesterCore Core { get; set; }
22
23 /// <summary>
24 /// Gets or sets the extension.
25 /// </summary>
26 /// <value>The extension.</value>
27 [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")]
28 public HarvesterExtension Extension
29 {
30 get
31 {
32 return this.harvesterExtension;
33 }
34 set
35 {
36 if (null != this.harvesterExtension)
37 {
38 throw new InvalidOperationException("Multiple harvester extensions specified.");
39 }
40
41 this.harvesterExtension = value;
42 }
43 }
44
45 /// <summary>
46 /// Harvest wix authoring.
47 /// </summary>
48 /// <param name="argument">The argument for harvesting.</param>
49 /// <returns>The harvested wix authoring.</returns>
50 public Wix.Wix Harvest(string argument)
51 {
52 if (null == argument)
53 {
54 throw new ArgumentNullException("argument");
55 }
56
57 if (null == this.harvesterExtension)
58 {
59 throw new WixException(ErrorMessages.HarvestTypeNotFound());
60 }
61
62 this.harvesterExtension.Core = this.Core;
63
64 Wix.Fragment[] fragments = this.harvesterExtension.Harvest(argument);
65 if (null == fragments || 0 == fragments.Length)
66 {
67 return null;
68 }
69
70 Wix.Wix wix = new Wix.Wix();
71 foreach (Wix.Fragment fragment in fragments)
72 {
73 wix.AddChild(fragment);
74 }
75
76 return wix;
77 }
78 }
79}