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

C# Provider.CmdletProvider类代码示例

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

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



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

示例1: Context

 public Context(CmdletProvider provider, string path, PSDriveInfo drive, IPathNodeProcessor pathProcessor, object dynamicParameters, Version topology, bool recurse)
 {
     _pathProcessor = pathProcessor;
     DynamicParameters = dynamicParameters;
     _provider = provider;
     _path = path;
     _drive = drive;
     _recurse = recurse;
     PathTopologyVersion = topology;
 }
开发者ID:beefarino,项目名称:bips,代码行数:10,代码来源:Context.cs


示例2: ProviderContext

 public ProviderContext(CmdletProvider provider, string path, PSDriveInfo drive, IPathResolver pathProcessor, object dynamicParameters, Version topology, bool recurse)
 {
     this.pathProcessor = pathProcessor;
     DynamicParameters = dynamicParameters;
     this.provider = provider;
     this.path = path;
     this.drive = drive;
     this.recurse = recurse;
     PathTopologyVersion = topology;
 }
开发者ID:viciousviper,项目名称:p2f,代码行数:10,代码来源:ProviderContext.cs


示例3: ItemContentReaderWriterBase

        protected ItemContentReaderWriterBase(CmdletProvider provider, Item item,
            FileSystemCmdletProviderEncoding encoding, bool raw)
        {
            Item = item;
            Provider = provider;
            Raw = raw;

            if (encoding == FileSystemCmdletProviderEncoding.Unknown)
            {
                encoding = FileSystemCmdletProviderEncoding.Byte;
            }
            Encoding = new FileSystemContentWriterDynamicParameters() {Encoding = encoding}.EncodingType;
        }
开发者ID:GuitarRich,项目名称:Console,代码行数:13,代码来源:ItemContentReaderWriterBase.cs


示例4: ItemContentWriter

 public ItemContentWriter(CmdletProvider provider, Item item, string path,  FileSystemCmdletProviderEncoding encoding, string extension, bool raw, bool fileBased, bool versioned, string language)
     : base(provider, item, encoding, raw)
 {
     if (Encoding != null && !Raw)
     {
         encoder = Encoding.GetEncoder();
     }
     if (!string.IsNullOrEmpty(extension))
     {
         this.extension = extension.StartsWith(".") ? extension : "." + extension;
     }
     this.fileBased = fileBased;
     this.path = path;
     this.versioned = versioned;
     this.language = language ?? Item?.Language?.Name;
     database = Item?.Database?.Name ?? PathUtilities.GetDrive(path, "master");
 }
开发者ID:GuitarRich,项目名称:Console,代码行数:17,代码来源:ItemContentWriter.cs


