/// <summary> /// Verifies each gallery has a set of gallery settings and MIME type records, creating them if necessary. /// This function does not create a gallery. /// </summary> private static void ValidateGallerySettingsAndMimeTypes() { foreach (IGallery gallery in Factory.LoadGalleries()) { // Loading the gallery settings will automatically create the settings if they do not exist. Factory.LoadGallerySetting(gallery.GalleryId); // Loading the MIME type for an empty string will automatically create the MIME types if they do not exist. MimeType.LoadMimeType(gallery.GalleryId, String.Empty); } }
/// <summary> /// Verifies the item contains valid data. /// </summary> /// <exception cref="UnsupportedMediaObjectTypeException">Thrown when the instance references /// a file type not recognized by the application.</exception> public void Validate() { if ((ShouldValidate(SourceFileExtension)) && MimeType.LoadMimeType(SourceFileExtension) == null) { throw new UnsupportedMediaObjectTypeException(string.Format("The media encoder setting references a file extension ({0}) not recognized by the application.", SourceFileExtension)); } if ((ShouldValidate(DestinationFileExtension)) && MimeType.LoadMimeType(DestinationFileExtension) == null) { throw new UnsupportedMediaObjectTypeException(string.Format("The media encoder setting references a file extension ({0}) not recognized by the application.", DestinationFileExtension)); } }