You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using Admin.Core.Common ;
using Aucma.Core.RunPlc ;
using log4net ;
using Microsoft.AspNetCore.Builder ;
using System ;
namespace Admin.Core.Extensions
{
/// <summary>
///PLC
/// </summary>
public static class PlcMildd
{
private static readonly ILog log = LogManager . GetLogger ( typeof ( PlcMildd ) ) ;
public static async void UsePlcMildd ( this IApplicationBuilder app , IRunPlcService plc )
{
if ( app = = null ) throw new ArgumentNullException ( nameof ( app ) ) ;
try
{
if ( Appsettings . app ( "Middleware" , "Plc" , "Enabled" ) . ObjToBool ( ) )
{
await plc . StartPlcAsync ( ) ;
//if (result)
// Console.WriteLine("三菱PLC服务启动成功! ");
//else
// Console.WriteLine("三菱PLC服务启动失败! ");
}
}
catch ( Exception e )
{
log . Error ( $"An error was reported when starting the job service.\n{e.Message}" ) ;
throw ;
}
}
}
}