• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Automation.PSDriveInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: PSDriveInfo

 protected PSDriveInfo(PSDriveInfo driveInfo)
 {
     Name = driveInfo.Name;
     Provider = driveInfo.Provider;
     Root = driveInfo.Root;
     Description = driveInfo.Description;
     Credential = driveInfo.Credential;
     CurrentLocation = driveInfo.CurrentLocation;
 }
开发者ID:Ventero,项目名称:Pash,代码行数:9,代码来源:PSDriveInfo.cs


示例17: MakePath

 public static string MakePath(string path, PSDriveInfo drive)
 {
     string format = "{0}:" + '\\' + "{1}";
     if (path.StartsWith("\\"))
     {
         format = "{0}:{1}";
     }
     return string.Format(format, new object[] { drive.Name, path });
 }
开发者ID:JamesTryand,项目名称:pash,代码行数:9,代码来源:PathIntrinsics.cs


示例18: NewDrive

 protected override PSDriveInfo NewDrive(PSDriveInfo drive)
 {
     var sqlServerPsDriveInfo = new SqlServerPsDriveInfo(drive);
     if (!sqlServerPsDriveInfo.ItemExists(drive.Root))
     {
         ThrowTerminatingError(new ErrorRecord(null, "BadServer", ErrorCategory.InvalidArgument, drive.Root));
     }
     return sqlServerPsDriveInfo;
 }
开发者ID:PeterGerrard,项目名称:SQLServerProvider,代码行数:9,代码来源:SQLServerProvider.cs


示例19: NewDrive

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

            var p = this.DynamicParameters as GenericEntityContextDrive.NewParams;
            return new GenericEntityContextDrive( p.ContextType, drive );
        }
开发者ID:modulexcite,项目名称:EntityShell,代码行数:10,代码来源:EntityProvider.cs


示例20: RemoveDrive

 protected override PSDriveInfo RemoveDrive(PSDriveInfo drive)
 {
     var testdrive = drive as TestDrive;
     if (testdrive == null)
     {
         throw new InvalidOperationException("Drive is not a TestDrive!");
     }
     testdrive.IsRemoved = true;
     return testdrive;
 }
开发者ID:mauve,项目名称:Pash,代码行数:10,代码来源:TestDriveProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Automation.PSObject类代码示例发布时间:2022-05-26
下一篇:
C# Automation.PSCredential类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap