private object ReadFile(IProgressMonitor monitor, string file, Type expectedType, IFileFormat format) { object obj = format.ReadFile(file, expectedType, monitor); if (obj == null) { throw new InvalidOperationException("Invalid file format: " + file); } return(obj); }