Beispiel #1
0
 public StringFormatScanner(
     IScannerConfig config,
     IScanPreprocessor preprocessor,
     IHashProvider <string> hashProvider)
     : base(config, preprocessor, hashProvider)
 {
 }
Beispiel #2
0
 public AttributeScanner(
     IScannerConfig config,
     IScanPreprocessor preprocessor,
     IHashProvider <string> hashProvider)
     : base(config, preprocessor, hashProvider)
 {
 }
Beispiel #3
0
 public SingleLineScanner(
     IScannerConfig config,
     IScanPreprocessor preprocessor,
     IHashProvider <string> hashProvider)
 {
     _config       = config;
     _preprocessor = preprocessor;
     _hashProvider = hashProvider;
     _results      = new HashSet <ScanResult>();
 }
Beispiel #4
0
        public MultiLineScanner(
            IScannerConfig config,
            IScanPreprocessor preprocessor,
            IHashProvider <string> hashProvider)
        {
            _config            = config;
            _preprocessor      = preprocessor;
            _hashProvider      = hashProvider;
            _singleLineScanner = new SingleLineScanner(config, preprocessor, hashProvider);

            _lines   = new LimitedStack <Line>(BufferSize);
            _results = new HashSet <ScanResult>();
        }
Beispiel #5
0
        private static IScannerConfig CreateScannerConfig(
            string[] textSearchPatterns,
            string[] textSearchPatternsExclude = null)
        {
            IScannerConfig config = Substitute.For <IScannerConfig>();

            config.TextSearchPatterns.Returns(textSearchPatterns);

            if (textSearchPatternsExclude != null)
            {
                config.TextSearchPatternsExclude.Returns(textSearchPatternsExclude);
            }

            return(config);
        }
Beispiel #6
0
        public void ScanTest(
            IScannerConfig config,
            IHashProvider <string> hashProvider,
            string[] lines,
            ScanResult[] expectedResult)
        {
            StringFormatScanner scanner = new StringFormatScanner(config, new ScanPreprocessor(), hashProvider);

            foreach (string line in lines)
            {
                scanner.AppendLine(line);
                scanner.Scan();
            }

            IReadOnlyCollection <ScanResult> result = scanner.GetResult();

            result.ShouldAllBeEquivalentTo(expectedResult);
        }
Beispiel #7
0
        public void SetConfig(IScannerConfig a_config)
        {
            ZebraScannerConfig config = (ZebraScannerConfig)a_config;

            Bundle profileConfig = new Bundle();

            profileConfig.PutString("PROFILE_NAME", EXTRA_PROFILE_NAME);
            profileConfig.PutString("PROFILE_ENABLED", _bRegistered ? "true" : "false"); //  Seems these are all strings
            profileConfig.PutString("CONFIG_MODE", "UPDATE");
            Bundle barcodeConfig = new Bundle();

            barcodeConfig.PutString("PLUGIN_NAME", "BARCODE");
            barcodeConfig.PutString("RESET_CONFIG", "false"); //  This is the default but never hurts to specify
            Bundle barcodeProps = new Bundle();

            barcodeProps.PutString("scanner_input_enabled", "true");
            barcodeProps.PutString("scanner_selection", "auto"); //  Could also specify a number here, the id returned from ENUMERATE_SCANNERS.
                                                                 //  Do NOT use "Auto" here (with a capital 'A'), it must be lower case.
            barcodeProps.PutString("decoder_ean8", config.IsEAN8 ? "true" : "false");
            barcodeProps.PutString("decoder_ean13", config.IsEAN13 ? "true" : "false");
            barcodeProps.PutString("decoder_code39", config.IsCode39 ? "true" : "false");
            barcodeProps.PutString("decoder_code128", config.IsCode128 ? "true" : "false");
            barcodeProps.PutString("decoder_upca", config.IsUPCA ? "true" : "false");
            barcodeProps.PutString("decoder_upce0", config.IsUPCE0 ? "true" : "false");
            barcodeProps.PutString("decoder_upce1", config.IsUPCE1 ? "true" : "false");
            barcodeProps.PutString("decoder_d2of5", config.IsD2of5 ? "true" : "false");
            barcodeProps.PutString("decoder_i2of5", config.IsI2of5 ? "true" : "false");
            barcodeProps.PutString("decoder_aztec", config.IsAztec ? "true" : "false");
            barcodeProps.PutString("decoder_pdf417", config.IsPDF417 ? "true" : "false");
            barcodeProps.PutString("decoder_qrcode", config.IsQRCode ? "true" : "false");

            barcodeConfig.PutBundle("PARAM_LIST", barcodeProps);
            profileConfig.PutBundle("PLUGIN_CONFIG", barcodeConfig);
            Bundle appConfig = new Bundle();

            appConfig.PutString("PACKAGE_NAME", Android.App.Application.Context.PackageName);      //  Associate the profile with this app
            appConfig.PutStringArray("ACTIVITY_LIST", new String[] { "*" });
            profileConfig.PutParcelableArray("APP_LIST", new Bundle[] { appConfig });
            SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig);
        }