Exemple #1
0
        private static void RunDecode(Settings settings)
        {
            var input    = settings.FileToDecode;
            var alphabet = settings.AlphabetFile;
            var output   = settings.OutputFile;

            FileDecoder.DecodeFile(input, alphabet, output);
        }
Exemple #2
0
        private ValidationResultType LoadFileV20(string content, string fileSpecXml)
        {
            LoadedFilePageState.ParsedDataAndSpec10 = null;
            LoadedFilePageState.ParsedDataAndSpec20 = FileDecoder.LoadVersion20(content, fileSpecXml);
            LoadedFilePageState.FrameworkVersion    = InputDefinitionFile20.VERSION;

            return(LoadedFilePageState.ParsedDataAndSpec20.ParsedData.ValidationResult);
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(DefaultConnectionString, o => o.EnableRetryOnFailure()));

            services.Configure <DRSConfig>(Configuration.GetSection("DRS"));
            services.Configure <Engine.Services.Lucene.Config>(Configuration.GetSection("DRS"));
            services.Configure <OcrEngine.Config>(Configuration.GetSection("DRS:Tess"));

            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddAuthentication();

            services.AddHangfire(x => x.UseSqlServerStorage(DefaultConnectionString));

            services
            .AddMvc(
                options =>
            {
                options.Filters.Add(new ValidateModelStateFilter());
                options.Filters.Add(new ApiExceptionFilter());
            })
            .AddFeatureFolders()
            .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver())
            .AddFluentValidation(cfg => cfg.RegisterValidatorsFromAssemblyContaining <Startup>());

            services.AddAutoMapper(typeof(Startup));

            Mapper.AssertConfigurationIsValid();

            services.AddMediatR(typeof(Startup));

            var container = new Container(cfg => cfg.AddRegistry <WebRegistry>());

            // populates structuremap with .NET services

            container.Populate(services);

            FileDecoder.RegisterFileDecoders(container.GetInstance <IOcrEngine>(), container.GetInstance <IPdfRasterizer>());

            return(container.GetInstance <IServiceProvider>());
        }