示例#1
0
        static WebAPI()
        {
            CSOptions = new WebAPIOptions();

            Clients = new List <WebAPIClient>();

            Handlers = new Dictionary <string, WebAPIHandler>();

            _ActivityTimer = PollTimer.FromSeconds(
                60.0,
                () =>
            {
                if (!_Listening || Listener == null || Listener.Server == null || !Listener.Server.IsBound)
                {
                    _Listening = false;
                    ListenerUtility.ListenAsync();
                }

                Clients.RemoveAll(c => !c.Connected);
            },
                () => Clients.Count > 0,
                false);

            ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xFF0;             // Ssl3, Tls, Tls11, Tls12
        }
示例#2
0
        private static void CSConfig()
        {
            if (_ServerStarted)
            {
                ListenerUtility.ListenAsync();
                return;
            }

            EventSink.ServerStarted += () =>
            {
                _ServerStarted = true;

                ListenerUtility.ListenAsync();
            };

            var t = typeof(StatusPage);
            var f = t.GetField("Enabled", BindingFlags.Public | BindingFlags.Static);

            if (f != null)
            {
                f.SetValue(null, false);
            }
        }