private HostStartupInfo CreateHostStartupInfo() { _logger.Log(PsesLogLevel.Diagnostic, "Creating startup info object"); ProfilePathInfo profilePaths = null; if (_config.ProfilePaths.AllUsersAllHosts != null || _config.ProfilePaths.AllUsersCurrentHost != null || _config.ProfilePaths.CurrentUserAllHosts != null || _config.ProfilePaths.CurrentUserCurrentHost != null) { profilePaths = new ProfilePathInfo( _config.ProfilePaths.CurrentUserAllHosts, _config.ProfilePaths.CurrentUserCurrentHost, _config.ProfilePaths.AllUsersAllHosts, _config.ProfilePaths.AllUsersCurrentHost); } return(new HostStartupInfo( _config.HostInfo.Name, _config.HostInfo.ProfileId, _config.HostInfo.Version, _config.PSHost, profilePaths, _config.FeatureFlags, _config.AdditionalModules, _config.LogPath, (int)_config.LogLevel, consoleReplEnabled: _config.ConsoleRepl != ConsoleReplKind.None, usesLegacyReadLine: _config.ConsoleRepl == ConsoleReplKind.LegacyReadLine)); }
/// <summary> /// Creates an instance of the HostDetails class. /// </summary> /// <param name="name"> /// The display name for the host, typically in the form of /// "[Application Name] Host". /// </param> /// <param name="profileId"> /// The identifier of the PowerShell host to use for its profile path. /// loaded. Used to resolve a profile path of the form 'X_profile.ps1' /// where 'X' represents the value of hostProfileId. If null, a default /// will be used. /// </param> /// <param name="version">The host application's version.</param> /// <param name="psHost">The PowerShell host to use.</param> /// <param name="allUsersProfilePath">The path to the shared profile.</param> /// <param name="currentUsersProfilePath">The path to the user specific profile.</param> /// <param name="featureFlags">Flags of features to enable.</param> /// <param name="additionalModules">Names or paths of additional modules to import.</param> /// <param name="logPath">The path to log to.</param> /// <param name="logLevel">The minimum log event level.</param> /// <param name="consoleReplEnabled">Enable console if true.</param> /// <param name="usesLegacyReadLine">Use PSReadLine if false, otherwise use the legacy readline implementation.</param> public HostStartupInfo( string name, string profileId, Version version, PSHost psHost, ProfilePathInfo profilePaths, IReadOnlyList <string> featureFlags, IReadOnlyList <string> additionalModules, string logPath, int logLevel, bool consoleReplEnabled, bool usesLegacyReadLine) { Name = name ?? DefaultHostName; ProfileId = profileId ?? DefaultHostProfileId; Version = version ?? s_defaultHostVersion; PSHost = psHost; ProfilePaths = profilePaths; FeatureFlags = featureFlags ?? Array.Empty <string>(); AdditionalModules = additionalModules ?? Array.Empty <string>(); LogPath = logPath; LogLevel = logLevel; ConsoleReplEnabled = consoleReplEnabled; UsesLegacyReadLine = usesLegacyReadLine; }