public void Init() { _dataAggregator = new FahClientDataAggregator(); }
private void Process() { var sw = Stopwatch.StartNew(); // Set successful Last Retrieval Time LastRetrievalTime = DateTime.Now; var options = _messages.Options; var info = _messages.Info; _slotsLock.EnterReadLock(); try { foreach (var slotModel in _slots) { // Re-Init Slot Level Members Before Processing slotModel.Initialize(); // Run the Aggregator var dataAggregator = new FahClientDataAggregator { Logger = Logger }; dataAggregator.ClientName = slotModel.Name; DataAggregatorResult result = dataAggregator.AggregateData(_fahLog.ClientRuns.LastOrDefault(), _messages.UnitCollection, info, options, slotModel.SlotOptions, slotModel.UnitInfo, slotModel.SlotId); PopulateRunLevelData(result, info, slotModel); slotModel.Queue = result.Queue; slotModel.CurrentLogLines = result.CurrentLogLines; //slotModel.UnitLogLines = result.UnitLogLines; var parsedUnits = new Dictionary <int, UnitInfoModel>(result.UnitInfos.Count); foreach (int key in result.UnitInfos.Keys) { if (result.UnitInfos[key] != null) { parsedUnits[key] = BuildUnitInfoLogic(slotModel, result.UnitInfos[key]); } } // *** THIS HAS TO BE DONE BEFORE UPDATING SlotModel.UnitInfoLogic *** UpdateBenchmarkData(slotModel.UnitInfoModel, parsedUnits.Values, result.CurrentUnitIndex); // Update the UnitInfoLogic if we have a current unit index if (result.CurrentUnitIndex != -1 && parsedUnits.ContainsKey(result.CurrentUnitIndex)) { slotModel.UnitInfoModel = parsedUnits[result.CurrentUnitIndex]; } SetSlotStatus(slotModel); slotModel.UnitInfoModel.ShowProductionTrace(Logger, slotModel.Name, slotModel.Status, Prefs.Get <PpdCalculationType>(Preference.PpdCalculation), Prefs.Get <BonusCalculationType>(Preference.BonusCalculation)); string statusMessage = String.Format(CultureInfo.CurrentCulture, "Slot Status: {0}", slotModel.Status); Logger.InfoFormat(Constants.ClientNameFormat, slotModel.Name, statusMessage); } } finally { _slotsLock.ExitReadLock(); } string message = String.Format(CultureInfo.CurrentCulture, "Retrieval finished: {0}", sw.GetExecTime()); Logger.InfoFormat(Constants.ClientNameFormat, Settings.Name, message); }