Exemple #1
0
        /// <summary>
        /// Use a 51Degrees on-premise device detection engine to
        /// perform device detection.
        /// </summary>
        /// <param name="dataStream">
        /// The device detection data file as a <see cref="Stream"/>.
        /// </param>
        /// <param name="algorithm">
        /// The detection algorithm that the supplied data supports.
        /// </param>
        /// <param name="key">
        /// The license key to use when checking for updates to the
        /// data file.
        /// A license key can be obtained from the
        /// [51Degrees website](https://51degrees.com/pricing).
        /// If you have no license key then this parameter can be
        /// set to null, but doing so will disable automatic updates.
        /// </param>
        /// <returns>
        /// A builder that can be used to configure and build a pipeline
        /// that will use the on-premise detection engine.
        /// </returns>
        /// <seealso cref="UseOnPremise(string, string, bool)"/>
        public DeviceDetectionOnPremisePipelineBuilder UseOnPremise(
            Stream dataStream, DeviceDetectionAlgorithm algorithm, string key)
        {
            var builder = new DeviceDetectionOnPremisePipelineBuilder(
                _loggerFactory, _dataUpdateService, _httpClient);

            builder.SetEngineData(dataStream, algorithm, key);
            return(builder);
        }
Exemple #2
0
        /// <summary>
        /// Use a 51Degrees on-premise device detection engine to
        /// perform device detection.
        /// </summary>
        /// <param name="datafile">
        /// The full path to the device detection data file.
        /// </param>
        /// <param name="key">
        /// The license key to use when checking for updates to the
        /// data file.
        /// A license key can be obtained from the
        /// [51Degrees website](https://51degrees.com/pricing).
        /// If you have no license key then this parameter can be
        /// set to null, but doing so will disable automatic updates.
        /// </param>
        /// <param name="createTempDataCopy">
        /// If true, the engine will create a temporary copy of the data
        /// file rather than using the data file directly.
        /// This is required in order for automatic updates to work
        /// correctly.
        /// </param>
        /// <returns>
        /// A builder that can be used to configure and build a pipeline
        /// that will use the on-premise detection engine.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// Thrown if a required parameter is null
        /// </exception>
        /// <seealso cref="UseOnPremise(Stream, DeviceDetectionAlgorithm, string)"/>
        public DeviceDetectionOnPremisePipelineBuilder UseOnPremise(
            string datafile, string key, bool createTempDataCopy = true)
        {
            if (datafile == null)
            {
                throw new ArgumentNullException(nameof(datafile));
            }

            var builder = new DeviceDetectionOnPremisePipelineBuilder(
                _loggerFactory, _dataUpdateService, _httpClient);

            builder.SetFilename(datafile, key, createTempDataCopy);
            return(builder);
        }