Exemple #1
0
        //==========================================================================================
        // Methods
        //==========================================================================================

        /// <summary>
        /// Executes the command line, piping output to the specified output pane.
        /// </summary>
        /// <param name="outputPane">The output pane to write message to.</param>
        /// <param name="launchPadEvents">Receives event callbacks on the progress of the process.</param>
        /// <returns>Value returned by the process.</returns>
        public int ExecuteCommand(IVsOutputWindowPane outputPane, IVsLaunchPadEvents launchPadEvents)
        {
            Tracer.VerifyNonNullArgument(outputPane, "outputPane");
            Tracer.VerifyNonNullArgument(launchPadEvents, "launchPadEvents");

            // Create the IVsLaunchPad object if it hasn't been created yet.
            if (this.launchPad == null)
            {
                this.launchPad = this.CreateLaunchPad();
            }

            uint processExitCode;
            uint flags           = unchecked ((uint)this.Flags);
            uint taskPadCategory = unchecked ((uint)this.TaskPadCategory);
            uint taskItemBitmap  = unchecked ((uint)this.TaskItemBitmap);
            int  hr = this.launchPad.ExecCommand(null, this.CommandLine, this.WorkingDirectory, flags, outputPane, taskPadCategory, taskItemBitmap, null, launchPadEvents, out processExitCode, null);

            if (NativeMethods.Failed(hr))
            {
                string debugMessage = PackageUtility.SafeStringFormatInvariant("Error in attempting to launch command '{0}': Hr=0x{1:x}", this.CommandLine, hr);
                Package.Instance.Context.NotifyInternalError(ResourceId.IDS_E_BUILD, debugMessage);
                Tracer.Fail(debugMessage);
            }

            return((int)processExitCode);
        }
Exemple #2
0
        //==========================================================================================
        // Methods
        //==========================================================================================
        /// <summary>
        /// Executes the command line, piping output to the specified output pane.
        /// </summary>
        /// <param name="outputPane">The output pane to write message to.</param>
        /// <param name="launchPadEvents">Receives event callbacks on the progress of the process.</param>
        /// <returns>Value returned by the process.</returns>
        public int ExecuteCommand(IVsOutputWindowPane outputPane, IVsLaunchPadEvents launchPadEvents)
        {
            Tracer.VerifyNonNullArgument(outputPane, "outputPane");
            Tracer.VerifyNonNullArgument(launchPadEvents, "launchPadEvents");

            // Create the IVsLaunchPad object if it hasn't been created yet.
            if (this.launchPad == null)
            {
                this.launchPad = this.CreateLaunchPad();
            }

            uint processExitCode;
            uint flags = unchecked((uint)this.Flags);
            uint taskPadCategory = unchecked((uint)this.TaskPadCategory);
            uint taskItemBitmap = unchecked((uint)this.TaskItemBitmap);
            int hr = this.launchPad.ExecCommand(null, this.CommandLine, this.WorkingDirectory, flags, outputPane, taskPadCategory, taskItemBitmap, null, launchPadEvents, out processExitCode, null);
            if (NativeMethods.Failed(hr))
            {
                string debugMessage = PackageUtility.SafeStringFormatInvariant("Error in attempting to launch command '{0}': Hr=0x{1:x}", this.CommandLine, hr);
                Package.Instance.Context.NotifyInternalError(ResourceId.IDS_E_BUILD, debugMessage);
                Tracer.Fail(debugMessage);
            }

            return (int)processExitCode;
        }