コード例 #1
0
ファイル: CoreCommandBase.cs プロジェクト: modulexcite/pash-1
        protected bool DoesProviderSupportShouldProcess(string[] paths)
        {
            bool flag = true;

            if (paths != null && (int)paths.Length >= 0)
            {
                string[] strArrays = paths;
                int      num       = 0;
                while (num < (int)strArrays.Length)
                {
                    string       str          = strArrays[num];
                    ProviderInfo providerInfo = null;
                    PSDriveInfo  pSDriveInfo  = null;
                    base.SessionState.Path.GetUnresolvedProviderPathFromPSPath(str, this.CmdletProviderContext, out providerInfo, out pSDriveInfo);
                    if (CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.ShouldProcess, providerInfo))
                    {
                        num++;
                    }
                    else
                    {
                        flag = false;
                        break;
                    }
                }
            }
            object[] objArray = new object[1];
            objArray[0] = flag;
            CoreCommandBase.tracer.WriteLine("result = {0}", objArray);
            return(flag);
        }
コード例 #2
0
        /// <summary>
        /// Internal wrapper for the NewDrive protected method. It is called instead
        /// of the protected method that is overridden by derived classes so that the
        /// context of the command can be set.
        /// </summary>
        /// <param name="drive">
        /// The PSDriveInfo object the represents the drive to be mounted.
        /// </param>
        /// <param name="context">
        /// The context under which this method is being called.
        /// </param>
        /// <returns>
        /// The drive that was returned from the protected NewDrive method.
        /// </returns>
        internal PSDriveInfo NewDrive(PSDriveInfo drive, CmdletProviderContext context)
        {
            Context = context;

            // Make sure the provider supports credentials if they were passed
            // in the drive.

            if (drive.Credential != null &&
                drive.Credential != PSCredential.Empty &&
                !CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.Credentials, ProviderInfo))
            {
                throw PSTraceSource.NewNotSupportedException(
                          SessionStateStrings.NewDriveCredentials_NotSupported);
            }

            return(NewDrive(drive));
        }
コード例 #3
0
 internal PSDriveInfo NewDrive(PSDriveInfo drive, CmdletProviderContext context)
 {
     this.Context = context;
     if (drive.Credential != null && drive.Credential != PSCredential.Empty && !CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.Credentials, this.ProviderInfo))
     {
         throw CmdletProvider.providerBaseTracer.NewNotSupportedException("SessionStateStrings", "NewDriveCredentials_NotSupported");
     }
     return(this.NewDrive(drive));
 }
コード例 #4
0
 internal SessionStateGlobal(ExecutionContext executionContext)
 {
     _globalExecutionContext = executionContext;
     _snapins = new Dictionary <string, PSSnapInInfo>(StringComparer.CurrentCultureIgnoreCase);
     Provider = new CmdletProviderManagementIntrinsics(this);
 }
コード例 #5
0
 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));
 }