当前位置: 首页>>代码示例>>C#>>正文


C# Automation.CmdletProviderContext类代码示例

本文整理汇总了C#中System.Management.Automation.CmdletProviderContext的典型用法代码示例。如果您正苦于以下问题:C# CmdletProviderContext类的具体用法?C# CmdletProviderContext怎么用?C# CmdletProviderContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CmdletProviderContext类属于System.Management.Automation命名空间,在下文中一共展示了CmdletProviderContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CmdletProviderContext

 internal CmdletProviderContext(CmdletProviderContext contextToCopyFrom)
 {
     this.credentials = PSCredential.Empty;
     this._origin = CommandOrigin.Internal;
     this.accumulatedObjects = new Collection<PSObject>();
     this.accumulatedErrorObjects = new Collection<ErrorRecord>();
     this.stopReferrals = new Collection<CmdletProviderContext>();
     if (contextToCopyFrom == null)
     {
         throw PSTraceSource.NewArgumentNullException("contextToCopyFrom");
     }
     this.executionContext = contextToCopyFrom.ExecutionContext;
     this.command = contextToCopyFrom.command;
     if (contextToCopyFrom.Credential != null)
     {
         this.credentials = contextToCopyFrom.Credential;
     }
     this.drive = contextToCopyFrom.Drive;
     this.force = (bool) contextToCopyFrom.Force;
     this.CopyFilters(contextToCopyFrom);
     this.suppressWildcardExpansion = contextToCopyFrom.SuppressWildcardExpansion;
     this.dynamicParameters = contextToCopyFrom.DynamicParameters;
     this._origin = contextToCopyFrom._origin;
     this.stopping = contextToCopyFrom.Stopping;
     contextToCopyFrom.StopReferrals.Add(this);
     this.copiedContext = contextToCopyFrom;
 }
开发者ID:nickchal,项目名称:pash,代码行数:27,代码来源:CmdletProviderContext.cs

示例2: GetProviderSpecificHelpInfo

 internal MamlCommandHelpInfo GetProviderSpecificHelpInfo(string helpItemName)
 {
     ProviderInfo info = null;
     PSDriveInfo drive = null;
     string str = null;
     CmdletProviderContext context = new CmdletProviderContext(this._executionContext);
     try
     {
         string str2 = this._requestedPath;
         if (string.IsNullOrEmpty(this._requestedPath))
         {
             str2 = this._pathIntrinsics.CurrentLocation.Path;
         }
         str = this._executionContext.LocationGlobber.GetProviderPath(str2, context, out info, out drive);
     }
     catch (ArgumentNullException)
     {
     }
     catch (ProviderNotFoundException)
     {
     }
     catch (DriveNotFoundException)
     {
     }
     catch (ProviderInvocationException)
     {
     }
     catch (NotSupportedException)
     {
     }
     catch (InvalidOperationException)
     {
     }
     catch (ItemNotFoundException)
     {
     }
     if (info == null)
     {
         return null;
     }
     CmdletProvider provider = info.CreateInstance();
     ICmdletProviderSupportsHelp help = provider as ICmdletProviderSupportsHelp;
     if (help == null)
     {
         return null;
     }
     if (str == null)
     {
         throw new ItemNotFoundException(this._requestedPath, "PathNotFound", SessionStateStrings.PathNotFound);
     }
     provider.Start(info, context);
     string path = str;
     string helpMaml = help.GetHelpMaml(helpItemName, path);
     if (string.IsNullOrEmpty(helpMaml))
     {
         return null;
     }
     return MamlCommandHelpInfo.Load(InternalDeserializer.LoadUnsafeXmlDocument(helpMaml, false, null).DocumentElement, HelpCategory.Provider);
 }
开发者ID:nickchal,项目名称:pash,代码行数:59,代码来源:ProviderContext.cs

示例3: NewDrive

 internal PSDriveInfo NewDrive(PSDriveInfo drive, CmdletProviderContext context)
 {
     base.Context = context;
     if (((drive.Credential != null) && (drive.Credential != PSCredential.Empty)) && !CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.Credentials, base.ProviderInfo))
     {
         throw PSTraceSource.NewNotSupportedException("SessionStateStrings", "NewDriveCredentials_NotSupported", new object[0]);
     }
     return this.NewDrive(drive);
 }
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:DriveCmdletProvider.cs

