public ShellConfiguration() { UISettings = new UISettings(); InitialVariables = new List<PSVariable>(); Cmdlets = new List<CmdletConfigurationEntry>(); UnsupportedConsoleApplicationConfiguration = new UnsupportedConsoleApplicationConfiguration(); }
public StudioShellConfiguration( UISettings uiSettings ) { var profileScripts = new StudioShellProfileInfo(); var newProfile = profileScripts.GetProfilePSObject(); var runspaceConfiguration = RunspaceConfiguration.Create(); var cce = new List<CmdletConfigurationEntry>(); var initialVariables = new List<PSVariable>(); runspaceConfiguration.InitializationScripts.Append( new ScriptConfigurationEntry("start-studioshell", Scripts.StartStudioShell) ); initialVariables.Add(new PSVariable("profile", newProfile)); ShellName = StudioShellInfo.ShellName; ShellVersion = StudioShellInfo.ShellVersion; Cmdlets = cce; InitialVariables = initialVariables; RunspaceConfiguration = runspaceConfiguration; UISettings = uiSettings; var blacklist = new List<string> { "cmd", "cmd.exe", "diskpart", "diskpart.exe", "edit.com", "netsh", "netsh.exe", "nslookup", "nslookup.exe", "powershell", "powershell.exe", "vim", "vim.exe", "wmic", "wmic.exe" }; UnsupportedConsoleApplicationConfiguration = new UnsupportedConsoleApplicationConfiguration( blacklist, UpdateableBlacklistVariable.VariableName, "about_StudioShell_UnsupportedApplications" ); initialVariables.Add(new UpdateableBlacklistVariable( UnsupportedConsoleApplicationConfiguration )); }
public HostUI(IConsole control, UISettings settings, PSHostRawUserInterface rawUi) { _control = control; _settings = settings; _rawUI = rawUi; }
private void ExtractUIColorSettingsFromFontsAndColors(FontsAndColorsItems colors, UISettings settings) { ColorableItems item; item = colors.Item("Error"); if (null == item) { item = colors.Item("Compiler Error"); } settings.ErrorForegroundColor = GetConsoleColor(item.Foreground, settings.ErrorForegroundColor); settings.ErrorBackgroundColor = GetConsoleColor(item.Background, settings.ErrorBackgroundColor); item = colors.Item("Warning"); if (null == item) { item = colors.Item("Compiler Warning"); } settings.WarningForegroundColor = GetConsoleColor(item.Foreground, settings.WarningForegroundColor); settings.WarningBackgroundColor = GetConsoleColor(item.Background, settings.WarningBackgroundColor); item = colors.Item("String"); settings.DebugForegroundColor = GetConsoleColor(item.Foreground, settings.DebugForegroundColor); settings.DebugBackgroundColor = GetConsoleColor(item.Background, settings.DebugBackgroundColor); item = colors.Item("Comment"); settings.VerboseForegroundColor = GetConsoleColor(item.Foreground, settings.VerboseForegroundColor); settings.VerboseBackgroundColor = GetConsoleColor(item.Background, settings.VerboseBackgroundColor); }
private UISettings GetUISettings() { UISettings settings = new UISettings(); var props = _applicationObject.get_Properties("FontsAndColors", "TextEditor"); settings.FontName = props.Item("FontFamily").Value.ToString(); settings.FontSize = Convert.ToInt32(props.Item("FontSize").Value.ToString()); var colors = props.Item("FontsAndColorsItems").Object as FontsAndColorsItems; if (null == colors) { return settings; } var item = colors.Item("Plain Text"); settings.ForegroundColor = GetConsoleColor(item.Foreground, settings.ForegroundColor); settings.BackgroundColor = GetConsoleColor(item.Background, settings.BackgroundColor); return settings; }
public void Apply(UISettings settings) { MethodInvoker mi = () => { Color fg = settings.ForegroundColor.ToColor(); Color bg = settings.BackgroundColor.ToColor(); Font = new Font(settings.FontName, settings.FontSize, FontStyle.Bold); ForeColor = Color.FromArgb(fg.R, fg.G, fg.B); BackColor = Color.FromArgb(bg.R, bg.G, bg.B); _errorColors = new TextColor(settings.ErrorForegroundColor.ToColor(), settings.ErrorBackgroundColor.ToColor()); _warningColors = new TextColor(settings.WarningForegroundColor.ToColor(), settings.WarningBackgroundColor.ToColor()); _debugColors = new TextColor(settings.DebugForegroundColor.ToColor(), settings.DebugBackgroundColor.ToColor()); _verboseColors = new TextColor(settings.VerboseForegroundColor.ToColor(), settings.VerboseBackgroundColor.ToColor()); }; if (InvokeRequired) { Invoke(mi); return; } mi.Invoke(); }
public ShellConfiguration() { UISettings = new UISettings(); InitialVariables = new List<PSVariable>(); Cmdlets = new List<CmdletConfigurationEntry>(); }