コード例 #1
0
 private ContainerCmdletProvider GetContainerProviderByPath(string path, string name, out Path normalizedPath)
 {
     PSDriveInfo drive;
     var provider = _cmdlet.State.SessionStateGlobal.GetProviderByPath(path, out drive) as ContainerCmdletProvider;
     if (provider == null)
     {
         throw new PSInvalidOperationException(String.Format("The provider for path '{0}' is not a ContainerProvider", path));
     }
     normalizedPath = new Path(path);
     if (!String.IsNullOrEmpty(name))
     {
         normalizedPath = normalizedPath.Combine(name);
     }
     normalizedPath = normalizedPath.NormalizeSlashes();
     return provider;
 }