<commit_before>﻿using Bend.Util;
using PewPew.Server;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;

namespace PewPew.Game
{
    public class KinectHttpServer : HttpServer
    {
        public const int SERVER_PORT = 8080;

        public Player player;

        public KinectHttpServer(int port)
            : base(port)
        {
        }

        public override void handleGETRequest(HttpProcessor p)
        {
            Console.WriteLine("request: {0}", p.http_url);
            p.writeSuccess();

            string callback = String.Empty;
            this.setData(ParseParameters(p.http_url, out callback));

            try
            {
                p.outputStream.WriteLine(callback + "(\"OK\")");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: {0}", ex.Message);
            }
        }

        private void setData(DataFromClient data)
        {
            if (data != null)
            {
                this.player.UpdateWeapon(data.weapons);
                this.player._contollerDirection.xy = data.xy;
                this.player._contollerDirection.xz = data.xz;
                this.player._contollerDirection.yz = data.yz;
            }
            else
            {
                this.player.UpdateWeapon(String.Empty);
            }
        }

        public override void listen()
        {
            base.listener = new TcpListener(IPAddress.Any, port); // moualem changed
            listener.Start();
            while (is_active)
            {<commit_msg>making sure player.ControllerDirection is not null<commit_after>﻿using Bend.Util;
using PewPew.Server;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;

namespace PewPew.Game
{
    public class KinectHttpServer : HttpServer
    {
        public const int SERVER_PORT = 8080;

        public Player player;

        public KinectHttpServer(int port)
            : base(port)
        {
        }

        public override void handleGETRequest(HttpProcessor p)
        {
            Console.WriteLine("request: {0}", p.http_url);
            p.writeSuccess();

            string callback = String.Empty;
            this.setData(ParseParameters(p.http_url, out callback));

            try
            {
                p.outputStream.WriteLine(callback + "(\"OK\")");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: {0}", ex.Message);
            }
        }

        private void setData(DataFromClient data)
        {
            if (data != null)
            {
                this.player.UpdateWeapon(data.weapons);

                if (this.player._contollerDirection == null)
                {
                    this.player._contollerDirection = new ControllerDirection();
                }

                this.player._contollerDirection.xy = data.xy;
                this.player._contollerDirection.xz = data.xz;
                this.player._contollerDirection.yz = data.yz;
            }
            else
            {
                this.player.UpdateWeapon(String.Empty);
            }
        }

        public override void listen()
        {
            base.listener = new TcpListener(IPAddress.Any, port); // moualem changed
            listener.Start();
            while (is_active)
            {
{'fraction_non_alphanumeric': 0.09442176870748299, 'fraction_numerical': 0.0032653061224489797, 'mean_word_length': 1.616370106761566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6591789', 'n_tokens_mistral': 1007, 'n_tokens_neox': 962, 'n_words': 201}