Unofficial CardLife revival project, pronounced like "celery"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5KB

  1. using System.Net;
  2. using System.Text;
  3. namespace CLre_server.WebStatus
  4. {
  5. public static class DebugEndpoints
  6. {
  7. [WebEndpoint("/d/ping")]
  8. private static void PingPong(HttpListenerContext ctx)
  9. {
  10. byte[] output = Encoding.UTF8.GetBytes("pong");
  11. ctx.Response.OutputStream.Write(output, 0, output.Length);
  12. }
  13. [WebEndpoint("/d/version")]
  14. internal static void VersionInfo(HttpListenerContext ctx)
  15. {
  16. StringBuilder sb = new StringBuilder();
  17. sb.Append("CardLife Version (Unity): \t");
  18. sb.Append(UnityEngine.Application.version);
  19. sb.Append("\n");
  20. sb.Append("CardLife Version (Game): \t");
  21. sb.Append(Game.Utilities.VersionReader.GetVersion());
  22. sb.Append("\n");
  23. sb.Append("Unity Version: \t\t\t");
  24. sb.Append(UnityEngine.Application.unityVersion);
  25. sb.Append("\n");
  26. sb.Append("CLre Version: \t\t\t");
  27. sb.Append(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
  28. sb.Append("\n");
  29. byte[] output = Encoding.UTF8.GetBytes(sb.ToString());
  30. ctx.Response.OutputStream.Write(output, 0, output.Length);
  31. }
  32. #if DEBUG
  33. [WebEndpoint("/d/test")]
  34. internal static void Experiment(HttpListenerContext ctx)
  35. {
  36. string test = "";
  37. byte[] output = Encoding.UTF8.GetBytes(test);
  38. ctx.Response.OutputStream.Write(output, 0, output.Length);
  39. }
  40. #endif
  41. }
  42. }