コード例 #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);
        }