예제 #1
0
        public MainWindow()
        {
            var  config = new ButtplugConfig("B******g");
            uint ping;

            uint.TryParse(config.GetValue("b******g.server.maxPing", "1000"), out ping);

            InitializeComponent();

            long logLimit = 1000;

            if (long.TryParse(config.GetValue("b******g.log.max", "1000"), out long res))
            {
                logLimit = res;
            }

            ButtplugTab.GetLogControl().MaxLogs = logLimit;

            ButtplugTab.SetServerDetails("Websocket Server", ping);
            _wsTab = new WebsocketServerControl(ButtplugTab);
            ButtplugTab.SetApplicationTab("Websocket Server", _wsTab);

            ButtplugTab.GetAboutControl().CheckUpdate(config, "b******g-csharp");
            Closing += ClosingHandler;
            _wsTab.StartServer();
        }
        public WebsocketServerControl(IButtplugServerFactory bpFactory)
        {
            InitializeComponent();
            _logManager = new ButtplugLogManager();
            _log        = _logManager.GetLogger(GetType());
            _ws         = new ButtplugWebsocketServer();
            _bpFactory  = bpFactory;
            _config     = new ButtplugConfig("B******g");
            _connUrls   = new ConnUrlList();
            _port       = 12345;

            // Usually, if we throw errors then connect, it's not actually an error.
            // If we don't connect after a second of throwing an exception, pop the toaster, but not before then.
            _toastTimer = new Timer
            {
                Interval  = 1000,
                AutoReset = false,
                Enabled   = false,
            };
            _toastTimer.Elapsed += PopToaster;

            if (uint.TryParse(_config.GetValue("b******g.server.port", "12345"), out uint pres))
            {
                _port = pres;
            }

            _secure = true;
            if (bool.TryParse(_config.GetValue("b******g.server.secure", "true"), out bool sres))
            {
                _secure = sres;
            }

            _loopback = true;
            if (bool.TryParse(_config.GetValue("b******g.server.loopbackOnly", "true"), out bool lres))
            {
                _loopback = lres;
            }

            _hostname = _config.GetValue("b******g.server.hostname", "localhost");

            PortTextBox.Text           = _port.ToString();
            SecureCheckBox.IsChecked   = _secure;
            LoopbackCheckBox.IsChecked = _loopback;

            ConnectionUrl.ItemsSource = _connUrls;

            _ws.OnException        += WebSocketExceptionHandler;
            _ws.ConnectionAccepted += WebSocketConnectionAccepted;
            _ws.ConnectionUpdated  += WebSocketConnectionAccepted;
            _ws.ConnectionClosed   += WebSocketConnectionClosed;

            _log.OnLogException += ExceptionLogged;
        }
예제 #3
0
        public MainWindow()
        {
            var  config = new ButtplugConfig("B******g");
            uint ping;

            uint.TryParse(config.GetValue("b******g.server.maxPing", "100"), out ping);

            InitializeComponent();

            ButtplugTab.SetServerDetails("Websocket Server", ping);
            _wsTab = new WebsocketServerControl(ButtplugTab);
            ButtplugTab.SetApplicationTab("Websocket Server", _wsTab);
            Closing += ClosingHandler;
            _wsTab.StartServer();
        }
예제 #4
0
        public WebsocketServerControl(IButtplugServiceFactory bpFactory)
        {
            InitializeComponent();
            _ws        = new ButtplugWebsocketServer();
            _bpFactory = bpFactory;
            _config    = new ButtplugConfig("B******g");
            _port      = 12345;
            _secure    = false;
            if (uint.TryParse(_config.GetValue("b******g.server.port", "12345"), out uint pres))
            {
                _port = pres;
            }

            if (bool.TryParse(_config.GetValue("b******g.server.secure", "false"), out bool sres))
            {
                _secure = sres;
            }

            PortTextBox.Text         = _port.ToString();
            SecureCheckBox.IsChecked = _secure;
        }