private object TransformInternal(EngineIntrinsics engineIntrinsics, string[] boundPaths, bool inputIsPathArray) { object outputData; SessionState session = engineIntrinsics.SessionState; PscxPathInfo[] pscxPaths = PscxPathInfo.GetPscxPathInfos(session, boundPaths, _noGlobbing); // NOTE: this should never happen - verify if (pscxPaths.Length == 0) { Trace.WriteLine("TransformInternal: path count is zero."); return(pscxPaths); } if (_asString) { // String var paths = new List <string>(pscxPaths.Length); Array.ForEach(pscxPaths, pscxPath => paths.Add(pscxPath.ToString())); if (inputIsPathArray || (!_noGlobbing)) { outputData = paths; } else { // only literal can return a scalar outputData = paths[0]; } } else { // PscxPathInfo if (inputIsPathArray || (!_noGlobbing)) { outputData = pscxPaths; } else { // only literal can return a scalar outputData = pscxPaths[0]; } } return(outputData); }
/// <summary> /// /// </summary> /// <param name="paths"></param> /// <param name="literalPaths"></param> /// <returns></returns> protected PscxPathInfo[] GetPscxPathInfos(string[] paths, bool literalPaths) { PscxPathInfo[] pscxPaths = PscxPathInfo.GetPscxPathInfos(this.SessionState, paths, literalPaths); return(pscxPaths); }