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

C# Automation.ProviderInfo类代码示例

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

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



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

示例1: PSDriveInfo

 public PSDriveInfo(string name, ProviderInfo provider, string root, string description, PSCredential credential)
 {
     this.credentials = PSCredential.Empty;
     if (name == null)
     {
         throw PSTraceSource.NewArgumentNullException("name");
     }
     if (provider == null)
     {
         throw PSTraceSource.NewArgumentNullException("provider");
     }
     if (root == null)
     {
         throw PSTraceSource.NewArgumentNullException("root");
     }
     this.name = name;
     this.provider = provider;
     this.root = root;
     this.description = description;
     if (credential != null)
     {
         this.credentials = credential;
     }
     this.currentWorkingDirectory = string.Empty;
     this.Trace();
 }
开发者ID:nickchal,项目名称:pash,代码行数:26,代码来源:PSDriveInfo.cs


示例2: Start

        /// <summary>
        /// Starts the specified provider. This method is called by the Windows PowerShell runtime to initialize the
        /// provider when the provider is loaded into a session.
        /// </summary>
        /// <param name="providerInfo">
        /// A <see cref="ProviderInfo"/> object that describes the provider to be initialized.
        /// </param>
        /// <returns>A <see cref="ProviderInfo"/> object that contains information about the provider.</returns>
        protected override ProviderInfo Start(ProviderInfo providerInfo)
        {
            // Increase console window size
            this.IncreaseWindowSize(120, 50);

            return base.Start(providerInfo);
        }
开发者ID:jean,项目名称:OrchardPs,代码行数:15,代码来源:OrchardProvider.cs


示例3: ValidateDirectory

        public static void ValidateDirectory(ProviderInfo provider, string directory)
        {
            validateFileSystemPath(provider, directory);

            if (!Directory.Exists(directory))
            {
                Exception exception;

                if (File.Exists(directory))
                {
                    exception = new InvalidOperationException($"{directory} is not a directory.");
                    ExceptionHelper.SetUpException(
                                                   ref exception,
                                                   ERR_NO_DIRECTORY,
                                                   ErrorCategory.InvalidOperation,
                                                   directory);
                }
                else
                {
                    exception =
                        new FileNotFoundException(
                            $"The directory {directory} could not be found.");
                    ExceptionHelper.SetUpException(
                                                   ref exception,
                                                   ERR_NO_DIRECTORY,
                                                   ErrorCategory.InvalidData,
                                                   directory);
                }

                throw exception;
            }
        }
开发者ID:CenturionFox,项目名称:attribute-common,代码行数:32,代码来源:FileUtility.cs


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


示例5: UniversalProviderInfo

        protected UniversalProviderInfo(ProviderInfo providerInfo) : base(providerInfo) {
            try {
                PropertySheet = PropertySheet.Parse(@"@import ""pstab.properties"";", "default");
            } catch (Exception) {

                PropertySheet = new PropertySheet();
            }
            
        }
开发者ID:roomaroo,项目名称:coapp.powershell,代码行数:9,代码来源:UniversalProviderInfo.cs


示例6: PSDriveInfo

 public PSDriveInfo(string name, ProviderInfo provider, string root, string description, PSCredential credential)
 {
     Name = name;
     Provider = provider;
     Root = root;
     Description = description;
     Credential = credential;
     CurrentLocation = string.Empty;
 }
开发者ID:Ventero,项目名称:Pash,代码行数:9,代码来源:PSDriveInfo.cs


示例7: AzureDriveInfo

 public AzureDriveInfo(Rule aliasRule, ProviderInfo providerInfo, PSCredential psCredential = null)
     : base(GetDriveInfo(aliasRule, providerInfo, psCredential))
 {
     Path = new Path {
         Account = aliasRule.HasProperty("key") ? aliasRule["key"].Value : aliasRule.Parameter,
         Container = aliasRule.HasProperty("container") ? aliasRule["container"].Value : "",
         SubPath = aliasRule.HasProperty("root") ? aliasRule["root"].Value.Replace('/', '\\').Replace("\\\\", "\\").Trim('\\') : "",
     };
     Path.Validate();
     Secret = aliasRule.HasProperty("secret") ? aliasRule["secret"].Value : psCredential != null ? psCredential.Password.ToString() : null;
 }
开发者ID:ericschultz,项目名称:devtools,代码行数:11,代码来源:AzureDriveInfo.cs


示例8: ProviderInfo

 protected ProviderInfo(ProviderInfo providerInfo)
 {
     _sessionState = providerInfo._sessionState;
     PSSnapIn = providerInfo.PSSnapIn;
     Name = providerInfo.Name;
     Description = providerInfo.Description;
     Home = providerInfo.Home;
     ImplementingType = providerInfo.ImplementingType;
     Capabilities = providerInfo.Capabilities;
     HelpFile = providerInfo.HelpFile;
 }
开发者ID:b333z,项目名称:Pash,代码行数:11,代码来源:ProviderInfo.cs


