예제 #1
0
 /// <summary>
 /// Generates a barcode image file with the specified message and <see cref="BarcodeGenerationConfiguration"/>.
 /// </summary>
 /// <param name="message">The message to be encoded in the barcode.</param>
 /// <param name="type">Type of the barcode to be generated.</param>
 /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains
 ///     information about the file to be generated.</param>
 /// <param name="config">The configuration of the barcode generator. This value can be null.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="message"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="imageConfig"/> is null.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="message"/> is too long.<br/>
 ///     -or-<br/>
 ///     <paramref name="type"/> is <see cref="BarcodeType.QR"/>.<br/>
 ///     -or-<br/>
 ///     <paramref name="type"/> is invalid.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> contains illegal characters.
 /// </exception>
 /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <exception cref="ObjectDisposedException"><paramref name="config"/> already has been disposed of.</exception>
 /// <since_tizen> 4 </since_tizen>
 public static void GenerateImage(string message,
                                  BarcodeType type, BarcodeImageConfiguration imageConfig, BarcodeGenerationConfiguration config)
 {
     if (type == BarcodeType.QR)
     {
         throw new ArgumentException($"Invalid barcode type : {type}.");
     }
     GenerateImage(config, message, type, imageConfig, NoneQrMode, NoneErrorCorrection, 0);
 }
예제 #2
0
        /// <summary>
        /// Generates a QR image file with the specified message and <see cref="BarcodeGenerationConfiguration"/>.
        /// </summary>
        /// <remarks>
        ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> must be <see cref="Visibility.Invisible"/>,
        ///     because the text visibility is not supported in the QR code.
        /// </remarks>
        /// <param name="message">The message to be encoded in the barcode.</param>
        /// <param name="qrConfig">The <see cref="QrConfiguration"/> instance.</param>
        /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains
        ///     information about the file to be generated.</param>
        /// <param name="config">The configuration of the barcode generator. This value can be null.</param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="message"/> is null.<br/>
        ///     -or-<br/>
        ///     <paramref name="qrConfig"/> is null.<br/>
        ///     -or-<br/>
        ///     <paramref name="imageConfig"/> is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     <paramref name="message"/> is too long.<br/>
        ///     -or-<br/>
        ///     <paramref name="message"/> contains characters which are illegal by the <see cref="QrMode"/>.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
        /// <exception cref="NotSupportedException">
        ///     The feature is not supported.<br/>
        ///     -or-<br/>
        ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> is the <see cref="Visibility.Visible"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException"><paramref name="config"/> already has been disposed of.</exception>
        /// <since_tizen> 4 </since_tizen>
        public static void GenerateImage(string message, QrConfiguration qrConfig,
                                         BarcodeImageConfiguration imageConfig, BarcodeGenerationConfiguration config)
        {
            if (qrConfig == null)
            {
                throw new ArgumentNullException(nameof(qrConfig));
            }

            if (config != null)
            {
                if (config.TextVisibility == Visibility.Visible)
                {
                    throw new NotSupportedException("Text can't be visible in QR.");
                }
            }

            GenerateImage(config, message, BarcodeType.QR, imageConfig, (int)qrConfig.Mode,
                          (int)qrConfig.ErrorCorrectionLevel, qrConfig.Version);
        }
예제 #3
0
        private static void GenerateImage(BarcodeGenerationConfiguration config,
                                          string message, BarcodeType type, BarcodeImageConfiguration imageConfig,
                                          int qrMode, int qrEcc, int qrVersion)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (imageConfig == null)
            {
                throw new ArgumentNullException(nameof(imageConfig));
            }

            ValidationUtil.ValidateEnum(typeof(BarcodeType), type);

            InteropBarcode.GenerateImage(EngineConfiguration.GetHandle(config), message,
                                         imageConfig.Width, imageConfig.Height, type, qrMode, qrEcc, qrVersion,
                                         imageConfig.Path, imageConfig.Format).
            Validate("Failed to generate image");
        }
예제 #4
0
 /// <summary>
 /// Generates a barcode image file with the specified message.
 /// </summary>
 /// <param name="message">The message to be encoded in the barcode.</param>
 /// <param name="type">Type of the barcode to be generated.</param>
 /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains
 ///     information about the file to be generated.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="message"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="imageConfig"/> is null.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="message"/> is too long.<br/>
 ///     -or-<br/>
 ///     <paramref name="type"/> is <see cref="BarcodeType.QR"/>.<br/>
 ///     -or-<br/>
 ///     <paramref name="type"/> is invalid.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> contains illegal characters.
 /// </exception>
 /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <since_tizen> 4 </since_tizen>
 public static void GenerateImage(string message, BarcodeType type, BarcodeImageConfiguration imageConfig)
 {
     GenerateImage(message, type, imageConfig, null);
 }
예제 #5
0
 /// <summary>
 /// Generates a QR image file with the specified message.
 /// </summary>
 /// <remarks>
 ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> must be <see cref="Visibility.Invisible"/>,
 ///     because the text visibility is not supported in the QR code.
 /// </remarks>
 /// <param name="message">The message to be encoded in the barcode.</param>
 /// <param name="qrConfig">The <see cref="QrConfiguration"/> instance.</param>
 /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains information about the file to be generated.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="message"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="qrConfig"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="imageConfig"/> is null.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="message"/> is too long.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> contains characters which are illegal by the <see cref="QrMode"/>.
 /// </exception>
 /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <seealso cref="QrMode"/>
 /// <since_tizen> 4 </since_tizen>
 public static void GenerateImage(string message, QrConfiguration qrConfig,
                                  BarcodeImageConfiguration imageConfig)
 {
     GenerateImage(message, qrConfig, imageConfig, null);
 }