Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 internal PathResolver(SHiPSProvider provider, SHiPSDrive driveInfo)
 {
     _provider = provider;
     _drive    = driveInfo;
 }