Beispiel #1
0
        public override bool Read(LogReadFlags flags)
        {
            using (Session.Logger.CreateCallstack())
            {
                bool result;
                bool retry;

                do
                {
                    result = DoRead();

                    retry = false;

                    if (result &&
                        IsNonEmptyElement("failure"))
                    {
                        SessionRemoteException e = SessionRemoteException.ReadFailure(this);

                        Session.RaiseFailed(e);

                        if ((flags & LogReadFlags.ThrowFailures) == 0)
                        {
                            retry = true;
                        }
                        else
                        {
                            throw e;
                        }
                    }
                }while (retry);

                return(result);
            }
        }
 public void WaitForNonEmptyElement(string localName, LogReadFlags flags)
 {
     if (!TryWaitForNonEmptyElement(localName, flags))
     {
         throw Session.Logger.WriteException(SessionLocalException.CreateElementNotFound(Session, localName));
     }
 }
        public override bool Read(LogReadFlags flags)
        {
            using (Session.Logger.CreateCallstack())
            {
                bool result;
                bool retry;

                do
                {
                    result = DoRead();

                    retry = false;

                    if (result &&
                        IsNonEmptyElement("failure"))
                    {
                        SessionRemoteException e = SessionRemoteException.ReadFailure(this);

                        Session.RaiseFailed(e);

                        if ((flags & LogReadFlags.ThrowFailures) == 0)
                        {
                            retry = true;
                        }
                        else
                        {
                            throw e;
                        }
                    }
                }
                while (retry);

                return result;
            }
        }
        public override bool Read(LogReadFlags flags)
        {
            bool result = base.Read(flags);

            if (_read && !_disposing)
            {
                throw Session.Logger.WriteException(new SessionLocalException(Session, "Session has unexpectedly closed"));
            }

            return(result);
        }
        public override bool Read(LogReadFlags flags)
        {
            bool result = base.Read(flags);

            if (_read && !_disposing)
            {
                throw new SessionLocalException(Session, "Session has unexpectedly closed");
            }

            return result;
        }
Beispiel #6
0
 public void ReadToEnd(LogReadFlags flags)
 {
     using (Session.Logger.CreateCallstack())
     {
         if (!_read)
         {
             while (Read(flags))
             {
             }
         }
     }
 }
        public bool TryWaitForNonEmptyElement(string localName, LogReadFlags flags)
        {
            bool result = false;

            while (!result && Read(flags))
            {
                if (IsNonEmptyElement(localName))
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #8
0
        public override bool Read(LogReadFlags flags)
        {
            if (_read)
            {
                throw new InvalidOperationException("Element already read to the end");
            }

            bool result = _parentReader.Read(flags);

            if (result &&
                IsEndElement(_localName) &&
                (Depth == _depth))
            {
                result = false;
                _read = true;
            }

            return result;
        }
Beispiel #9
0
        public override bool Read(LogReadFlags flags)
        {
            if (_read)
            {
                throw new InvalidOperationException("Element already read to the end");
            }

            bool result = _parentReader.Read(flags);

            if (result &&
                IsEndElement(_localName) &&
                (Depth == _depth))
            {
                result = false;
                _read  = true;
            }

            return(result);
        }
Beispiel #10
0
        public override bool Read(LogReadFlags flags)
        {
            if (_read)
            {
                throw Session.Logger.WriteException(
                          new InvalidOperationException(
                              string.Format(CultureInfo.CurrentCulture, "Element {0} already read to the end", _token)));
            }

            bool result = _parentReader.Read(flags);

            if (result &&
                IsEndElement(_localName) &&
                (Depth == _depth))
            {
                result = false;
                Session.Logger.WriteLineLevel(1, "Element {0} read to the end", _token);
                _read = true;
            }

            return(result);
        }
Beispiel #11
0
 public bool TryWaitForNonEmptyElement(string localName, LogReadFlags flags)
 {
     bool result = false;
     while (!result && Read(flags))
     {
         if (IsNonEmptyElement(localName))
         {
             result = true;
         }
     }
     return result;
 }
Beispiel #12
0
 public void ReadToEnd(LogReadFlags flags)
 {
     using (Session.Logger.CreateCallstack())
     {
         if (!_read)
         {
             while (Read(flags))
             {
             }
         }
     }
 }
        public ElementLogReader WaitForNonEmptyElementAndCreateLogReader(string localName, LogReadFlags flags)
        {
            WaitForNonEmptyElement(localName, flags);

            return(CreateLogReader());
        }
 public abstract bool Read(LogReadFlags flags);
Beispiel #15
0
 public abstract bool Read(LogReadFlags flags);
Beispiel #16
0
 private static void ReadElement(CustomLogReader reader, LogReadFlags flags)
 {
     while (reader.Read(flags))
     {
     }
 }
Beispiel #17
0
        public ElementLogReader WaitForNonEmptyElementAndCreateLogReader(string localName, LogReadFlags flags)
        {
            WaitForNonEmptyElement(localName, flags);

            return CreateLogReader();
        }
Beispiel #18
0
 public void WaitForNonEmptyElement(string localName, LogReadFlags flags)
 {
     if (!TryWaitForNonEmptyElement(localName, flags))
     {
         throw SessionLocalException.CreateElementNotFound(Session, localName);
     }
 }