Esempio n. 1
0
        private static MediaVisionSource GenerateSource(BarcodeGenerationConfiguration config,
                                                        string message, BarcodeType type, int qrMode, int qrEcc, int qrVersion)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

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

            MediaVisionSource source = new MediaVisionSource();

            try
            {
                InteropBarcode.GenerateSource(EngineConfiguration.GetHandle(config),
                                              message, type, qrMode, qrEcc, qrVersion, source.Handle).
                Validate("Failed to generate source");
            }
            catch (Exception)
            {
                source.Dispose();
                throw;
            }
            return(source);
        }
Esempio n. 2
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");
        }