44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
|
using System.Net;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace CLre_server.WebStatus
|
||
|
{
|
||
|
public static class DebugEndpoints
|
||
|
{
|
||
|
[WebEndpoint("/d/ping")]
|
||
|
private static void PingPong(HttpListenerContext ctx)
|
||
|
{
|
||
|
byte[] output = Encoding.UTF8.GetBytes("pong");
|
||
|
ctx.Response.OutputStream.Write(output, 0, output.Length);
|
||
|
}
|
||
|
|
||
|
[WebEndpoint("/d/version")]
|
||
|
internal static void VersionInfo(HttpListenerContext ctx)
|
||
|
{
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.Append("CardLife Version (Unity): \t");
|
||
|
sb.Append(UnityEngine.Application.version);
|
||
|
sb.Append("\n");
|
||
|
sb.Append("CardLife Version (Game): \t");
|
||
|
sb.Append(Game.Utilities.VersionReader.GetVersion());
|
||
|
sb.Append("\n");
|
||
|
sb.Append("Unity Version: \t\t\t");
|
||
|
sb.Append(UnityEngine.Application.unityVersion);
|
||
|
sb.Append("\n");
|
||
|
sb.Append("CLre Version: \t\t\t");
|
||
|
sb.Append(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||
|
sb.Append("\n");
|
||
|
byte[] output = Encoding.UTF8.GetBytes(sb.ToString());
|
||
|
ctx.Response.OutputStream.Write(output, 0, output.Length);
|
||
|
}
|
||
|
#if DEBUG
|
||
|
[WebEndpoint("/d/test")]
|
||
|
internal static void Experiment(HttpListenerContext ctx)
|
||
|
{
|
||
|
string test = "";
|
||
|
byte[] output = Encoding.UTF8.GetBytes(test);
|
||
|
ctx.Response.OutputStream.Write(output, 0, output.Length);
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
}
|