示例5: GetGlobbedProviderPaths

        internal Collection<string> GetGlobbedProviderPaths(string path, ProviderRuntime runtime, bool itemMustExist,
                                                            out CmdletProvider provider)
        {
            var results = new Collection<string>();
            ProviderInfo providerInfo;

            // get internal path, resolve home path and set provider info and drive info (if resolved)
            path = GetProviderSpecificPath(path, runtime, out providerInfo);
            provider = _sessionState.Provider.GetInstance(providerInfo);

            if (!ShouldGlob(path, runtime))
            {
                // Although even ItemCmdletProvider supports ItemExists, PS doesn't seem
                // to throw errors when resolving paths with ItemProviders, only for ContainerProviders or higher
                // this behavior can be seen in the tests
                var containerProvider = provider as ContainerCmdletProvider;
                if (itemMustExist && containerProvider != null && !containerProvider.ItemExists(path, runtime))
                {
                    var msg = String.Format("An item with path {0} doesn't exist", path);
                    runtime.WriteError(new ItemNotFoundException(msg).ErrorRecord);
                    return results;
                }
                results.Add(path);
                return results;
            }

            if (providerInfo.Capabilities.HasFlag(ProviderCapabilities.ExpandWildcards))
            {
                var filter = new IncludeExcludeFilter(runtime.Include, runtime.Exclude, runtime.IgnoreFiltersForGlobbing);
                foreach (var expanded in CmdletProvider.As<ItemCmdletProvider>(provider).ExpandPath(path, runtime))
                {
                    if (filter.Accepts(expanded))
                    {
                        results.Add(expanded);
                    }
                }
            }
            else
            {
                results = BuiltInGlobbing(provider, path, runtime);
            }

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


示例6: GetPermissionProviderInstance

        /// <summary>
        /// Gets an instance of an ISecurityDescriptorCmdletProvider given the provider ID.
        /// </summary>
        /// 
        /// <param name="providerInstance">
        /// An instance of a CmdletProvider.
        /// </param>
        /// 
        /// <returns>
        /// An instance of a ISecurityDescriptorCmdletProvider for the specified provider ID.
        /// </returns>
        /// 
        /// <throws>
        /// ArgumentNullException if providerId is null.
        /// NotSupportedException if the providerId is not for a provider
        /// that is derived from ISecurityDescriptorCmdletProvider.
        /// </throws>
        /// 
        internal static ISecurityDescriptorCmdletProvider GetPermissionProviderInstance(CmdletProvider providerInstance)
        {
            if (providerInstance == null)
            {
                throw PSTraceSource.NewArgumentNullException("providerInstance");
            }

            ISecurityDescriptorCmdletProvider permissionCmdletProvider =
                providerInstance as ISecurityDescriptorCmdletProvider;

            if (permissionCmdletProvider == null)
            {
                throw
                    PSTraceSource.NewNotSupportedException(
                        ProviderBaseSecurity.ISecurityDescriptorCmdletProvider_NotSupported);
            }

            return permissionCmdletProvider;
        } // GetPermissionProviderInstance
开发者ID:40a,项目名称:PowerShell,代码行数:37,代码来源:SessionStateSecurityDescriptorInterface.cs


示例7: FileSystemContentReaderWriter

 public FileSystemContentReaderWriter(string path, string streamName, FileMode mode, FileAccess access, FileShare share, Encoding encoding, bool usingByteEncoding, bool waitForChanges, CmdletProvider provider, bool isRawStream)
 {
     this.delimiter = "\n";
     if (string.IsNullOrEmpty(path))
     {
         throw PSTraceSource.NewArgumentNullException("path");
     }
     tracer.WriteLine("path = {0}", new object[] { path });
     tracer.WriteLine("mode = {0}", new object[] { mode });
     tracer.WriteLine("access = {0}", new object[] { access });
     this.path = path;
     this.streamName = streamName;
     this.mode = mode;
     this.access = access;
     this.share = share;
     this.encoding = encoding;
     this.usingByteEncoding = usingByteEncoding;
     this.waitForChanges = waitForChanges;
     this.provider = provider;
     this.isRawStream = isRawStream;
     this.CreateStreams(path, streamName, mode, access, share, encoding);
 }
开发者ID:nickchal,项目名称:pash,代码行数:22,代码来源:FileSystemContentReaderWriter.cs


示例8: IsItemContainer

        private bool IsItemContainer(CmdletProvider provider, string path, ProviderRuntime providerRuntime)
        {
            NavigationCmdletProvider navigationProvider = provider as NavigationCmdletProvider;

            if (navigationProvider == null)
                return false;

            return navigationProvider.IsItemContainer(path, providerRuntime);
        }
开发者ID:staxmanade,项目名称:Pash,代码行数:9,代码来源:SessionStateGlobal.cs


示例9: GetGlobbedProviderPathsFromMonadPath

 internal Collection<string> GetGlobbedProviderPathsFromMonadPath(string path, bool allowNonexistingPaths, out ProviderInfo provider, out CmdletProvider providerInstance)
 {
     providerInstance = null;
     if (path == null)
     {
         throw PSTraceSource.NewArgumentNullException("path");
     }
     CmdletProviderContext context = new CmdletProviderContext(this.sessionState.Internal.ExecutionContext);
     return this.GetGlobbedProviderPathsFromMonadPath(path, allowNonexistingPaths, context, out provider, out providerInstance);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:LocationGlobber.cs


示例10: GetGlobbedMonadPathsFromMonadPath

 internal Collection<PathInfo> GetGlobbedMonadPathsFromMonadPath(string path, bool allowNonexistingPaths, out CmdletProvider providerInstance)
 {
     CmdletProviderContext context = new CmdletProviderContext(this.sessionState.Internal.ExecutionContext);
     return this.GetGlobbedMonadPathsFromMonadPath(path, allowNonexistingPaths, context, out providerInstance);
 }
开发者ID:nickchal,项目名称:pash,代码行数:5,代码来源:LocationGlobber.cs


示例11: FileSystemContentReaderWriter

        /// <summary>
        /// Constructor for the content stream
        /// </summary>
        /// 
        /// <param name="path">
        /// The path to the file to get the content from.
        /// </param>
        /// 
        /// <param name="streamName">
        /// The name of the Alternate Data Stream to get the content from. If null or empty, returns
        /// the file's primary content.
        /// </param>
        /// 
        /// <param name="mode">
        /// The file mode to open the file with.
        /// </param>
        /// 
        /// <param name="access">
        /// The file access requested in the file.
        /// </param>
        /// 
        /// <param name="share">
        /// The file share to open the file with
        /// </param>
        ///
        /// <param name="encoding">
        /// The encoding of the file to be read or written.
        /// </param>
        /// 
        /// <param name="usingByteEncoding">
        /// If true, bytes will be read from the file. If false, the specified encoding
        /// will be used to read the file.
        /// </param>
        /// 
        /// <param name="waitForChanges">
        /// If true, we will perform blocking reads on the file, waiting for new content to be appended
        /// </param>
        /// 
        /// <param name="provider">
        /// The CmdletProvider invoking this stream
        /// </param>
        /// 
        /// <param name="isRawStream">
        /// Indicates raw stream.
        /// </param>
        /// 
        public FileSystemContentReaderWriter(
            string path, string streamName, FileMode mode, FileAccess access, FileShare share,
            Encoding encoding, bool usingByteEncoding, bool waitForChanges, CmdletProvider provider,
            bool isRawStream)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw PSTraceSource.NewArgumentNullException("path");
            }

            if (s_tracer.IsEnabled)
            {
                s_tracer.WriteLine("path = {0}", path);
                s_tracer.WriteLine("mode = {0}", mode);
                s_tracer.WriteLine("access = {0}", access);
            }

            _path = path;
            _streamName = streamName;
            _mode = mode;
            _access = access;
            _share = share;
            _encoding = encoding;
            _usingByteEncoding = usingByteEncoding;
            _waitForChanges = waitForChanges;
            _provider = provider;
            _isRawStream = isRawStream;

            CreateStreams(path, streamName, mode, access, share, encoding);
        }
