| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System.Text;
- namespace Renci.SshNet.Messages.Connection
- {
- /// <summary>
- /// Represents "exec" type channel request information
- /// </summary>
- internal class ExecRequestInfo : RequestInfo
- {
- /// <summary>
- /// Channel request name
- /// </summary>
- public const string NAME = "exec";
- /// <summary>
- /// Gets the name of the request.
- /// </summary>
- /// <value>
- /// The name of the request.
- /// </value>
- public override string RequestName
- {
- get { return ExecRequestInfo.NAME; }
- }
- /// <summary>
- /// Gets command to execute.
- /// </summary>
- public string Command { get; private set; }
- /// <summary>
- /// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
- /// </summary>
- public ExecRequestInfo()
- {
- this.WantReply = true;
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
- /// </summary>
- /// <param name="command">The command.</param>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
- public ExecRequestInfo(string command)
- : this()
- {
- if (command == null)
- throw new System.ArgumentNullException("command");
- this.Command = command;
- }
- /// <summary>
- /// Called when type specific data need to be loaded.
- /// </summary>
- protected override void LoadData()
- {
- base.LoadData();
- this.Command = this.ReadString();
- }
- /// <summary>
- /// Called when type specific data need to be saved.
- /// </summary>
- protected override void SaveData()
- {
- base.SaveData();
- this.Write(this.Command);
- }
- }
- }
|