BeginProcessing()
 {
     try
     {
         string outFilename = Host.UI.StopTranscribing();
         if (outFilename != null)
         {
             PSObject outputObject = new PSObject(
                 StringUtil.Format(TranscriptStrings.TranscriptionStopped, outFilename));
             outputObject.Properties.Add(new PSNoteProperty("Path", outFilename));
             WriteObject(outputObject);
         }
     }
     catch (Exception e)
     {
         ConsoleHost.CheckForSevereException(e);
         throw PSTraceSource.NewInvalidOperationException(
                   e, TranscriptStrings.ErrorStoppingTranscript, e.Message);
     }
 }
示例#2
0
        protected override void BeginProcessing()
        {
            InternalHost host = base.Host as InternalHost;

            if (host != null)
            {
                ConsoleHost externalHost = host.ExternalHost as ConsoleHost;
                if (externalHost != null)
                {
                    if (!externalHost.IsTranscribing)
                    {
                        base.WriteObject(TranscriptStrings.TranscriptionNotInProgress);
                    }
                    try
                    {
                        string str = externalHost.StopTranscribing();
                        base.WriteObject(StringUtil.Format(TranscriptStrings.TranscriptionStopped, str));
                    }
                    catch (Exception exception1)
                    {
                        Exception exception = exception1;
                        ConsoleHost.CheckForSevereException(exception);
                        object[] message = new object[1];
                        message[0] = exception.Message;
                        throw PSTraceSource.NewInvalidOperationException(exception, "TranscriptStrings", "ErrorStoppingTranscript", message);
                    }
                    return;
                }
                else
                {
                    throw PSTraceSource.NewNotSupportedException("TranscriptStrings", "HostDoesNotSupportTranscript", new object[0]);
                }
            }
            else
            {
                throw PSTraceSource.NewNotSupportedException("TranscriptStrings", "HostDoesNotSupportTranscript", new object[0]);
            }
        }