-
-
Notifications
You must be signed in to change notification settings - Fork 979
Expand file tree
/
Copy pathCommandOutputEventArgs.cs
More file actions
44 lines (40 loc) · 1.31 KB
/
CommandOutputEventArgs.cs
File metadata and controls
44 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#nullable enable
using System;
using System.Text;
namespace Renci.SshNet.Common
{
/// <summary>
/// Base class for command output related events.
/// </summary>
public class CommandOutputEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="CommandOutputEventArgs"/> class.
/// </summary>
/// <param name="rawData">The raw data received.</param>
/// <param name="encoding">The encoding used for the transmission.</param>
public CommandOutputEventArgs(ArraySegment<byte> rawData, Encoding encoding)
{
RawData = rawData;
Encoding = encoding;
}
/// <summary>
/// Gets the received data as <see langword="string"/>.
/// </summary>
public string Text
{
get
{
return Encoding.GetString(RawData.Array!, RawData.Offset, RawData.Count);
}
}
/// <summary>
/// Gets the raw data received from the server. This is the data that was used to create the <see cref="Text"/> property.
/// </summary>
public ArraySegment<byte> RawData { get; }
/// <summary>
/// Gets the output encoding used.
/// </summary>
public Encoding Encoding { get; }
}
}