/// <summary> /// Called by the 'BuildEngine' method to handle /// creation of the engine instance. /// </summary> /// <param name="properties"></param> /// <returns> /// An <see cref="IAspectEngine"/>. /// </returns> protected override DeviceDetectionHashEngine NewEngine( List <string> properties) { if (DataFiles.Count != 1) { throw new PipelineConfigurationException( "This builder requires one and only one configured file " + $"but it has {DataFileConfigs.Count}"); } var dataFile = DataFiles.First(); // We remove the data file configuration from the list. // This is because the on-premise engine builder base class // adds all the data file configs after engine creation. // However, the device detection data files are supplied // directly to the constructor. // Consequently, we remove it here to stop it from being added // again by the base class. DataFiles.Remove(dataFile); // Update the swig configuration object. SwigConfig.setUseUpperPrefixHeaders(false); if (dataFile.Configuration.CreateTempCopy && String.IsNullOrEmpty(TempDir) == false) { using (var tempDirs = new VectorStringSwig()) { tempDirs.Add(TempDir); SwigConfig.setTempDirectories(tempDirs); } SwigConfig.setUseTempFile(true); } // Create swig property configuration object. IRequiredPropertiesConfigSwigWrapper propertyConfig = null; using (var vProperties = new VectorStringSwig(properties)) { propertyConfig = SwigFactory.CreateRequiredProperties(vProperties); } return(new DeviceDetectionHashEngine( _loggerFactory, dataFile, SwigConfig, propertyConfig, CreateAspectData, TempDir, SwigFactory)); }