MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4namespace System.Management.Automation5{6 /// <summary>7 /// Provides information about a filter that is stored in session state.8 /// </summary>9 public class FilterInfo : FunctionInfo10 {11 #region ctor12 13 /// <summary>14 /// Creates an instance of the FilterInfo class with the specified name and ScriptBlock.15 /// </summary>16 /// <param name="name">17 /// The name of the filter.18 /// </param>19 /// <param name="filter">20 /// The ScriptBlock for the filter21 /// </param>22 /// <param name="context">23 /// The ExecutionContext for the filter.24 /// </param>25 /// <exception cref="ArgumentNullException">26 /// If <paramref name="filter"/> is null.27 /// </exception>28 internal FilterInfo(string name, ScriptBlock filter, ExecutionContext context) : this(name, filter, context, null)29 {30 }31 32 /// <summary>33 /// Creates an instance of the FilterInfo class with the specified name and ScriptBlock.34 /// </summary>35 /// <param name="name">36 /// The name of the filter.37 /// </param>38 /// <param name="filter">39 /// The ScriptBlock for the filter40 /// </param>41 /// <param name="context">42 /// The ExecutionContext for the filter.43 /// </param>44 /// <param name="helpFile">45 /// The help file for the filter.46 /// </param>47 /// <exception cref="ArgumentNullException">48 /// If <paramref name="filter"/> is null.49 /// </exception>50 internal FilterInfo(string name, ScriptBlock filter, ExecutionContext context, string helpFile)51 : base(name, filter, context, helpFile)52 {53 SetCommandType(CommandTypes.Filter);54 }55 56 /// <summary>57 /// Creates an instance of the FilterInfo class with the specified name and ScriptBlock.58 /// </summary>59 /// <param name="name">60 /// The name of the filter.61 /// </param>62 /// <param name="filter">63 /// The ScriptBlock for the filter64 /// </param>65 /// <param name="options">66 /// The options to set on the function. Note, Constant can only be set at creation time.67 /// </param>68 /// <param name="context">69 /// The execution context for the filter.70 /// </param>71 /// <exception cref="ArgumentNullException">72 /// If <paramref name="filter"/> is null.73 /// </exception>74 internal FilterInfo(string name, ScriptBlock filter, ScopedItemOptions options, ExecutionContext context) : this(name, filter, options, context, null)75 {76 }77 78 /// <summary>79 /// Creates an instance of the FilterInfo class with the specified name and ScriptBlock.80 /// </summary>81 /// <param name="name">82 /// The name of the filter.83 /// </param>84 /// <param name="filter">85 /// The ScriptBlock for the filter86 /// </param>87 /// <param name="options">88 /// The options to set on the function. Note, Constant can only be set at creation time.89 /// </param>90 /// <param name="context">91 /// The execution context for the filter.92 /// </param>93 /// <param name="helpFile">94 /// The help file for the filter.95 /// </param>96 /// <exception cref="ArgumentNullException">97 /// If <paramref name="filter"/> is null.98 /// </exception>99 internal FilterInfo(string name, ScriptBlock filter, ScopedItemOptions options, ExecutionContext context, string helpFile)100 : base(name, filter, options, context, helpFile)101 {102 SetCommandType(CommandTypes.Filter);103 }104 105 /// <summary>106 /// This is a copy constructor, used primarily for get-command.107 /// </summary>108 internal FilterInfo(FilterInfo other)109 : base(other)110 {111 }112 113 /// <summary>114 /// This is a copy constructor, used primarily for get-command.115 /// </summary>116 internal FilterInfo(string name, FilterInfo other)117 : base(name, other)118 {119 }120 121 /// <summary>122 /// Create a copy of commandInfo for GetCommandCommand so that we can generate parameter123 /// sets based on an argument list (so we can get the dynamic parameters.)124 /// </summary>125 internal override CommandInfo CreateGetCommandCopy(object[] arguments)126 {127 FilterInfo copy = new FilterInfo(this);128 copy.IsGetCommandCopy = true;129 copy.Arguments = arguments;130 return copy;131 }132 133 #endregion ctor134 135 internal override HelpCategory HelpCategory136 {137 get { return HelpCategory.Filter; }138 }139 }140}141 