aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/CreateItemAvoidingInference.cs
blob: 84816cac4d36e8c72e97609b6b0d2e591e984baa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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.

namespace WixToolset.BuildTasks
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.Xml;
    using Microsoft.Build.Framework;
    using Microsoft.Build.Utilities;

    /// <summary>
    /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
    /// WixLocalization element inside the file.
    /// </summary>
    public class CreateItemAvoidingInference : Task
    {
        private string inputProperties;
        private ITaskItem[] outputItems;

        /// <summary>
        /// The output items.
        /// </summary>
        [Output]
        public ITaskItem[] OuputItems
        {
            get { return this.outputItems; }
        }

        /// <summary>
        /// The properties to converty to items.
        /// </summary>
        [Required]
        public string InputProperties
        {
            get { return this.inputProperties; }
            set { this.inputProperties = value; }
        }

        /// <summary>
        /// Gets a complete list of external cabs referenced by the given installer database file.
        /// </summary>
        /// <returns>True upon completion of the task execution.</returns>
        public override bool Execute()
        {
            List<ITaskItem> newItems = new List<ITaskItem>();

            foreach (string property in this.inputProperties.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
            {
                newItems.Add(new TaskItem(property));
            }

            this.outputItems = newItems.ToArray();

            return true;
        }
    }
}