using Admin.Core.Common; using Aucma.Core.RunPlc; using Aucma.Core.ScannerGun; using log4net; using Microsoft.AspNetCore.Builder; using System; namespace Admin.Core.Extensions { /// ///PLC /// public static class ScannerGunMildd { private static readonly ILog log = LogManager.GetLogger(typeof(ScannerGunMildd)); public static void UseScannerGunMildd(this IApplicationBuilder app, IScannerGunService scannerGun) { if (app == null) throw new ArgumentNullException(nameof(app)); try { if (Appsettings.app("Middleware", "ScannerGun", "Enabled").ObjToBool()) { scannerGun.ScannerGunAsync(); Console.WriteLine("扫码枪服务启动"); } } catch (Exception e) { log.Error($"An error was reported when starting the job service.\n{e.Message}"); throw; } } } }