* Engine namespace changes.
* Automated remove redundant using statements.
* Simplified Graphics namespace.
* Apparently the container system stores full type names in the map file.😞 This updates those names.
* API Changes to LocalizationManager.LoadCulture.
* Update submodule to v0.3.2
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Content.Server.Interfaces;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems.DeviceNetwork
|
|
{
|
|
/// <summary>
|
|
/// A collection of utilities to help with using device networks
|
|
/// </summary>
|
|
public static class NetworkUtils
|
|
{
|
|
public const int PRIVATE = 0;
|
|
public const int WIRED = 1;
|
|
public const int WIRELESS = 2;
|
|
|
|
public const string COMMAND = "command";
|
|
public const string MESSAGE = "message";
|
|
public const string PING = "ping";
|
|
|
|
/// <summary>
|
|
/// Handles responding to pings.
|
|
/// </summary>
|
|
public static void PingResponse<T>(T connection, string sender, IReadOnlyDictionary<string, string> payload, string message = "") where T : IDeviceNetworkConnection
|
|
{
|
|
if (payload.TryGetValue(COMMAND, out var command) && command == PING)
|
|
{
|
|
var response = new Dictionary<string, string>
|
|
{
|
|
{COMMAND, "ping_response"},
|
|
{MESSAGE, message}
|
|
};
|
|
|
|
connection.Send(connection.Frequency, sender, response);
|
|
}
|
|
}
|
|
}
|
|
}
|