public BarcodeReaderGeneric BuildBarcodeReader() { var reader = new BarcodeReaderGeneric(); if (TryHarder.HasValue) { reader.Options.TryHarder = TryHarder.Value; } if (PureBarcode.HasValue) { reader.Options.PureBarcode = PureBarcode.Value; } if (AutoRotate.HasValue) { reader.AutoRotate = AutoRotate.Value; } if (UseCode39ExtendedMode.HasValue) { reader.Options.UseCode39ExtendedMode = UseCode39ExtendedMode.Value; } if (!string.IsNullOrEmpty(CharacterSet)) { reader.Options.CharacterSet = CharacterSet; } if (TryInverted.HasValue) { reader.TryInverted = TryInverted.Value; } if (AssumeGS1.HasValue) { reader.Options.AssumeGS1 = AssumeGS1.Value; } if (PossibleFormats?.Any() ?? false) { reader.Options.PossibleFormats = new List <BarcodeFormat>(); foreach (var pf in PossibleFormats) { reader.Options.PossibleFormats.Add(pf); } } return(reader); }
public MultiFormatReader BuildMultiFormatReader() { var reader = new MultiFormatReader(); var hints = new Dictionary <DecodeHintType, object>(); if (TryHarder.HasValue && TryHarder.Value) { hints.Add(DecodeHintType.TRY_HARDER, TryHarder.Value); } if (PureBarcode.HasValue && PureBarcode.Value) { hints.Add(DecodeHintType.PURE_BARCODE, PureBarcode.Value); } if (PossibleFormats?.Any() ?? false) { hints.Add(DecodeHintType.POSSIBLE_FORMATS, PossibleFormats); } reader.Hints = hints; return(reader); }