Пример #1
0
 /// <summary>
 ///  Handles the welcome page.
 ///  Shows some debug info
 /// </summary>
 private string WelcomePage(HttpListenerRequest request, HttpListenerResponse response) =>
 Html.BodyBuilder(Html.h1("Punkte in Wedding Server") +
                  Html.p(Html.b("This is your user Agent") + Html.txt(ServerFrameWork.RecursiveToString(request.UserAgent))) +
                  Html.p(Html.b("This is your URL:") + Html.txt(ServerFrameWork.RecursiveToString(request.Url))) +
                  Html.p(Html.b("This is your QueryInfo:") + Html.txt(ServerFrameWork.RecursiveToString(request.QueryString))) +
                  Html.p(Html.b("Which means:") + Html.txt(ServerFrameWork.ReadQuery(request.QueryString))) +
                  Html.p(Html.b("This is your Endpoint:") + Html.txt(ServerFrameWork.RecursiveToString(request.RemoteEndPoint))) +
                  Html.p(Html.b("Which means your IP is:") + Html.txt($"{request.RemoteEndPoint.Address} and you came from port {request.RemoteEndPoint.Port}"))) +
 Html.br + Html.h2("Now Feck off!") +
 Html.txt("by the way, this info is not stored in any way");
Пример #2
0
 /// <summary>
 /// Manually causes the buffers to update
 /// </summary>
 public void Update()
 {
     lock (this) {
         if (IsBusy)
         {
             return;
         }
         IsBusy = true;
     }
     ServerFrameWork.QUWI($"SwMa<{typeof(T).Name}>::Update", Thread);
 }
 /// <summary>
 /// Shorthand for a few prompt setup tasks
 /// </summary>
 private void PostPreparePrompt()
 {
     printed         = false;
     queryModeActive = true;
     if (InCommand)
     {
         ServerFrameWork.QUWI("Prompt", InteractiveThread);
     }
     if (!printed)
     {
         Console.Write($"\r{GetTypedText()}");
     }
 }
Пример #4
0
        /// <summary>
        /// Handles the wait log creation page.
        /// Ensures that all information is valid, then creates a new waitlog.
        /// </summary>
        private string Wait(HttpListenerRequest request, HttpListenerResponse response)
        {
            var targetID = request.QueryString.Get("target");
            var session  = DB.FindSession(request.QueryString.Get("sid"));

            if (targetID == null || session == null || !int.TryParse(targetID, out var ID) || session.IsExpired())
            {
                response.StatusCode = 401;
            }
            else
            {
                if (!DB.FindUser(ID, out var target))
                {
                    response.StatusCode = 404;
                }
                else
                {
                    ServerFrameWork.QUWI("Wait", () => DB.CreateNewWaitLog(DB.FindUser(session.UserId), target));
                }
            }
            return("");
        }
 /// <summary>
 /// play the notification sound
 /// </summary>
 public static void Notify() => ServerFrameWork.QUWI("Beep", () => Console.Write((byte)7));
 /// <summary>
 /// Play the beep via the console interface
 /// </summary>
 public static void Beep() => ServerFrameWork.QUWI("Beep", () => Console.Beep());