/// <summary> /// Initializes a new instance of the <see cref="ImageHost"/> class. /// </summary> /// <param name="baseDirectory">The base directory path where images are stored. Multiple image host instances (either in the same process or in /// different processes) can safely share the same directory but it should not be used by anything other than image hosts.</param> /// <param name="options">Options for configuring the image host.</param> public ImageHost(IAbsoluteDirectoryPath baseDirectory, ImageHostOptions options) { if (_jpegEncoder == null) { throw new InvalidOperationException("JPEG encoder was not found."); } BaseDirectory = baseDirectory; DeleteFailureMode = options.DeleteFailureMode; BaseDirectory.Create(); if (options.DeleteFailureMode == DeleteFailureMode.WriteCleanupRecord) { CleanupDirectory = baseDirectory.CombineDirectory(".cleanup", PathOptions.None); CleanupDirectory.Create(); } }