object ReadFile (IProgressMonitor monitor, string file, Type expectedType, out FileFormat format)
{
FileFormat[] formats = formatManager.GetFileFormats (file, expectedType);
if (formats.Length == 0)
throw new InvalidOperationException ("Unknown file format: " + file);
format = formats [0];
object obj = format.Format.ReadFile (file, expectedType, monitor);
if (obj == null)
throw new InvalidOperationException ("Invalid file format: " + file);
return obj;
}