CLre/CLre_server/WebStatus/ConfigurationEndpoints.cs

21 lines
709 B
C#
Raw Normal View History

using System.Net;
using System.Text;
namespace CLre_server.WebStatus
{
public class ConfigurationEndpoints
{
[WebEndpoint("/c/game.json")]
public static void GameServerSettings (HttpListenerContext ctx)
{
ctx.Response.Headers.Add("Content-Type", "application/json");
GameServer.GameServerSettings gss = API.MainServer.Server.Instance.GameServerSettings;
string json = UnityEngine.JsonUtility.ToJson(gss);
#if DEBUG
API.Utility.Logging.MetaLog("JSONified settings: " + json);
#endif
byte[] output = Encoding.UTF8.GetBytes(json);
ctx.Response.OutputStream.Write(output, 0, output.Length);
}
}
}