Exemplo n.º 1
0
        public FullHost(bool interactive)
        {
            _interactive = interactive;
            LocalHost = new LocalHost(true);
            _currentRunspace = RunspaceFactory.CreateRunspace(LocalHost);
            _currentRunspace.Open();
            _ctrlStmtKeywordLength = Parser.ControlStatementKeywords.Max(s => s.Length);

            LoadProfiles();
        }
Exemplo n.º 2
0
        public FullHost()
        {
            myHost = new LocalHost();
            myRunSpace = RunspaceFactory.CreateRunspace(myHost);
            myRunSpace.Open();

            string exePath = Assembly.GetCallingAssembly().Location;
            string configPath = Path.Combine(Path.GetDirectoryName(exePath), "config.ps1");

            Execute(configPath);
        }
Exemplo n.º 3
0
        public FullHost(bool interactive)
        {
            _interactive = interactive;
            LocalHost = new LocalHost(true);
            _currentRunspace = RunspaceFactory.CreateRunspace(LocalHost);
            _currentRunspace.Open();

            // TODO: check user directory for a config script and fall back to the default one of the installation
            // need to use .CodeBase property, as .Location gets the wrong path if the assembly was shadow-copied
            var localAssemblyPath = new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath;
            Execute(FormatConfigCommand(localAssemblyPath));
        }
Exemplo n.º 4
0
        public LocalHostUserInterface(LocalHost parent)
        {
            UseUnixLikeInput = Environment.OSVersion.Platform != System.PlatformID.Win32NT && Console.WindowWidth > 0;
            _parentHost = parent;

            // Set up the control-C handler.
            try
            {
                Console.CancelKeyPress += new ConsoleCancelEventHandler(HandleControlC);
                Console.TreatControlCAsInput = false;
            }
            catch (IOException)
            {
                // don't mind. if it doesn't work we're likely in a condition where stdin/stdout was redirected
            }
        }
Exemplo n.º 5
0
        public LocalHostUserInterface(LocalHost parent)
        {
            UseUnixLikeInput = Environment.OSVersion.Platform != System.PlatformID.Win32NT && Console.WindowWidth > 0;
            _parentHost      = parent;

            // Set up the control-C handler.
            try
            {
                Console.CancelKeyPress      += new ConsoleCancelEventHandler(HandleControlC);
                Console.TreatControlCAsInput = false;
            }
            catch (IOException)
            {
                // don't mind. if it doesn't work we're likely in a condition where stdin/stdout was redirected
            }
        }
Exemplo n.º 6
0
 public static Runspace CreateRunspace(InitialSessionState initialSessionState)
 {
     PSHost host = new LocalHost(); // DefaultHost(Thread.CurrentThread.CurrentCulture, Thread.CurrentThread.CurrentUICulture);
     return RunspaceFactory.CreateRunspace(host, initialSessionState);
 }
Exemplo n.º 7
0
 protected LocalHostUserInterface()
 {
     UseUnixLikeInput = false;
     _parentHost      = null;
     InteractiveIO    = false;
 }
Exemplo n.º 8
0
 protected LocalHostUserInterface()
 {
     UseUnixLikeInput = false;
     _parentHost = null;
     InteractiveIO = false;
 }