public SystemConfiguration(ISettingsReader settingsReader, [ImportMany] IEnumerable <IDocumentProcessorFactory> factories) { string fileName = settingsReader.GetSetting("printerConfigFile", string.Empty); Precondition.Assert( () => !string.IsNullOrEmpty(fileName) && File.Exists(fileName), "Invalid configuration provided - missing configuration file"); using (Stream inputStream = File.OpenRead(fileName)) { parser = new PrinterConfigurationParser(factories); processorPipeline = parser.Parse(inputStream); } string printerDir = parser.Variables.Get("printer-dir"); string printerFileExt = parser.Variables.Get("printer-file-extension"); string printerName = parser.Variables.Get("printer-name"); string driverName = parser.Variables.Get("printer-driver"); string port = Path.Combine(new DirectoryInfo(printerDir).FullName, Guid.NewGuid().ToString()) + printerFileExt; var driverConfiguration = new DriverConfiguration { ConfigFileName = parser.Variables.Get("driver-config-file"), DataFileName = parser.Variables.Get("driver-data-file"), DependentFileNames = parser.Variables.Get("driver-dependent-file").Split(","[0]), DriverFileName = parser.Variables.Get("driver-path"), Environment = parser.Variables.Get("driver-environment"), HelpFileName = parser.Variables.Get("driver-help-file"), Name = parser.Variables.Get("driver-name") }; printerConfiguration = new VirtualPrinterConfiguration { DefaultPort = port, PrinterName = printerName, DriverConfiguration = driverConfiguration }; Logger.Info("Using the following configuration:"); Logger.Info(string.Empty); Logger.InfoFormat(" Print Name: {0}", printerName); Logger.InfoFormat(" Print Driver: {0}", driverName); Logger.InfoFormat(" Print Directory: {0}", printerDir); Logger.InfoFormat(" File Extension: {0}", printerFileExt); Logger.Info(string.Empty); }