示例9: GetProviderAssemblyPath

 private static string GetProviderAssemblyPath(ProviderInfo providerInfo)
 {
     if (providerInfo == null)
     {
         return null;
     }
     if (providerInfo.ImplementingType == null)
     {
         return null;
     }
     return Path.GetDirectoryName(providerInfo.ImplementingType.Assembly.Location);
 }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:ProviderHelpProvider.cs


示例10: GetLocationResolver

 public static ILocationResolver GetLocationResolver(ProviderInfo providerInfo) {
     var result = providerInfo as ILocationResolver;
     if (result == null) {
         if (providerInfo.Name == "FileSystem") {
             return new FilesystemLocationProvider(providerInfo);
         }
     }
     if (result == null) {
         throw new ClrPlusException("Unable to create location resolver for {0}".format(providerInfo.Name));
     }
     return result;
 }
开发者ID:roomaroo,项目名称:coapp.powershell,代码行数:12,代码来源:CopyItemExCmdlet.cs


示例11: base

 internal DirectoryServiceDriveInfo
 (
     String name,
     ProviderInfo provider,
     String description,
     PSCredential credential,
     DirectoryRootInfo rootInfo
 )
     : base(name, provider, name + ':', description, credential)
 {
     _rootInfo = rootInfo;
 }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:DirectoryServiceDriveInfo.cs


示例12: validateFileSystemPath

 private static void validateFileSystemPath(ProviderInfo provider, string directory)
 {
     if (!isFileSystemPath(provider))
     {
         Exception exception = new ArgumentException("The syntax of the command is incorrect.");
         ExceptionHelper.SetUpException(
                                        ref exception,
                                        ERR_BAD_PROVIDER,
                                        ErrorCategory.InvalidArgument,
                                        directory);
         throw exception;
     }
 }
开发者ID:CenturionFox,项目名称:attribute-common,代码行数:13,代码来源:FileUtility.cs


示例13: Start

 protected override ProviderInfo Start(ProviderInfo sitecoreProviderInfo)
 {
     try
     {
         sitecoreProviderInfo.Description = "Sitcore Content Provider";
         providerInfo = sitecoreProviderInfo;
         LogInfo("Executing Start(string providerInfo='{0}')", sitecoreProviderInfo.Name);
         return sitecoreProviderInfo;
     }
     catch (Exception ex)
     {
         LogError(ex, "Error while executing Start(string providerInfo='{0}')", sitecoreProviderInfo.Name);
         throw;
     }
 }
开发者ID:sobek85,项目名称:Console,代码行数:15,代码来源:PsSitecoreItemProvider.Maintenance.cs


示例14: ProviderInfo

 protected ProviderInfo(ProviderInfo providerInfo)
 {
     this.helpFile = "";
     if (providerInfo == null)
     {
         throw PSTraceSource.NewArgumentNullException("providerInfo");
     }
     this.name = providerInfo.Name;
     this.implementingType = providerInfo.ImplementingType;
     this.capabilities = providerInfo.capabilities;
     this.description = providerInfo.description;
     this.hiddenDrive = providerInfo.hiddenDrive;
     this.home = providerInfo.home;
     this.helpFile = providerInfo.helpFile;
     this.pssnapin = providerInfo.pssnapin;
     this.sessionState = providerInfo.sessionState;
 }
开发者ID:nickchal,项目名称:pash,代码行数:17,代码来源:ProviderInfo.cs


示例15: PathInfo

 internal PathInfo(PSDriveInfo drive, ProviderInfo provider, string path, SessionState sessionState)
 {
     if (provider == null)
     {
         throw PSTraceSource.NewArgumentNullException("provider");
     }
     if (path == null)
     {
         throw PSTraceSource.NewArgumentNullException("path");
     }
     if (sessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("sessionState");
     }
     this.drive = drive;
     this.provider = provider;
     this.path = path;
     this.sessionState = sessionState;
 }
开发者ID:nickchal,项目名称:pash,代码行数:19,代码来源:PathInfo.cs


示例16: IsFileSystemPath

 protected bool IsFileSystemPath(ProviderInfo provider, string path)
 {
     bool isFileSystem = true;
     // check that this provider is the filesystem
     if (provider.ImplementingType != typeof(FileSystemProvider))
     {
         // create a .NET exception wrapping our error text
         ArgumentException ex = new ArgumentException(path +
             " does not resolve to a path on the FileSystem provider.");
         // wrap this in a powershell errorrecord
         ErrorRecord error = new ErrorRecord(ex, "InvalidProvider",
             ErrorCategory.InvalidArgument, path);
         // write a non-terminating error to pipeline
         WriteError(error);
         // tell our caller that the item was not on the filesystem
         isFileSystem = false;
     }
     return isFileSystem;
 }
开发者ID:rmichela,项目名称:ConfigRewriter,代码行数:19,代码来源:HttpCommandBase.cs