示例4: CopyProperty

 internal void CopyProperty(string sourcePath, string sourceProperty, string destinationPath, string destinationProperty, CmdletProviderContext cmdletProviderContext)
 {
     this.Context = cmdletProviderContext;
     IDynamicPropertyCmdletProvider provider = this as IDynamicPropertyCmdletProvider;
     if (provider == null)
     {
         throw PSTraceSource.NewNotSupportedException("SessionStateStrings", "IDynamicPropertyCmdletProvider_NotSupported", new object[0]);
     }
     provider.CopyProperty(sourcePath, sourceProperty, destinationPath, destinationProperty);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:CmdletProvider.cs

示例5: ClearPropertyDynamicParameters

 internal object ClearPropertyDynamicParameters(string path, Collection<string> providerSpecificPickList, CmdletProviderContext cmdletProviderContext)
 {
     this.Context = cmdletProviderContext;
     IPropertyCmdletProvider provider = this as IPropertyCmdletProvider;
     if (provider == null)
     {
         return null;
     }
     return provider.ClearPropertyDynamicParameters(path, providerSpecificPickList);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:CmdletProvider.cs

示例6: ClearProperty

 internal void ClearProperty(string path, Collection<string> propertyName, CmdletProviderContext cmdletProviderContext)
 {
     this.Context = cmdletProviderContext;
     IPropertyCmdletProvider provider = this as IPropertyCmdletProvider;
     if (provider == null)
     {
         throw PSTraceSource.NewNotSupportedException("SessionStateStrings", "IPropertyCmdletProvider_NotSupported", new object[0]);
     }
     provider.ClearProperty(path, propertyName);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:CmdletProvider.cs

示例7: ClearContentDynamicParameters

 internal object ClearContentDynamicParameters(string path, CmdletProviderContext cmdletProviderContext)
 {
     this.Context = cmdletProviderContext;
     IContentCmdletProvider provider = this as IContentCmdletProvider;
     if (provider == null)
     {
         return null;
     }
     return provider.ClearContentDynamicParameters(path);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:CmdletProvider.cs

示例8: ClearContent

 internal void ClearContent(string path, CmdletProviderContext cmdletProviderContext)
 {
     this.Context = cmdletProviderContext;
     IContentCmdletProvider provider = this as IContentCmdletProvider;
     if (provider == null)
     {
         throw PSTraceSource.NewNotSupportedException("SessionStateStrings", "IContentCmdletProvider_NotSupported", new object[0]);
     }
     provider.ClearContent(path);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:CmdletProvider.cs

示例9: GetDynamicParameters

		internal override object GetDynamicParameters(CmdletProviderContext context)
		{
			if (!(this.Path != null & (int)this.Path.Length > 0))
			{
				return base.InvokeProvider.Property.CopyPropertyDynamicParameters(".", this.property, this.Destination, this.property, context);
			}
			else
			{
				return base.InvokeProvider.Property.CopyPropertyDynamicParameters(this.Path[0], this.property, this.Destination, this.property, context);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:CopyItemPropertyCommand.cs

示例10: GetDynamicParameters

		internal override object GetDynamicParameters(CmdletProviderContext context)
		{
			if (this.Path == null)
			{
				return base.InvokeProvider.Property.RenamePropertyDynamicParameters(".", this.Name, this.NewName, context);
			}
			else
			{
				return base.InvokeProvider.Property.RenamePropertyDynamicParameters(this.Path, this.Name, this.NewName, context);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:RenameItemPropertyCommand.cs

示例11: GetDynamicParameters

		internal override object GetDynamicParameters(CmdletProviderContext context)
		{
			if (this.Path == null || (int)this.Path.Length <= 0)
			{
				return base.InvokeProvider.Property.GetPropertyDynamicParameters(".", SessionStateUtilities.ConvertArrayToCollection<string>(this.property), context);
			}
			else
			{
				return base.InvokeProvider.Property.GetPropertyDynamicParameters(this.Path[0], SessionStateUtilities.ConvertArrayToCollection<string>(this.property), context);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:GetItemPropertyCommand.cs

示例12: GetDynamicParameters

		internal override object GetDynamicParameters(CmdletProviderContext context)
		{
			if (base.Path == null || (int)base.Path.Length <= 0)
			{
				return base.InvokeProvider.Content.GetContentReaderDynamicParameters(".", context);
			}
			else
			{
				return base.InvokeProvider.Content.GetContentReaderDynamicParameters(base.Path[0], context);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:GetContentCommand.cs

示例13: GetDynamicParameters

		internal override object GetDynamicParameters(CmdletProviderContext context)
		{
			Collection<string> strs = new Collection<string>();
			strs.Add(this.property);
			if (this.Path == null || (int)this.Path.Length <= 0)
			{
				return base.InvokeProvider.Property.ClearPropertyDynamicParameters(".", strs, context);
			}
			else
			{
				return base.InvokeProvider.Property.ClearPropertyDynamicParameters(this.Path[0], strs, context);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:ClearItemPropertyCommand.cs

示例14: GetAcceptedPaths

		private string[] GetAcceptedPaths(string[] unfilteredPaths, CmdletProviderContext currentContext)
		{
			Collection<PathInfo> pathInfos = base.ResolvePaths(unfilteredPaths, true, false, currentContext);
			ArrayList arrayLists = new ArrayList();
			foreach (PathInfo pathInfo in pathInfos)
			{
				if (!this.CallShouldProcess(pathInfo.Path))
				{
					continue;
				}
				arrayLists.Add(pathInfo.Path);
			}
			return (string[])arrayLists.ToArray(typeof(string));
		}
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:WriteContentCommandBase.cs

示例15: GetParentPath

        /// <summary>
        /// Gets the path to the parent object for the given object
        /// </summary>
        /// 
        /// <param name="path">
        /// The path to the object to get the parent path from
        /// </param>
        /// 
        /// <param name="root">
        /// The root of the drive.
        /// </param>
        /// 
        /// <returns>
        /// The path to the parent object
        /// </returns>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="path"/> is null.
        /// </exception>
        /// 
        /// <exception cref="NotSupportedException">
        /// If the <paramref name="providerInstance"/> does not support this operation.
        /// </exception>
        /// 
        /// <exception cref="PipelineStoppedException">
        /// If the pipeline is being stopped while executing the command.
        /// </exception>
        /// 
        /// <exception cref="ProviderInvocationException">
        /// If the provider threw an exception.
        /// </exception>
        /// 
        internal string GetParentPath(string path, string root)
        {
            if (path == null)
            {
                throw PSTraceSource.NewArgumentNullException("path");
            }

            CmdletProviderContext context = new CmdletProviderContext(this.ExecutionContext);

            string result = GetParentPath(path, root, context);

            context.ThrowFirstErrorOrDoNothing();

            return result;
        } //GetParentPath
开发者ID:40a,项目名称:PowerShell,代码行数:47,代码来源:SessionStateNavigation.cs


注:本文中的System.Management.Automation.CmdletProviderContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。