예제 #1
0
 private void ThrowOnError(TokenObject t)
 {
     if (t is TokenError)
     {
         throw new ApplicationException(t.ToString());
     }
 }
예제 #2
0
 private void ThrowOnEmptyOrError(TokenObject t)
 {
     if (t is TokenError)
     {
         throw new ApplicationException(t.ToString());
     }
     else if (t is TokenEmpty)
     {
         throw new ApplicationException("Unexpected end of PDF document.");
     }
 }
예제 #3
0
        private T ThrowIfNot <T>(TokenObject t) where T : TokenObject
        {
            if (t is TokenError)
            {
                throw new ApplicationException(t.ToString());
            }
            else if (t is TokenEmpty)
            {
                throw new ApplicationException("Unexpected end of PDF document.");
            }
            else if (!(t is T))
            {
                throw new ApplicationException($"Found {t.GetType().Name} instead of {typeof(T).Name}.");
            }

            return((T)t);
        }