Struct PipeFrame
- Namespace
- DiscordRPC.IO
- Assembly
- DiscordRPC.dll
A frame received and sent to the Discord client for RPC communications.
public struct PipeFrame : IEquatable<PipeFrame>
- Implements
- Inherited Members
Constructors
PipeFrame(Opcode, object)
Creates a new pipe frame instance
public PipeFrame(Opcode opcode, object data)
Parameters
opcode
OpcodeThe opcode of the frame
data
objectThe data of the frame that will be serialized as JSON
Fields
MAX_SIZE
The maxium size of a pipe frame (16kb).
public static readonly int MAX_SIZE
Field Value
Properties
Data
The data in the frame
public byte[] Data { readonly get; set; }
Property Value
- byte[]
Length
The length of the frame data
public uint Length { get; }
Property Value
Message
The data represented as a string.
public string Message { get; set; }
Property Value
MessageEncoding
Gets the encoding used for the pipe frames
public Encoding MessageEncoding { get; }
Property Value
Opcode
The opcode of the frame
public Opcode Opcode { readonly get; set; }
Property Value
Methods
Equals(PipeFrame)
Compares if the frame equals the other frame.
public bool Equals(PipeFrame other)
Parameters
other
PipeFrame
Returns
GetObject<T>()
Deserializes the data into the supplied type using JSON.
public T GetObject<T>()
Returns
- T
Type Parameters
T
The type to deserialize into
ReadStream(Stream)
Attempts to read the contents of the frame from the stream
public bool ReadStream(Stream stream)
Parameters
stream
Stream
Returns
SetObject(Opcode, object)
Sets the opcodes and serializes the object into a json string.
public void SetObject(Opcode opcode, object obj)
Parameters
SetObject(object)
Serializes the object into json string then encodes it into Data.
public void SetObject(object obj)
Parameters
obj
object
WriteStream(Stream)
Writes the frame into the target frame as one big byte block.
public void WriteStream(Stream stream)
Parameters
stream
Stream