Show / Hide Table of Contents

Class Utils

Inheritance
object
Utils
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: EasySave_Project.Server
Assembly: .dll
Syntax
public static class Utils

Methods

| Edit this page View Source

SendToServer(string, NetworkStream)

Sends a message to the server via the provided or default network stream. Ensures the stream is writable before attempting to send data.

Declaration
public static void SendToServer(string message, NetworkStream stream = null)
Parameters
Type Name Description
string message

The message to send to the server.

NetworkStream stream

An optional network stream; if null, the global client stream is used.

| Edit this page View Source

StartListening(NetworkStream)

Starts listening for incoming messages from the server through the provided network stream. Processes received messages, handles specific commands, and enqueues unknown messages.

Declaration
public static Task StartListening(NetworkStream stream)
Parameters
Type Name Description
NetworkStream stream

The network stream used for reading incoming messages.

Returns
Type Description
Task

A Task representing the asynchronous operation.

| Edit this page View Source

WaitForResponse<T>()

Waits for and retrieves a response message from the server, deserializing it into the specified type. Handles JSON parsing errors gracefully.

Declaration
public static Task<T?> WaitForResponse<T>()
Returns
Type Description
Task<T>

The deserialized response object, or default if parsing fails.

Type Parameters
Name Description
T

The expected type of the response object.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX