Renci.SshNet.ShellStream.Expect C# (CSharp) Method

Expect() public method

Expects the expression specified by regular expression.
public Expect ( Regex regex ) : string
regex System.Text.RegularExpressions.Regex The regular expression to expect.
return string
        public string Expect(Regex regex)
        {
            return Expect(regex, TimeSpan.Zero);
        }

Same methods

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

Usage Example

コード例 #1
2
		private void WaitForPrompt(ShellStream stream, bool timeOut)
		{
			if (_verbose)
			{
				if (timeOut)
				{
					stream.Expect(TimeSpan.FromSeconds(5), new Renci.SshNet.ExpectAction("#",
						(output) =>
					{
						if (_console != null)
							_console.Log.Write(output);
					}));
				}
				else
				{
					stream.Expect(new Renci.SshNet.ExpectAction("#",
						(output) =>
					{
						if (_console != null)
							_console.Log.Write(output);
					}));
				}
			}
			else
			{
				if (timeOut)
					stream.Expect("#", TimeSpan.FromSeconds(5));
				else
					stream.Expect("#");
			}
		}
All Usage Examples Of Renci.SshNet.ShellStream::Expect