aboutsummaryrefslogtreecommitdiff
path: root/src/dtf/WixToolsetTests.Dtf.Compression/OptionStreamContext.cs
blob: 98354d97baf01419c70d2fc144dd179e670274cd (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
// 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.

using System;
using System.Collections.Generic;
using WixToolset.Dtf.Compression;

namespace WixToolset.Dtf.Test
{
    public class OptionStreamContext : ArchiveFileStreamContext
    {
        private PackOptionHandler packOptionHandler;

        public OptionStreamContext(IList<string> archiveFiles, string directory, IDictionary<string, string> files)
            : base(archiveFiles, directory, files)
        {
        }

        public delegate object PackOptionHandler(string optionName, object[] parameters);

        public PackOptionHandler OptionHandler
        {
            get
            {
                return this.packOptionHandler;
            }
            set
            {
                this.packOptionHandler = value;
            }
        }

        public override object GetOption(string optionName, object[] parameters)
        {
            if (this.OptionHandler == null)
            {
                return null;
            }

            return this.OptionHandler(optionName, parameters);
        }
    }
}