开发者ID:40a,项目名称:PowerShell,代码行数:76,代码来源:FileSystemContentStream.cs


示例12: GenerateRelativePath

        internal string GenerateRelativePath(PSDriveInfo drive, string path, bool escapeCurrentLocation, CmdletProvider providerInstance, CmdletProviderContext context)
        {
            if (path == null)
            {
                throw PSTraceSource.NewArgumentNullException("path");
            }
            if (drive == null)
            {
                throw PSTraceSource.NewArgumentNullException("drive");
            }
            string currentLocation = drive.CurrentLocation;
			bool flag1 = OSHelper.IsUnix && drive.Root.StartsWith ("/");
			if (!flag1 && !string.IsNullOrEmpty(currentLocation) && currentLocation.StartsWith(drive.Root, StringComparison.Ordinal))
            {
                currentLocation = currentLocation.Substring(drive.Root.Length);
            }
            if (escapeCurrentLocation)
            {
                currentLocation = WildcardPattern.Escape(currentLocation);
            }
            if (!string.IsNullOrEmpty(path))
            {
				var flag6 = OSHelper.IsUnix;
				var flag7 = flag6;
				if (!flag6) flag6 = (path[0] != '/');
                if ((path[0] != '\\') && flag6)
                {
                Label_024B:
                    if ((path.Length > 0) && this.HasRelativePathTokens(path))
                    {
                        if (context.Stopping)
                        {
                            throw new PipelineStoppedException();
                        }
                        bool flag = false;
                        bool flag2 = path.StartsWith("..", StringComparison.Ordinal);
                        bool flag3 = path.Length == 2;
                        bool flag4 = (path.Length > 2) && ((path[2] == '\\') || (path[2] == '/'));
						if (flag7) flag4 = flag7;
                        if (flag2 && (flag3 || flag4))
                        {
                            if (!string.IsNullOrEmpty(currentLocation))
                            {
                                currentLocation = this.sessionState.Internal.GetParentPath(providerInstance, currentLocation, drive.Root, context);
                            }
                            tracer.WriteLine("Parent path = {0}", new object[] { currentLocation });
                            path = path.Substring(2);
                            tracer.WriteLine("path = {0}", new object[] { path });
                            flag = true;
                            if (path.Length != 0)
                            {
								if (!flag7) {
	                                if ((path[0] == '\\') || (path[0] == '/'))
	                                {
	                                    path = path.Substring(1);
	                                }
								}
                                tracer.WriteLine("path = {0}", new object[] { path });
                                if (path.Length != 0)
                                {
                                    goto Label_024B;
                                }
                            }
                            goto Label_0260;
                        }
                        if (path.Equals(".", StringComparison.OrdinalIgnoreCase))
                        {
                            flag = true;
                            path = string.Empty;
                            goto Label_0260;
                        }
                        if (path.StartsWith(@".\", StringComparison.Ordinal) || path.StartsWith("./", StringComparison.Ordinal))
                        {
                            path = path.Substring(@".\".Length);
                            flag = true;
                            tracer.WriteLine("path = {0}", new object[] { path });
                            if (path.Length == 0)
                            {
                                goto Label_0260;
                            }
                        }
                        if ((path.Length == 0) || !flag)
                        {
                            goto Label_0260;
                        }
                        goto Label_024B;
                    }
                }
                else
                {
                    currentLocation = string.Empty;
                    path = path.Substring(1);
                    tracer.WriteLine("path = {0}", new object[] { path });
                }
            }
        Label_0260:
            if (!string.IsNullOrEmpty(path))
            {
                currentLocation = this.sessionState.Internal.MakePath(providerInstance, currentLocation, path, context);
            }
//.........这里部分代码省略.........
开发者ID:nickchal,项目名称:pash,代码行数:101,代码来源:LocationGlobber.cs


示例13: GetDriveRootRelativePathFromPSPath

        internal string GetDriveRootRelativePathFromPSPath (string path, CmdletProviderContext context, bool escapeCurrentLocation, out PSDriveInfo workingDriveForPath, out CmdletProvider providerInstance)
		{
			if (path == null) {
				throw PSTraceSource.NewArgumentNullException ("path");
			}
			if (OSHelper.IsUnix) {
				int index = path.IndexOf ("::");
				if (index != -1)
				{
					path = path.Substring (index + 2);
				}
			}
            workingDriveForPath = null;
            string driveName = null;
            if (this.sessionState.Drive.Current != null)
            {
                driveName = this.sessionState.Drive.Current.Name;
            }
            bool flag = false;
            if (this.IsAbsolutePath(path, out driveName))
            {
                tracer.WriteLine("Drive Name: {0}", new object[] { driveName });
                try
                {
                    workingDriveForPath = this.sessionState.Drive.Get(driveName);
                }
                catch (DriveNotFoundException)
                {
                    if (this.sessionState.Drive.Current == null)
                    {
                        throw;
                    }
					if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
					{
						flag = path.StartsWith ("/", StringComparison.OrdinalIgnoreCase);
						workingDriveForPath = this.sessionState.Drive.Current;
					}
					else
					{
						string str2 = OSHelper.IsUnix ? this.sessionState.Drive.Current.Root : this.sessionState.Drive.Current.Root.Replace('/', '\\');
						string tempPath = OSHelper.IsUnix ? path : path.Replace('/', '\\');
	                    if ((str2.IndexOf(":", StringComparison.CurrentCulture) >= 0) && tempPath.StartsWith(str2, StringComparison.OrdinalIgnoreCase))
	                    {
	                        flag = true;
							if (!OSHelper.IsUnix) {
		                        path = path.Substring(str2.Length);
		                        path = path.TrimStart(new char[] { '\\' });
		                        path = '\\' + path;
							}
	                        workingDriveForPath = this.sessionState.Drive.Current;
	                    }
	                    if (!flag)
	                    {
	                        throw;
	                    }
					}
                }
				if (!flag) /* && !OSHelper.IsUnix */
                {
                    path = path.Substring(driveName.Length + 1);
                }
            }
            else
            {
                workingDriveForPath = this.sessionState.Drive.Current;
            }
            if (workingDriveForPath == null)
            {
                ItemNotFoundException exception = new ItemNotFoundException(path, "PathNotFound", SessionStateStrings.PathNotFound);
                pathResolutionTracer.TraceError("Item does not exist: {0}", new object[] { path });
                throw exception;
            }
            try
            {
                providerInstance = this.sessionState.Internal.GetContainerProviderInstance(workingDriveForPath.Provider);
                context.Drive = workingDriveForPath;
                return this.GenerateRelativePath(workingDriveForPath, path, escapeCurrentLocation, providerInstance, context);
            }
            catch (PSNotSupportedException)
            {
                providerInstance = null;
                return "";
            }
        }
开发者ID:nickchal,项目名称:pash,代码行数:84,代码来源:LocationGlobber.cs


示例14: GetGlobbedProviderPathsFromProviderPath

 internal Collection<string> GetGlobbedProviderPathsFromProviderPath(string path, bool allowNonexistingPaths, string providerId, out CmdletProvider providerInstance)
 {
     providerInstance = null;
     if (path == null)
     {
         throw PSTraceSource.NewArgumentNullException("path");
     }
     CmdletProviderContext context = new CmdletProviderContext(this.sessionState.Internal.ExecutionContext);
     Collection<string> collection = this.GetGlobbedProviderPathsFromProviderPath(path, allowNonexistingPaths, providerId, context, out providerInstance);
     if (context.HasErrors())
     {
         ErrorRecord record = context.GetAccumulatedErrorObjects()[0];
         if (record != null)
         {
             throw record.Exception;
         }
     }
     return collection;
 }
开发者ID:nickchal,项目名称:pash,代码行数:19,代码来源:LocationGlobber.cs


示例15: ResolveDriveQualifiedPath

 private Collection<PathInfo> ResolveDriveQualifiedPath(string path, CmdletProviderContext context, bool allowNonexistingPaths, out CmdletProvider providerInstance)
 {
     providerInstance = null;
     PSDriveInfo workingDriveForPath = null;
     Collection<PathInfo> collection = new Collection<PathInfo>();
     pathResolutionTracer.WriteLine("Path is DRIVE-QUALIFIED", new object[0]);
     string str = this.GetDriveRootRelativePathFromPSPath(path, context, true, out workingDriveForPath, out providerInstance);
     pathResolutionTracer.WriteLine("DRIVE-RELATIVE path: {0}", new object[] { str });
     pathResolutionTracer.WriteLine("Drive: {0}", new object[] { workingDriveForPath.Name });
     pathResolutionTracer.WriteLine("Provider: {0}", new object[] { workingDriveForPath.Provider });
     context.Drive = workingDriveForPath;
     providerInstance = this.sessionState.Internal.GetContainerProviderInstance(workingDriveForPath.Provider);
     ContainerCmdletProvider provider = providerInstance as ContainerCmdletProvider;
     ItemCmdletProvider provider2 = providerInstance as ItemCmdletProvider;
     ProviderInfo providerInfo = providerInstance.ProviderInfo;
     string item = null;
     string providerPath = null;
     if (workingDriveForPath.Hidden)
     {
         item = GetProviderQualifiedPath(str, providerInfo);
         providerPath = str;
     }
     else
     {
         item = GetDriveQualifiedPath(str, workingDriveForPath);
         providerPath = this.GetProviderPath(path, context);
     }
     pathResolutionTracer.WriteLine("PROVIDER path: {0}", new object[] { providerPath });
     Collection<string> collection2 = new Collection<string>();
     if (!context.SuppressWildcardExpansion)
     {
         if (CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.ExpandWildcards, providerInfo))
         {
             pathResolutionTracer.WriteLine("Wildcard matching is being performed by the provider.", new object[0]);
             if ((provider2 != null) && WildcardPattern.ContainsWildcardCharacters(str))
             {
                 foreach (string str4 in provider2.ExpandPath(providerPath, context))
                 {
                     collection2.Add(this.GetDriveRootRelativePathFromProviderPath(str4, workingDriveForPath, context));
                 }
             }
             else
             {
                 collection2.Add(this.GetDriveRootRelativePathFromProviderPath(providerPath, workingDriveForPath, context));
             }
         }
         else
         {
             pathResolutionTracer.WriteLine("Wildcard matching is being performed by the engine.", new object[0]);
             collection2 = this.ExpandMshGlobPath(str, allowNonexistingPaths, workingDriveForPath, provider, context);
         }
     }
     else if (provider2 != null)
     {
         if (allowNonexistingPaths || provider2.ItemExists(providerPath, context))
         {
             collection2.Add(item);
         }
     }
     else
     {
         collection2.Add(item);
     }
     if ((((!allowNonexistingPaths && (collection2.Count < 1)) && !WildcardPattern.ContainsWildcardCharacters(path)) && ((context.Include == null) || (context.Include.Count == 0))) && ((context.Exclude == null) || (context.Exclude.Count == 0)))
     {
         ItemNotFoundException exception = new ItemNotFoundException(path, "PathNotFound", SessionStateStrings.PathNotFound);
         pathResolutionTracer.TraceError("Item does not exist: {0}", new object[] { path });
         throw exception;
     }
     foreach (string str5 in collection2)
     {
         if (context.Stopping)
         {
             throw new PipelineStoppedException();
         }
         item = null;
         if (workingDriveForPath.Hidden)
         {
             if (IsProviderDirectPath(str5))
             {
                 item = str5;
             }
             else
             {
                 item = GetProviderQualifiedPath(str5, providerInfo);
             }
         }
         else
         {
             item = GetDriveQualifiedPath(str5, workingDriveForPath);
         }
         collection.Add(new PathInfo(workingDriveForPath, providerInfo, item, this.sessionState));
         pathResolutionTracer.WriteLine("RESOLVED PATH: {0}", new object[] { item });
     }
     return collection;
 }
开发者ID:nickchal,项目名称:pash,代码行数:96,代码来源:LocationGlobber.cs


示例16: InitializeProvider

        private void InitializeProvider(CmdletProvider providerInstance, ProviderInfo provider)
        {
            List<PSDriveInfo> drives = new List<PSDriveInfo>();
            DriveCmdletProvider driveProvider = providerInstance as DriveCmdletProvider;

            if (driveProvider != null)
            {
                Collection<PSDriveInfo> collection = driveProvider.DoInitializeDefaultDrives();
                if ((collection != null) && (collection.Count > 0))
                {
                    drives.AddRange(collection);
                    _providersCurrentDrive[provider] = collection[0];
                }
            }

            if (drives.Count > 0)
            {
                foreach (PSDriveInfo driveInfo in drives)
                {
                    if (driveInfo != null)
                    {
                        // TODO: need to set driveInfo.Root

                        driveProvider.DoNewDrive(driveInfo);

                        try
                        {
                            _drives.Add(driveInfo.Name, driveInfo);
                        }
                        catch
                        {
                            // TODO: What should we do if the drive name is not unique?
                        }
                    }
                }
            }
        }
开发者ID:staxmanade,项目名称:Pash,代码行数:37,代码来源:SessionStateGlobal.cs


示例17: ResolveProviderPathFromProviderPath

 private Collection<string> ResolveProviderPathFromProviderPath(string providerPath, string providerId, bool allowNonexistingPaths, CmdletProviderContext context, out CmdletProvider providerInstance)
 {
     providerInstance = this.sessionState.Internal.GetProviderInstance(providerId);
     ContainerCmdletProvider containerProvider = providerInstance as ContainerCmdletProvider;
     ItemCmdletProvider provider2 = providerInstance as ItemCmdletProvider;
     Collection<string> collection = new Collection<string>();
     if (!context.SuppressWildcardExpansion)
     {
         if (CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.ExpandWildcards, providerInstance.ProviderInfo))
         {
             pathResolutionTracer.WriteLine("Wildcard matching is being performed by the provider.", new object[0]);
             if ((provider2 != null) && WildcardPattern.ContainsWildcardCharacters(providerPath))
             {
                 collection = new Collection<string>(provider2.ExpandPath(providerPath, context));
             }
             else
             {
                 collection.Add(providerPath);
             }
         }
         else
         {
             pathResolutionTracer.WriteLine("Wildcard matching is being performed by the engine.", new object[0]);
             if (containerProvider != null)
             {
                 collection = this.GetGlobbedProviderPathsFromProviderPath(providerPath, allowNonexistingPaths, containerProvider, context);
             }
             else
             {
                 collection.Add(providerPath);
             }
         }
     }
     else if (provider2 != null)
     {
         if (allowNonexistingPaths || provider2.ItemExists(providerPath, context))
         {
             collection.Add(providerPath);
         }
     }
     else
     {
         collection.Add(providerPath);
     }
     if (((allowNonexistingPaths || (collection.Count >= 1)) || WildcardPattern.ContainsWildcardCharacters(providerPath)) || ((context.Include != null) && (context.Include.Count != 0)))
     {
         return collection;
     }
     if ((context.Exclude != null) && (context.Exclude.Count != 0))
     {
         return collection;
     }
     ItemNotFoundException exception = new ItemNotFoundException(providerPath, "PathNotFound", SessionStateStrings.PathNotFound);
     pathResolutionTracer.TraceError("Item does not exist: {0}", new object[] { providerPath });
     throw exception;
 }
开发者ID:nickchal,项目名称:pash,代码行数:56,代码来源:LocationGlobber.cs


示例18: ItemExists

        private bool ItemExists(CmdletProvider provider, string path, ProviderRuntime providerRuntime)
        {
            ItemCmdletProvider itemProvider = provider as ItemCmdletProvider;

            if (itemProvider == null)
                return false;

            return itemProvider.ItemExists(path, providerRuntime);
        }
开发者ID:staxmanade,项目名称:Pash,代码行数:9,代码来源:SessionStateGlobal.cs


示例19: ResolvePSPathFromProviderPath

 private Collection<PathInfo> ResolvePSPathFromProviderPath(string path, CmdletProviderContext context, bool allowNonexistingPaths, bool isProviderDirectPath, bool isProviderQualifiedPath, out CmdletProvider providerInstance)
 {
     Collection<PathInfo> collection = new Collection<PathInfo>();
     providerInstance = null;
     string providerId = null;
     PSDriveInfo drive = null;
     string providerPath = null;
     if (isProviderDirectPath)
     {
         pathResolutionTracer.WriteLine("Path is PROVIDER-DIRECT", new object[0]);
         providerPath = path;
         providerId = this.sessionState.Path.CurrentLocation.Provider.Name;
     }
     else if (isProviderQualifiedPath)
     {
         pathResolutionTracer.WriteLine("Path is PROVIDER-QUALIFIED", new object[0]);
         providerPath = ParseProviderPath(path, out providerId);
     }
     pathResolutionTracer.WriteLine("PROVIDER-INTERNAL path: {0}", new object[] { providerPath });
     pathResolutionTracer.WriteLine("Provider: {0}", new object[] { providerId });
     Collection<string> collection2 = this.ResolveProviderPathFromProviderPath(providerPath, providerId, allowNonexistingPaths, context, out providerInstance);
     drive = providerInstance.ProviderInfo.HiddenDrive;
     foreach (string str3 in collection2)
     {
         string str4 = str3;
         if (context.Stopping)
         {
             throw new PipelineStoppedException();
         }
         string str5 = null;
         if (IsProviderDirectPath(str4))
         {
             str5 = str4;
         }
         else
         {
             str5 = string.Format(CultureInfo.InvariantCulture, "{0}::{1}", new object[] { providerId, str4 });
         }
         collection.Add(new PathInfo(drive, providerInstance.ProviderInfo, str5, this.sessionState));
         pathResolutionTracer.WriteLine("RESOLVED PATH: {0}", new object[] { str5 });
     }
     return collection;
 }
开发者ID:nickchal,项目名称:pash,代码行数:43,代码来源:LocationGlobber.cs


示例20: Context

        public Context( IContext context, object dynamicParameters )
        {
            Context c = context as Context;
            if( null == c )
            {
                throw new ArgumentException( "the context provided is of an incompatible type");
            }

            _provider = c._provider;
            PathProcessor = c.PathProcessor;
            DynamicParameters = dynamicParameters;
        }
开发者ID:beefarino,项目名称:NHibernate-QuickStart,代码行数:12,代码来源:Context.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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