示例17: ProviderInvocationException

        /// <summary>
        /// Constructs a ProviderInvocationException with provider information and an inner exception.
        /// </summary>
        /// 
        /// <param name="provider">
        /// Information about the provider to be used in formatting the message.
        /// </param>
        /// 
        /// <param name="innerException">
        /// The inner exception for this exception.
        /// </param>
        internal ProviderInvocationException(ProviderInfo provider, Exception innerException)
            : base(RuntimeException.RetrieveMessage(innerException), innerException)
        {
            _message = base.Message;
            _providerInfo = provider;

            IContainsErrorRecord icer = innerException as IContainsErrorRecord;
            if (null != icer && null != icer.ErrorRecord)
            {
                _errorRecord = new ErrorRecord(icer.ErrorRecord, innerException);
            }
            else
            {
                _errorRecord = new ErrorRecord(
                    innerException,
                    "ErrorRecordNotSpecified",
                    ErrorCategory.InvalidOperation,
                    null);
            }
        }
开发者ID:40a,项目名称:PowerShell,代码行数:31,代码来源:SessionStateExceptions.cs


示例18: GetProviderSpecificPath

        internal string GetProviderSpecificPath(string path, ProviderRuntime runtime, out ProviderInfo providerInfo)
        {
            // differentiate between drive-qualified, provider-qualified, provider-internal, and provider-direct paths
            // then strip provider prefix, set provider, set drive is possible or get from Drive.Current
            PSDriveInfo drive;
            string resolvedPath = null;
            if (IsProviderQualifiedPath(path))
            {
                resolvedPath = GetProviderPathFromProviderQualifiedPath(path, out providerInfo);
                // in case there is no CurrentDrive, set a dummy drive to keep track of the used provider
                drive = providerInfo.CurrentDrive ?? providerInfo.DummyDrive;
            }
            else if (IsDriveQualifiedPath(path))
            {
                resolvedPath = GetProviderPathFromDriveQualifiedPath(path, runtime, out providerInfo, out drive);
            }
            // otherwise we first need to know about the provider/drive in use to properly resolve the path
            else if (runtime.PSDriveInfo != null)
            {
                drive = runtime.PSDriveInfo;
                providerInfo = drive.Provider;
            }
            else
            {
                drive = _sessionState.Path.CurrentLocation.Drive;
                providerInfo = _sessionState.Path.CurrentLocation.Provider;
            }
            // TODO: check for provider internal path beginning with \\ or //
            //       make sure to set the drive to a dummy drive then

            runtime.PSDriveInfo = drive;

            // if we had no success, yet, we deal with some kind of provider specific (maybe relative) path
            if (resolvedPath == null)
            {
                resolvedPath = ResolveHomePath(path, runtime, providerInfo);
                resolvedPath = ResolveRelativePath(resolvedPath, runtime, providerInfo);
            }

            return resolvedPath;
        }
开发者ID:mauve,项目名称:Pash,代码行数:41,代码来源:PathGlobber.cs


示例19: Add

        internal CmdletProvider Add(ProviderInfo providerInfo, ExecutionContext executionContext)
        {
            CmdletProvider provider = providerInfo.CreateInstance();

            var runtime = new ProviderRuntime(executionContext.SessionState);
            providerInfo = provider.Start(providerInfo, runtime);
            provider.SetProviderInfo(providerInfo);

            // Cache the Provider's Info and instance
            if (!_providers.ContainsKey(providerInfo.Name))
            {
                _providers.Add(providerInfo.Name, new List<ProviderInfo>());
            }
            _providers[providerInfo.Name].Add(providerInfo);
            _providerInstances[providerInfo] = provider;

            // provider is added, default drives can be added
            AddDefaultDrives(provider, runtime);

            return provider;
        }
开发者ID:bitwiseman,项目名称:Pash,代码行数:21,代码来源:CmdletProviderManagementIntrinsics.cs


示例20: createScopes

        public void createScopes()
        {
            TestHost testHost = new TestHost(new TestHostUserInterface());

            Runspace hostRunspace = TestHost.CreateRunspace(testHost);

            globalState = hostRunspace.ExecutionContext.SessionState;

            var dummyProviderInfo = new ProviderInfo(globalState, typeof(DummyProvider), "DummyProvider", "", null);
            globalState.Provider.Add(dummyProviderInfo, hostRunspace.ExecutionContext);
            dummyProvider = globalState.Provider.GetOne("DummyProvider");

            scriptState = new SessionState(globalState);
            scriptState.IsScriptScope = true;
            functionState = new SessionState(scriptState);
            localState = new SessionState(functionState);
            states = new Dictionary<AvailableStates, SessionState>();
            states.Add(AvailableStates.Global, globalState);
            states.Add(AvailableStates.Script, scriptState);
            states.Add(AvailableStates.Function, functionState);
            states.Add(AvailableStates.Local, localState);

            hostCommandManager = new CommandManager(hostRunspace as LocalRunspace);
        }
开发者ID:mauve,项目名称:Pash,代码行数:24,代码来源:SessionStateScopeTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Automation.RuntimeDefinedParameter类代码示例发布时间:2022-05-26
下一篇:
C# Automation.ProgressRecord类代码示例发布时间: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