Esempio n. 1
0
 private static TextReader ReadAsReader(PSObject sourceObject, out InputFileInfo sourceInfo)
 {
     sourceInfo = null;
     if (sourceObject.BaseObject is string)
     {
         return(new StringReader(sourceObject.BaseObject.ToString()));
     }
     else if (sourceObject.BaseObject is InputFileInfo inputFileInfo)
     {
         sourceInfo = inputFileInfo;
         return(new StreamReader(inputFileInfo.FullName));
     }
     else if (sourceObject.BaseObject is FileInfo fileInfo)
     {
         sourceInfo = new InputFileInfo(PSDocumentOption.GetRootedBasePath(""), fileInfo.FullName);
         return(new StreamReader(fileInfo.FullName));
     }
     else
     {
         var uri = sourceObject.BaseObject as Uri;
         sourceInfo = new InputFileInfo(null, uri.ToString());
         using (var webClient = new WebClient())
         {
             return(new StringReader(webClient.DownloadString(uri)));
         }
     }
 }
Esempio n. 2
0
 internal PathBuilder(ILogger logger, string basePath, string searchPattern)
 {
     Logger                = logger;
     _Source               = new List <FileInfo>();
     _BasePath             = PSDocumentOption.GetRootedBasePath(basePath);
     _DefaultSearchPattern = searchPattern;
 }
Esempio n. 3
0
 protected PathBuilder(IPipelineWriter logger, string basePath, string searchPattern, PathFilter filter)
 {
     _Logger               = logger;
     _Files                = new List <InputFileInfo>();
     _Paths                = new HashSet <string>();
     _BasePath             = NormalizePath(PSDocumentOption.GetRootedBasePath(basePath));
     _DefaultSearchPattern = searchPattern;
     _GlobalFilter         = filter;
 }
Esempio n. 4
0
 internal TemplatePipeline(PipelineContext context, PipelineWriter writer, string basePath)
     : base(context, writer)
 {
     _BasePath    = PSDocumentOption.GetRootedBasePath(basePath);
     _PathBuilder = new PathBuilder(writer, basePath, DEFAULT_TEMPLATESEARCH_PATTERN);
 }