private void TaskBody() { try { var dev = new Dev(this, _repo, _log); var rtdata = new Rtdata(this, _repo, _log, dev); Base accdata = new Accdata(this, _repo, _log, dev); Base fzdata = new Fzdata(this, _repo, _log, dev, rtdata); Base kgbhdata = new Kgbhdata(this, _repo, _log, dev); Base ycbjdata = new Ycbjdata(this, _repo, _log, dev); Base unknown = new Unknown(this, _repo, _log); dev.SetSuccessor(rtdata); rtdata.SetSuccessor(accdata); accdata.SetSuccessor(fzdata); fzdata.SetSuccessor(kgbhdata); kgbhdata.SetSuccessor(ycbjdata); ycbjdata.SetSuccessor(unknown); while (!_cts.IsCancellationRequested) { _repo.HandleYearDapper(); var files = GetFilesFromDir(Config.MonitorFilePath, Config.FileExtension); if (!files.Any()) { Thread.Sleep(500); continue; } try { foreach (var file in files) { _log($"处理文件 {file}"); // 处理接收到的文件 if (dev != null) { dev.HandleFile(file); } } } catch (Exception ex) { _log($"处理文件出错:{ex}"); } Thread.Sleep(1000); } } catch (Exception ex) { _log($"Load:{ex}"); } }
public Fzdata(ParseProtocal protocol, DataRepo dataRepo, Action <string> log, Dev dev, Rtdata rtdata) : base(protocol, dataRepo, log) { _dev = dev; _rtdata = rtdata; }