Example #1
0
        void CreatePowerShellHost()
        {
            var clearConsoleHostCommand = new ClearPackageManagementConsoleHostCommand(this);

            powerShellHost =
                powerShellHostFactory.CreatePowerShellHost(
                    this.ScriptingConsole,
                    GetNuGetVersion(),
                    clearConsoleHostCommand,
                    new DTE());
        }
Example #2
0
        void CreatePowerShellHost()
        {
            var clearConsoleHostCommand = new ClearPackageManagementConsoleHostCommand(this);

            powerShellHost =
                powerShellHostFactory.CreatePowerShellHost(
                    this.ScriptingConsole,
                    GetNuGetVersion(),
                    clearConsoleHostCommand,
                    new ICSharpCode.PackageManagement.EnvDTE.DTE());

            powerShellHost.Exited += PowerShellHostExited;
        }
        public PowerShellSession(IPowerShellHost powerShellHost, IFilesystemAccessor filesystemAccessor)
        {
            this.powerShellHost = powerShellHost;
            this.filesystemAccessor = filesystemAccessor;
            this.pipelineOutput = new StringBuilder();

            Environment.SetEnvironmentVariable("PSExecutionPolicyPreference", "RemoteSigned", EnvironmentVariableTarget.Process);
            this.runspace = RunspaceFactory.CreateRunspace(this.powerShellHost as PSHost);
            this.runspace.Open();

            this.powerShell = System.Management.Automation.PowerShell.Create();
            this.powerShell.Runspace = this.runspace;
        }
        public PowerShellSessionFactory(IPowerShellHost powerShellHost, IFilesystemAccessor filesystemAccessor)
        {
            if (powerShellHost == null)
            {
                throw new ArgumentNullException("powerShellHost");
            }

            if (filesystemAccessor == null)
            {
                throw new ArgumentNullException("filesystemAccessor");
            }

            this.powerShellHost = powerShellHost;
            this.filesystemAccessor = filesystemAccessor;
        }
		void CreatePowerShellHost()
		{
			var clearConsoleHostCommand = new ClearPackageManagementConsoleHostCommand(this);
			powerShellHost = 
				powerShellHostFactory.CreatePowerShellHost(
					this.ScriptingConsole,
					GetNuGetVersion(),
					clearConsoleHostCommand,
					new DTE());
		}
        public void Setup()
        {
            var applicationInformation = ApplicationInformationProvider.GetApplicationInformation();

            var encodingProvider = new DefaultFileEncodingProvider();
            this.fileSystemAccessor = new PhysicalFilesystemAccessor(encodingProvider);

            this.userInterface = new Mock<IUserInterface>().Object;
            this.powerShellUserInterface = new NuDeployPowerShellUserInterface(this.userInterface);
            this.powerShellHost = new PowerShellHost(this.powerShellUserInterface, applicationInformation);

            this.powerShellSession = new PowerShellSession(this.powerShellHost, this.fileSystemAccessor);
        }