Exemplo n.º 1
0
        /// <summary>
        /// Validates that the file is from certain type
        /// </summary>
        /// <typeparam name="T">Type that implements FileType</typeparam>
        /// <param name="fileContent">File as stream</param>
        /// <returns>True if file match the desired type otherwise returns false.</returns>
        public static bool Is <T>(this Stream fileContent) where T : FileType, IFileType, new()
        {
            var instance = new T();
            var match    = FileTypeValidator.GetBestMatch(fileContent);

            return(match?.GetType() == instance.GetType());
        }