// ReSharper restore EmptyGeneralCatchClause public static bool TrySave([NotNull] Map mapToSave, [NotNull] string fileName, MapFormat format) { if (mapToSave == null) { throw new ArgumentNullException("mapToSave"); } if (fileName == null) { throw new ArgumentNullException("fileName"); } if (format == MapFormat.Unknown) { throw new ArgumentException("Format may not be \"Unknown\"", "format"); } if (AvailableConverters.ContainsKey(format)) { IMapConverter converter = AvailableConverters[format]; try { return(converter.Save(mapToSave, fileName)); } catch (Exception ex) { Logger.LogAndReportCrash("Map failed to save", "MapConversion", ex, false); return(false); } } throw new MapFormatException("Unknown map format for saving."); }