private void Save() { using (var logger = _logger.Block()) { // save the change var filename = GetFilename(); logger.Trace($@"Saving recently used directories to ""{filename}""..."); _xmlFileSerialiser.Serialise(_recentlyUsedDirectories, filename); } }
public void Save(Models.Metadata metadata, string filename) { using (var logger = _logger.Block()) { // validate that all of the properties have a value if (metadata.AppendDateTakenToCaption == null) { throw new InvalidOperationException(@"""AppendDateTakenToCaption"" property value not specified"); } if (metadata.BackgroundColour == null) { throw new InvalidOperationException(@"""BackgroundColour"" property value not specified"); } if (metadata.CaptionAlignment == null) { throw new InvalidOperationException(@"""CaptionAlignment"" property value not specified"); } if (metadata.Colour == null) { throw new InvalidOperationException(@"""Colour"" property value not specified"); } if (metadata.FontBold == null) { throw new InvalidOperationException(@"""FontBold"" property value not specified"); } if (metadata.FontSize == null) { throw new InvalidOperationException(@"""FontSize"" property value not specified"); } if (metadata.ImageFormat == null) { throw new InvalidOperationException(@"""ImageFormat"" property value not specified"); } if (metadata.Rotation == null) { throw new InvalidOperationException(@"""Rotation"" property value not specified"); } logger.Trace($"Saving metadata for \"{filename}\"..."); // get the name of the metadata file var metadataFilename = GetMetadataFilename(filename); logger.Trace($@"Saving metadata to ""{metadataFilename}""..."); _xmlFileSerialiser.Serialise(metadata, metadataFilename); } }