예제 #1
0
파일: SHiPSDrive.cs 프로젝트: wgross/SHiPS
 internal SHiPSDrive(PSDriveInfo driveInfo, string rootInfo, SHiPSProvider provider)
     : base(driveInfo)
 {
     _rootInfo      = rootInfo;
     _provider      = provider;
     DriveTrimRegex = new Regex("^*?(" + Regex.Escape(Root) + ")(.*)$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
     InitializeRoot();
 }
예제 #2
0
        internal static object HomePath(this string name, SHiPSProvider provider)
        {
            if (string.IsNullOrWhiteSpace(name) || provider == null)
            {
                return(null);
            }

            //TODO: We should change the following to RuntimeInformation.IsOSPlatform to optimize the operation
            // when we move to .netstandard build (netcoreapp 2.0 and .net 4.7.1)
            var command   = "Get-Variable {0}".StringFormat(name);
            var varObject = provider.SessionState.InvokeCommand.InvokeScript(command, null).FirstOrDefault();

            return((varObject?.BaseObject as PSVariable)?.Value);
        }
예제 #3
0
 internal PathResolver(SHiPSProvider provider, SHiPSDrive driveInfo)
 {
     _provider = provider;
     _drive    = driveInfo;
 }