<commit_before>﻿#region using directives

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PoGo.PokeMobBot.Logic.Common;
using PoGo.PokeMobBot.Logic.Event;
using PoGo.PokeMobBot.Logic.Logging;
using PoGo.PokeMobBot.Logic.State;
using PoGo.PokeMobBot.Logic.Tasks;
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Config;
using SuperSocket.WebSocket;
using System;

#endregion

namespace PoGo.PokeMobBot.CLI
{
    public class WebSocketInterface
    {
        private readonly WebSocketServer _server;
        private readonly Session _session;
        private PokeStopListEvent _lastPokeStopList;
        private ProfileEvent _lastProfile;

        public WebSocketInterface(int port, Session session, string certificate)
        {
            _session = session;
            var translations = session.Translation;
            _server = new WebSocketServer();
            var config = new ServerConfig
            {
                Name = "MobBotWebSocket",
                Ip = "Any",
                Port = port,
                Mode = SocketMode.Tcp,
            };

            if(certificate != null)
            {
                config.Security = "tls";
                config.Certificate = new CertificateConfig
                {
                    FilePath = certificate,
                    Password = "<PASSWORD>"
                };
            }

            var setupComplete = _server.Setup(config);

            if (setupComplete == false)<commit_msg>Changed certificate password to mobbot<commit_after>﻿#region using directives

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PoGo.PokeMobBot.Logic.Common;
using PoGo.PokeMobBot.Logic.Event;
using PoGo.PokeMobBot.Logic.Logging;
using PoGo.PokeMobBot.Logic.State;
using PoGo.PokeMobBot.Logic.Tasks;
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Config;
using SuperSocket.WebSocket;
using System;

#endregion

namespace PoGo.PokeMobBot.CLI
{
    public class WebSocketInterface
    {
        private readonly WebSocketServer _server;
        private readonly Session _session;
        private PokeStopListEvent _lastPokeStopList;
        private ProfileEvent _lastProfile;

        public WebSocketInterface(int port, Session session, string certificate)
        {
            _session = session;
            var translations = session.Translation;
            _server = new WebSocketServer();
            var config = new ServerConfig
            {
                Name = "MobBotWebSocket",
                Ip = "Any",
                Port = port,
                Mode = SocketMode.Tcp,
            };

            if(certificate != null)
            {
                config.Security = "tls";
                config.Certificate = new CertificateConfig
                {
                    FilePath = certificate,
                    Password = "<PASSWORD>"
                };
            }

            var setupComplete = _server.Setup(config);

            if (setupComplete == false)
{'fraction_non_alphanumeric': 0.07345575959933222, 'fraction_numerical': 0.0, 'mean_word_length': 1.9575518262586378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6189306', 'n_tokens_mistral': 810, 'n_tokens_neox': 772, 'n_words': 181}