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


C# Automation.PSDriveInfo类代码示例

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


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

示例1: VirtualDiskPSDriveInfo

 public VirtualDiskPSDriveInfo(PSDriveInfo toCopy, string root, VirtualDisk disk)
     : base(toCopy.Name, toCopy.Provider, root, toCopy.Description, toCopy.Credential)
 {
     _disk = disk;
     _volMgr = new VolumeManager(_disk);
     _fsCache = new Dictionary<string, DiscFileSystem>();
 }
开发者ID:JGTM2016,项目名称:discutils,代码行数:7,代码来源:VirtualDiskPSDriveInfo.cs

示例2: ProcessRecord

 protected override void ProcessRecord()
 {
     var provider = SessionState.Provider.GetOne(PSProvider);
     var driveInfo = new PSDriveInfo(Name, provider, Root, Description, Credential);
     var realDrive = SessionState.Drive.New(driveInfo, Scope ?? "local", ProviderRuntime);
     WriteObject(realDrive);
 }
开发者ID:bitwiseman,项目名称:Pash,代码行数:7,代码来源:NewPSDriveCommand.cs

示例3: NewDrive

        protected override PSDriveInfo NewDrive(PSDriveInfo drive)
        {
            if (drive == null)
            {
                WriteError(new ErrorRecord(
                           new ArgumentNullException("drive"),
                           "NullDrive",
                           ErrorCategory.InvalidArgument,
                           null));

                return null;
            }
            SFGAO attributes;
            SFGAO isContainerQuery = SFGAO.Browsable | SFGAO.Folder;
            IdList pidl = GetPidlFromPath(drive.Root, isContainerQuery, out attributes);
            if ((attributes & isContainerQuery) == SFGAO.None)
            {
                WriteError(new ErrorRecord(
                           new ArgumentException("drive.Root"),
                           "NotAContainer",
                           ErrorCategory.InvalidArgument,
                           null));
                return null;
            }

            return new ShellPSDriveInfo((ShellFolder)ShellItem.GetShellItem(pidl, new ShellItem.ShellItemKnownInfo()
            {
                LoadedAttributes = isContainerQuery,
                Attributes = attributes
            }), drive);
        }
开发者ID:poizan42,项目名称:PSShellProvider,代码行数:31,代码来源:ShellProvider.cs

示例4: ProviderInfo

 internal ProviderInfo(SessionState sessionState, Type implementingType, string name, string description, string home, string helpFile, PSSnapInInfo psSnapIn)
 {
     this.helpFile = "";
     if (sessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("sessionState");
     }
     if (implementingType == null)
     {
         throw PSTraceSource.NewArgumentNullException("implementingType");
     }
     if (string.IsNullOrEmpty(name))
     {
         throw PSTraceSource.NewArgumentException("name");
     }
     if (string.IsNullOrEmpty(name))
     {
         throw PSTraceSource.NewArgumentException("name");
     }
     this.sessionState = sessionState;
     this.name = name;
     this.description = description;
     this.home = home;
     this.implementingType = implementingType;
     this.helpFile = helpFile;
     this.pssnapin = psSnapIn;
     this.hiddenDrive = new PSDriveInfo(this.FullName, this, "", "", null);
     this.hiddenDrive.Hidden = true;
 }
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:ProviderInfo.cs

示例5: InitializeDefaultDrives

 protected override Collection<PSDriveInfo> InitializeDefaultDrives()
 {
     PSDriveInfo item = new PSDriveInfo("Env", ProviderInfo, string.Empty, string.Empty, null);
     Collection<PSDriveInfo> collection = new Collection<PSDriveInfo>();
     collection.Add(item);
     return collection;
 }
开发者ID:b333z,项目名称:Pash,代码行数:7,代码来源:EnvironmentProvider.cs

