public static int GetInt32([NotNull] this Directory directory, int tagType)
        {
            if (directory.TryGetInt32(tagType, out int value))
            {
                return(value);
            }

            return(ThrowValueNotPossible <int>(directory, tagType));
        }
예제 #2
0
        /// <summary>Returns a tag's value as an <see cref="int"/>, or throws if conversion is not possible.</summary>
        /// <remarks>
        /// If the value is <see cref="IConvertible"/>, then that interface is used for conversion of the value.
        /// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
        /// </remarks>
        /// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
        public static long GetInt64(this Directory directory, int tagType)
        {
            int value;

            if (directory.TryGetInt32(tagType, out value))
            {
                return(value);
            }

            return(ThrowValueNotPossible <long>(directory, tagType));
        }
예제 #3
0
 private static int?ParseInt(Directory directory, int tag)
 {
     return(directory.TryGetInt32(tag, out var intValue) ? intValue : (int?)null);
 }