Example #1
0
 /// <summary>
 /// If users didnt use the library correctly and had no local error handles
 /// it always crashed here and disconencted the socket.
 /// Catch this errors here now and foreward them.
 /// </summary>
 /// <param name="el"></param>
 internal void DoRaiseOnStreamElement(Element el)
 {
     try
     {
         OnStreamElement?.Invoke(this, this.current);
     }
     catch (Exception ex)
     {
         OnError?.Invoke(this, ex);
     }
 }
        private void EndTag(byte[] buf, int offset, ContentToken ct, Tokens tok)
        {
            // TODO we don't validate Xml right now
            // could check here if end tag name equals the start tag name
            depth--;
            nsStack.Pop();

            if (current == null)
            {
                OnStreamEnd?.Invoke();
                return;
            }

            var parent = current.Parent as XmppXElement;

            if (parent == null)
            {
                OnStreamElement?.Invoke(current);
            }
            current = parent;
        }