-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend Configuration COM API for export (#3787)
- Loading branch information
Showing
25 changed files
with
525 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Microsoft.Management.Configuration.Processor/Unit/GetAllSettingsResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="GetAllSettingsResult.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Management.Configuration.Processor.Unit | ||
{ | ||
using System.Collections.Generic; | ||
using Microsoft.Management.Configuration; | ||
using Windows.Foundation.Collections; | ||
|
||
/// <summary> | ||
/// Implements IGetAllSettingsResult. | ||
/// </summary> | ||
internal class GetAllSettingsResult : IGetAllSettingsResult | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="GetAllSettingsResult"/> class. | ||
/// </summary> | ||
/// <param name="unit">The configuration unit that the result is for.</param> | ||
public GetAllSettingsResult(ConfigurationUnit unit) | ||
{ | ||
this.Unit = unit; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the configuration unit that the result is for. | ||
/// </summary> | ||
public ConfigurationUnit Unit { get; private set; } | ||
|
||
/// <inheritdoc/> | ||
public IConfigurationUnitResultInformation ResultInformation | ||
{ | ||
get { return this.InternalResult; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets the implementation object for ResultInformation. | ||
/// </summary> | ||
public ConfigurationUnitResultInformation InternalResult { get; } = new ConfigurationUnitResultInformation(); | ||
|
||
/// <inheritdoc/> | ||
public IList<ValueSet>? Settings { get; internal set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Microsoft.Management.Configuration.UnitTests/Helpers/GetAllSettingsResultInstance.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="GetAllSettingsResultInstance.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Management.Configuration.UnitTests.Helpers | ||
{ | ||
using System.Collections.Generic; | ||
using Microsoft.Management.Configuration; | ||
using Windows.Foundation.Collections; | ||
|
||
/// <summary> | ||
/// Implements IGetAllSettingsResult. | ||
/// </summary> | ||
internal sealed class GetAllSettingsResultInstance : IGetAllSettingsResult | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="GetAllSettingsResultInstance"/> class. | ||
/// </summary> | ||
/// <param name="unit">The configuration unit that the result is for.</param> | ||
public GetAllSettingsResultInstance(ConfigurationUnit unit) | ||
{ | ||
this.Unit = unit; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the configuration unit that the result is for. | ||
/// </summary> | ||
public ConfigurationUnit Unit { get; private set; } | ||
|
||
/// <inheritdoc/> | ||
public IConfigurationUnitResultInformation ResultInformation | ||
{ | ||
get { return this.InternalResult; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets the implementation object for ResultInformation. | ||
/// </summary> | ||
public TestConfigurationUnitResultInformation InternalResult { get; } = new TestConfigurationUnitResultInformation(); | ||
|
||
/// <inheritdoc/> | ||
public IList<ValueSet>? Settings { get; internal set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...anagement.Configuration.UnitTests/Helpers/TestGetAllSettingsConfigurationUnitProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="TestGetAllSettingsConfigurationUnitProcessor.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Management.Configuration.UnitTests.Helpers | ||
{ | ||
/// <summary> | ||
/// A test implementation of IConfigurationProcessorFactory. | ||
/// </summary> | ||
internal class TestGetAllSettingsConfigurationUnitProcessor : TestConfigurationUnitProcessor, IGetAllSettingsConfigurationUnitProcessor | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TestGetAllSettingsConfigurationUnitProcessor"/> class. | ||
/// </summary> | ||
/// <param name="unit">The unit.</param> | ||
internal TestGetAllSettingsConfigurationUnitProcessor(ConfigurationUnit unit) | ||
: base(unit) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// The delegate for GetAllSettings. | ||
/// </summary> | ||
/// <returns>The result.</returns> | ||
internal delegate IGetAllSettingsResult GetAllSettingsDelegateType(); | ||
|
||
/// <summary> | ||
/// Gets or sets the delegate object for GetAllSettings. | ||
/// </summary> | ||
internal GetAllSettingsDelegateType? GetAllSettingsDelegate { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the number of times GetAllSettings is called. | ||
/// </summary> | ||
internal int GetAllSettingsCalls { get; private set; } = 0; | ||
|
||
/// <summary> | ||
/// Calls the GetAllSettingsDelegate if one is provided; returns success if not (with no settings values). | ||
/// </summary> | ||
/// <returns>The result.</returns> | ||
public IGetAllSettingsResult GetAllSettings() | ||
{ | ||
++this.GetAllSettingsCalls; | ||
if (this.GetAllSettingsDelegate != null) | ||
{ | ||
return this.GetAllSettingsDelegate(); | ||
} | ||
else | ||
{ | ||
return new GetAllSettingsResultInstance(this.Unit); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.