C# Класс Renci.SshNet.ShellStream

Contains operation for working with SSH Shell.
Наследование: Stream
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BeginExpect ( ) : IAsyncResult

Begins the expect.

BeginExpect ( AsyncCallback callback ) : IAsyncResult

Begins the expect.

BeginExpect ( AsyncCallback callback, object state ) : IAsyncResult

Begins the expect.

BeginExpect ( System.TimeSpan timeout, AsyncCallback callback, object state ) : IAsyncResult

Begins the expect.

EndExpect ( IAsyncResult asyncResult ) : string

Ends the execute.

Expect ( Regex regex ) : string

Expects the expression specified by regular expression.

Expect ( Regex regex, System.TimeSpan timeout ) : string

Expects the expression specified by regular expression.

Expect ( string text ) : string

Expects the expression specified by text.

Expect ( string text, System.TimeSpan timeout ) : string

Expects the expression specified by text.

Expect ( ) : void

Expects the specified expression and performs action when one is found.

Expect ( System.TimeSpan timeout ) : void

Expects the specified expression and performs action when one is found.

Flush ( ) : void

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

Read ( byte buffer, int offset, int count ) : int

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Read ( ) : string

Reads text available in the shell.

ReadLine ( ) : string

Reads the line from the shell. If line is not available it will block the execution and will wait for new line.

ReadLine ( System.TimeSpan timeout ) : string

Reads a line from the shell. If line is not available it will block the execution and will wait for new line.

Seek ( long offset, SeekOrigin origin ) : long

This method is not supported.

SetLength ( long value ) : void

This method is not supported.

Write ( byte buffer, int offset, int count ) : void

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write ( string text ) : void

Writes the specified text to the shell.

If text is null, nothing is written.

WriteLine ( string line ) : void

Writes the line to the shell.

If line is null, only the line terminator is written.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.

Приватные методы

Метод Описание
Channel_Closed ( object sender, ChannelEventArgs e ) : void
Channel_DataReceived ( object sender, ChannelDataEventArgs e ) : void
OnDataReceived ( byte data ) : void
OnRaiseError ( ExceptionEventArgs e ) : void
Session_Disconnected ( object sender, EventArgs e ) : void
Session_ErrorOccured ( object sender, ExceptionEventArgs e ) : void
ShellStream ( ISession session, string terminalName, uint columns, uint rows, uint width, uint height, uint>.IDictionary terminalModeValues ) : System
UnsubscribeFromSessionEvents ( ISession session ) : void

Unsubscribes the current ShellStream from session events.

Does nothing when session is null.

Описание методов

BeginExpect() публичный метод

Begins the expect.
public BeginExpect ( ) : IAsyncResult
Результат IAsyncResult

BeginExpect() публичный метод

Begins the expect.
public BeginExpect ( AsyncCallback callback ) : IAsyncResult
callback AsyncCallback The callback.
Результат IAsyncResult

BeginExpect() публичный метод

Begins the expect.
public BeginExpect ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback The callback.
state object The state.
Результат IAsyncResult

BeginExpect() публичный метод

Begins the expect.
public BeginExpect ( System.TimeSpan timeout, AsyncCallback callback, object state ) : IAsyncResult
timeout System.TimeSpan The timeout.
callback AsyncCallback The callback.
state object The state.
Результат IAsyncResult

Dispose() защищенный метод

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

EndExpect() публичный метод

Ends the execute.
Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.
public EndExpect ( IAsyncResult asyncResult ) : string
asyncResult IAsyncResult The async result.
Результат string

Expect() публичный метод

Expects the expression specified by regular expression.
public Expect ( Regex regex ) : string
regex System.Text.RegularExpressions.Regex The regular expression to expect.
Результат string

Expect() публичный метод

Expects the expression specified by regular expression.
public Expect ( Regex regex, System.TimeSpan timeout ) : string
regex System.Text.RegularExpressions.Regex The regular expression to expect.
timeout System.TimeSpan Time to wait for input.
Результат string

Expect() публичный метод

Expects the expression specified by text.
public Expect ( string text ) : string
text string The text to expect.
Результат string

Expect() публичный метод

Expects the expression specified by text.
public Expect ( string text, System.TimeSpan timeout ) : string
text string The text to expect.
timeout System.TimeSpan Time to wait for input.
Результат string

Expect() публичный метод

Expects the specified expression and performs action when one is found.
public Expect ( ) : void
Результат void

Expect() публичный метод

Expects the specified expression and performs action when one is found.
public Expect ( System.TimeSpan timeout ) : void
timeout System.TimeSpan Time to wait for input.
Результат void

Flush() публичный метод

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
An I/O error occurs.
public Flush ( ) : void
Результат void

Read() публичный метод

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
The sum of and is larger than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support reading. Methods were called after the stream was closed.
public Read ( byte buffer, int offset, int count ) : int
buffer byte An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
offset int The zero-based byte offset in at which to begin storing the data read from the current stream.
count int The maximum number of bytes to be read from the current stream.
Результат int

Read() публичный метод

Reads text available in the shell.
public Read ( ) : string
Результат string

ReadLine() публичный метод

Reads the line from the shell. If line is not available it will block the execution and will wait for new line.
public ReadLine ( ) : string
Результат string

ReadLine() публичный метод

Reads a line from the shell. If line is not available it will block the execution and will wait for new line.
public ReadLine ( System.TimeSpan timeout ) : string
timeout System.TimeSpan Time to wait for input.
Результат string

Seek() публичный метод

This method is not supported.
An I/O error occurs. The stream does not support seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
Результат long

SetLength() публичный метод

This method is not supported.
An I/O error occurs. The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
Результат void

Write() публичный метод

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
The sum of and is greater than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support writing. Methods were called after the stream was closed.
public Write ( byte buffer, int offset, int count ) : void
buffer byte An array of bytes. This method copies bytes from to the current stream.
offset int The zero-based byte offset in at which to begin copying bytes to the current stream.
count int The number of bytes to be written to the current stream.
Результат void

Write() публичный метод

Writes the specified text to the shell.
If text is null, nothing is written.
public Write ( string text ) : void
text string The text to be written to the shell.
Результат void

WriteLine() публичный метод

Writes the line to the shell.
If line is null, only the line terminator is written.
public WriteLine ( string line ) : void
line string The line to be written to the shell.
Результат void