示例6: UpdatableHelpSystemDrive

 internal UpdatableHelpSystemDrive(PSCmdlet cmdlet, string path, PSCredential credential)
 {
     for (int i = 0; i < 6; i++)
     {
         this._driveName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
         this._cmdlet = cmdlet;
         if (path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase) || path.EndsWith("/", StringComparison.OrdinalIgnoreCase))
         {
             path = path.Remove(path.Length - 1);
         }
         PSDriveInfo atScope = cmdlet.SessionState.Drive.GetAtScope(this._driveName, "local");
         if (atScope != null)
         {
             if (atScope.Root.Equals(path))
             {
                 return;
             }
             if (i < 5)
             {
                 continue;
             }
             cmdlet.SessionState.Drive.Remove(this._driveName, true, "local");
         }
         atScope = new PSDriveInfo(this._driveName, cmdlet.SessionState.Internal.GetSingleProvider("FileSystem"), path, string.Empty, credential);
         cmdlet.SessionState.Drive.New(atScope, "local");
         return;
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:28,代码来源:UpdatableHelpSystemDrive.cs

示例7: RemoveDrive

 protected virtual PSDriveInfo RemoveDrive(PSDriveInfo drive)
 {
     using (PSTransactionManager.GetEngineProtectionScope())
     {
         return drive;
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:DriveCmdletProvider.cs

示例8: DriveInfo

 public DriveInfo(PSDriveInfo driveInfo, NewDriveParameters parameters)
     : base(driveInfo)
 {
     if (parameters != null)
         Directory = parameters.Directory;
     EnsureDescription();
 }
开发者ID:prantlf,项目名称:Gutenberg,代码行数:7,代码来源:DriveInfo.cs

示例9: PathInfo

 internal PathInfo(PSDriveInfo drive, ProviderInfo provider, Path path, SessionState sessionState)
 {
     Drive = drive;
     Provider = provider;
     _path = path;
     _sessionState = sessionState;
 }
开发者ID:Ventero,项目名称:Pash,代码行数:7,代码来源:PathInfo.cs

示例10: InitializeNewDrive

        /// <summary>
        /// Initializes the specified VFS drive.
        /// </summary>
        /// <param name="drive">The drive to initialize.</param>
        /// <returns>The <see cref="VfsDriveInfo"/> object which represents the initialized drive.</returns>
        protected override VfsDriveInfo InitializeNewDrive(PSDriveInfo drive)
        {
            if (drive is OrchardDriveInfo)
            {
                return (VfsDriveInfo)drive;
            }

            var driveParameters = (OrchardDriveParameters)DynamicParameters;
            if (driveParameters == null)
            {
                return null;
            }

            if (!OrchardPsSnapIn.VerifyOrchardDirectory(driveParameters.OrchardRoot))
            {
                this.WriteError(
                    ThrowHelper.InvalidRootPathException(driveParameters.OrchardRoot),
                    ErrorIds.InvalidRootDirectory,
                    ErrorCategory.InvalidArgument,
                    drive);

                return null;
            }

            VfsDriveInfo orchardDrive = null;
            this.TryCritical(
                () => orchardDrive = this.InitializeOrchardDrive(drive, driveParameters),
                ErrorIds.OrchardInitFailed,
                ErrorCategory.OpenError);

            return orchardDrive;
        }
开发者ID:jean,项目名称:OrchardPs,代码行数:37,代码来源:OrchardProvider.cs

示例11: RemoveDrive

		// NewDrive

		/// <summary>
		/// 	Removes a drive from the provider.
		/// </summary>
		/// <param name = "drive">The drive to remove.</param>
		/// <returns>The drive removed.</returns>
		protected override PSDriveInfo RemoveDrive(PSDriveInfo drive)
		{
			// check if drive object is null
			if (drive == null)
			{
				WriteError(new ErrorRecord(
				           	new ArgumentNullException("drive"),
				           	"NullDrive",
				           	ErrorCategory.InvalidArgument,
				           	drive)
					);

				return null;
			}

			// dispose database on drive
			var ravenDBPSDriveInfo = drive as RavenDBPSDriveInfo;

			if (ravenDBPSDriveInfo == null)
			{
				return null;
			}

			ravenDBPSDriveInfo.Database.Dispose();

			return ravenDBPSDriveInfo;
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:34,代码来源:RavenDBProvider.cs

示例12: CompareTo

 public int CompareTo(PSDriveInfo drive)
 {
     if (drive == null)
     {
         throw PSTraceSource.NewArgumentNullException("drive");
     }
     return string.Compare(this.Name, drive.Name, true, CultureInfo.CurrentCulture);
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:PSDriveInfo.cs

示例13: InitializeDefaultDrives

 protected override Collection<PSDriveInfo> InitializeDefaultDrives()
 {
     PSDriveInfo drive = new PSDriveInfo("Objects", this.ProviderInfo, @"\", "Object Manager Root Directory", null);
     PSDriveInfo session = new PSDriveInfo("SessionObjects", this.ProviderInfo, 
         String.Format(@"\Sessions\{0}\BaseNamedObjects", Process.GetCurrentProcess().SessionId), "Current Session Objects", null);
     Collection<PSDriveInfo> drives = new Collection<PSDriveInfo>() { drive, session };
     return drives;
 }
开发者ID:CaledoniaProject,项目名称:sandbox-attacksurface-analysis-tools,代码行数:8,代码来源:ObjectManagerProvider.cs

示例14: NewDrive

        protected override PSDriveInfo NewDrive(PSDriveInfo drive)
        {
            if( drive is DTEDrive )
            {
                return drive;
            }

            return new DTEDrive( drive, DTE2 );
        }
开发者ID:wangchunlei,项目名称:MyGit,代码行数:9,代码来源:DTEProvider.cs

示例15: 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


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