mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-15 06:09:09 +00:00
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: #6140 Manually reviewed each change. Fix #6073
98 lines
3.1 KiB
C#
98 lines
3.1 KiB
C#
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace System.Management.Automation
|
|
{
|
|
/// <summary>
|
|
/// This is the interface between the NativeCommandProcessor and the
|
|
/// parameter binders required to bind parameters to a native command.
|
|
/// </summary>
|
|
///
|
|
internal class NativeCommandParameterBinderController : ParameterBinderController
|
|
{
|
|
#region ctor
|
|
|
|
/// <summary>
|
|
/// Initializes the cmdlet parameter binder controller for
|
|
/// the specified native command and engine context
|
|
/// </summary>
|
|
///
|
|
/// <param name="command">
|
|
/// The command that the parameters will be bound to.
|
|
/// </param>
|
|
///
|
|
internal NativeCommandParameterBinderController(NativeCommand command)
|
|
: base(command.MyInvocation, command.Context, new NativeCommandParameterBinder(command))
|
|
{
|
|
}
|
|
|
|
#endregion ctor
|
|
|
|
/// <summary>
|
|
/// Gets the command arguments in string form
|
|
/// </summary>
|
|
///
|
|
internal String Arguments
|
|
{
|
|
get
|
|
{
|
|
return ((NativeCommandParameterBinder)DefaultParameterBinder).Arguments;
|
|
}
|
|
} // Arguments
|
|
|
|
/// <summary>
|
|
/// Passes the binding directly through to the parameter binder.
|
|
/// It does no verification against metadata.
|
|
/// </summary>
|
|
///
|
|
/// <param name="argument">
|
|
/// The name and value of the variable to bind.
|
|
/// </param>
|
|
///
|
|
/// <param name="flags">
|
|
/// Ignored.
|
|
/// </param>
|
|
///
|
|
/// <returns>
|
|
/// True if the parameter was successfully bound. Any error condition
|
|
/// produces an exception.
|
|
/// </returns>
|
|
///
|
|
internal override bool BindParameter(
|
|
CommandParameterInternal argument,
|
|
ParameterBindingFlags flags)
|
|
{
|
|
Diagnostics.Assert(false, "Unreachable code");
|
|
|
|
throw new InvalidOperationException();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Binds the specified parameters to the native command
|
|
/// </summary>
|
|
///
|
|
/// <param name="parameters">
|
|
/// The parameters to bind.
|
|
/// </param>
|
|
///
|
|
/// <remarks>
|
|
/// For any parameters that do not have a name, they are added to the command
|
|
/// line arguments for the command
|
|
/// </remarks>
|
|
///
|
|
internal override Collection<CommandParameterInternal> BindParameters(Collection<CommandParameterInternal> parameters)
|
|
{
|
|
((NativeCommandParameterBinder)DefaultParameterBinder).BindParameters(parameters);
|
|
|
|
Diagnostics.Assert(s_emptyReturnCollection.Count == 0, "This list shouldn't be used for anything as it's shared.");
|
|
|
|
return s_emptyReturnCollection;
|
|
} // BindParameters
|
|
|
|
private static readonly Collection<CommandParameterInternal> s_emptyReturnCollection = new Collection<CommandParameterInternal>();
|
|
}
|
|
}
|
|
|