forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProcessorRunSettings.cs
More file actions
59 lines (54 loc) · 2.42 KB
/
ProcessorRunSettings.cs
File metadata and controls
59 lines (54 loc) · 2.42 KB
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
// -----------------------------------------------------------------------------
// <copyright file="ProcessorRunSettings.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
// -----------------------------------------------------------------------------
namespace Microsoft.Management.Configuration.Processor.DSCv3.Helpers
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Management.Configuration.Processor.DSCv3.Model;
using Microsoft.Management.Configuration.Processor.Helpers;
/// <summary>
/// Contains settings for the DSC v3 processor components to share.
/// </summary>
internal class ProcessorRunSettings
{
/// <summary>
/// Gets the paths for finding DSC resources and executables.
/// </summary>
public string ResourceSearchPaths { get; private set; } = string.Empty;
/// <summary>
/// Gets a value indicating whether the resource search paths are exclusive.
/// </summary>
public bool ResourceSearchPathsExclusive { get; private set; } = false;
/// <summary>
/// Creates ProcessorRunSettings from FindUnitProcessorsOptions.
/// </summary>
/// <param name="findOptions">The find unit processors options.</param>
/// <returns>A ProcessorRunSettings.</returns>
public static ProcessorRunSettings CreateFromFindUnitProcessorsOptions(FindUnitProcessorsOptions findOptions)
{
return new ProcessorRunSettings
{
ResourceSearchPaths = findOptions.SearchPaths,
ResourceSearchPathsExclusive = findOptions.SearchPathsExclusive,
};
}
/// <summary>
/// Creates ProcessorRunSettings from a ResourceDetails.
/// </summary>
/// <param name="resourceDetails">The resource details to be used.</param>
/// <returns>A ProcessorRunSettings.</returns>
public static ProcessorRunSettings CreateFromResourceDetails(ResourceDetails? resourceDetails)
{
return new ProcessorRunSettings
{
ResourceSearchPaths = Path.GetDirectoryName(resourceDetails?.Path) ?? string.Empty,
ResourceSearchPathsExclusive = false,
};
}
}
}