コード例 #1
0
ファイル: Test.cs プロジェクト: LucasDiogo96/Ilegra_Analyzer
        public void LoadSingleFile()
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            log.Information("Loading single file test");

            using (StreamWriter sw = File.CreateText(Path.Combine(PathUtil.GetInputPathMonitor(), "TestFile" + ".txt")))
            {
                sw.WriteLine("001ç1234567891234çPedroç20000");
                sw.WriteLine("001ç3245678865434çPauloç40000.99");
                sw.WriteLine("001ç3245678865434çLucasç40000.99");
                sw.WriteLine("002ç2345675434544345çJose da SilvaçRural");
                sw.WriteLine("002ç2345675434544345çJose PereiraçRural");
                sw.WriteLine("002ç04270435062çJose PereiraçRural");
                sw.WriteLine("003ç07ç[1-34-10,2-33-1.50,3-40-0.10]çPaulo");
                sw.WriteLine("003ç08ç[1-34-10,2-33-1.50,3-40-0.10]çLucas");
            }

            try
            {
                log.Information("File inserted");
                _service.Execute();
            }
            catch (Exception e)
            {
                log.Information(e, "An error is ocurred!");
                Assert.Fail();
            }

            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            log.Information("Exec process time: {0}", TimeSpan.FromMilliseconds(elapsedMs).TotalMinutes);
        }
コード例 #2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            #region custom pipeline configuration

            app.UseHangfireDashboard();


            FileAnalyzerService analyzerService = new FileAnalyzerService();


            //5 seg interval to call the recurrent job
            RecurringJob.AddOrUpdate(
                () => analyzerService.Execute(),
                "*/5 * * * * *");

            app.UseSerilogRequestLogging();

            #endregion

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }