using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Protocol.Contracts.Interfaces; using JiShe.CollectBus.Protocol.Contracts.Models; using JiShe.CollectBus.Protocol.Dto; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_00H { public class AFN0_F1_Analysis: IAnalysisStrategy { public static string StrategyType => nameof(AFN0_F1_Analysis); public static Type InputType => typeof(TB3761); public static Type ResultType => typeof(AFN0_F1_AnalysisDto); private readonly ILogger _logger; public AFN0_F1_Analysis(ILogger logger) { _logger = logger; } public Task ExecuteAsync(TB3761 tB3761) { try { ArgumentNullException.ThrowIfNull(nameof(tB3761)); AFN0_F1_AnalysisDto dto = new AFN0_F1_AnalysisDto { Code = tB3761.A?.Code, AFN = tB3761.AFN_FC?.AFN ?? 0, Fn = tB3761.DT?.Fn ?? 0, Pn = tB3761.DA?.Pn ?? 0 }; return Task.FromResult(dto); } catch (Exception ex) { _logger.LogError(ex, $"00_1解析失败:{tB3761.A?.Code}-{tB3761.DT?.Fn ?? 0}-{tB3761?.BaseHexMessage?.HexMessageString},{ex.Message}"); return null; } } } }