PSApplyConfigurationSetResult.cs (1761B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="PSApplyConfigurationSetResult.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Configuration.Engine.PSObjects 8 { 9 using System.Collections.Generic; 10 using Microsoft.Management.Configuration; 11 using Microsoft.WinGet.Configuration.Engine.Exceptions; 12 13 /// <summary> 14 /// Wrapper for ApplyConfigurationSetResult. 15 /// </summary> 16 public class PSApplyConfigurationSetResult 17 { 18 /// <summary> 19 /// Initializes a new instance of the <see cref="PSApplyConfigurationSetResult"/> class. 20 /// </summary> 21 /// <param name="applySetResult">Apply set result.</param> 22 internal PSApplyConfigurationSetResult(ApplyConfigurationSetResult applySetResult) 23 { 24 this.ResultCode = applySetResult.ResultCode?.HResult ?? ErrorCodes.S_OK; 25 26 var unitResults = new List<PSApplyConfigurationUnitResult>(); 27 foreach (var unitResult in applySetResult.UnitResults) 28 { 29 unitResults.Add(new PSApplyConfigurationUnitResult(unitResult)); 30 } 31 32 this.UnitResults = unitResults; 33 } 34 35 /// <summary> 36 /// Gets the result code. 37 /// </summary> 38 public int ResultCode { get; private init; } 39 40 /// <summary> 41 /// Gets the results of the units. 42 /// </summary> 43 public IReadOnlyList<PSApplyConfigurationUnitResult> UnitResults { get; private init; } 44 } 45 }