コード例 #1
0
        public override void StreamParserOnStreamElement(object sender, Node e)
        {
            base.StreamParserOnStreamElement(sender, e);

            if (e is Handshake)
            {
                this.m_Authenticated = true;

                OnLogin?.Invoke(this);

                if (this.KeepAlive)
                {
                    this.CreateKeepAliveTimer();
                }
            }
            else if (e is Route)
            {
                OnRoute?.Invoke(this, e as Route);
            }
            else if (e is Protocol.XmppStreamError)
            {
                var streamErr = e as Protocol.XmppStreamError;
                switch (streamErr.Condition)
                {
                // Auth errors are important for the users here, so throw catch auth errors
                // in a separate event here
                case Protocol.XmppStreamErrorCondition.NotAuthorized:
                    // Authentication Error
                    OnAuthError?.Invoke(this, e as Element);
                    break;

                default:
                    OnStreamError?.Invoke(this, e as Element);
                    break;
                }
            }
            else if (e is Message)
            {
                OnMessage?.Invoke(this, e as Message);
            }
            else if (e is Presence)
            {
                OnPresence?.Invoke(this, e as Presence);
            }
            else if (e is IQ)
            {
                OnIq?.Invoke(this, e as IQ);
            }
        }
コード例 #2
0
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            var RouteResults = Router.Route(e.FullPath);

            OnRoute?.Invoke(this, RouteResults);
        }