Esempio n. 1
0
        /// <summary>
        /// Gets a decompressor for the given type.
        /// </summary>
        /// <param name="type">The type to be decompressed.</param>
        /// <exception cref="Exception">Thrown if the required decompressor cannot be found.</exception>
        public static IDecompressor GetRequiredDecompressor(this ICompressorFactory factory, Type type)
        {
            var result = factory.GetDecompressor(type);

            if (null == result)
            {
                DecompressorNotFoundException.Throw(type);
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a decompressor for the given type.
        /// </summary>
        /// <typeparam name="T">The type to be decompressed.</typeparam>
        /// <exception cref="Exception">Thrown if the required decompressor cannot be found.</exception>
        public static IDecompressor <T> GetRequiredDecompressor <T>(this ICompressorFactory factory)
        {
            var result = factory.GetDecompressor <T>();

            if (null == result)
            {
                DecompressorNotFoundException.Throw(typeof(T));
            }
            return(result);
        }