コード例 #1
0
ファイル: LineChart.xaml.cs プロジェクト: shlormz/EQLogParser
        private static void Aggregate(Dictionary <string, DataPoint> playerData, Dictionary <string, ChartValues <DataPoint> > theValues,
                                      Dictionary <string, DataPoint> needAccounting, DataPoint dataPoint, DataPoint aggregate, double firstTime, double lastTime, double diff)
        {
            if (diff > DataManager.FIGHTTIMEOUT)
            {
                UpdateRemaining(theValues, needAccounting, firstTime, lastTime);
                foreach (var value in playerData.Values)
                {
                    value.RollingTotal    = 0;
                    value.RollingCritHits = 0;
                    value.RollingHits     = 0;
                    value.CurrentTime     = lastTime + 6;
                    Insert(value, theValues);
                    value.CurrentTime = firstTime - 6;
                    Insert(value, theValues);
                }
            }

            aggregate.Total           += dataPoint.Total;
            aggregate.RollingTotal    += dataPoint.Total;
            aggregate.RollingHits     += 1;
            aggregate.RollingCritHits += LineModifiersParser.IsCrit(dataPoint.ModifiersMask) ? (uint)1 : 0;
            aggregate.BeginTime        = firstTime;
            aggregate.CurrentTime      = dataPoint.CurrentTime;

            if (diff >= 1)
            {
                Insert(aggregate, theValues);
                UpdateRemaining(theValues, needAccounting, firstTime, dataPoint.CurrentTime, aggregate.Name);
            }
            else
            {
                needAccounting[aggregate.Name] = aggregate;
            }
        }
コード例 #2
0
        private void AddDataPoints(RecordGroupCollection recordIterator, List <PlayerStats> selected = null, Predicate <object> filter = null)
        {
            DateTime newTaskTime = DateTime.Now;

            Task.Run(() =>
            {
                double lastTime  = double.NaN;
                double firstTime = double.NaN;
                Dictionary <string, DataPoint> playerData               = new Dictionary <string, DataPoint>();
                Dictionary <string, DataPoint> needAccounting           = new Dictionary <string, DataPoint>();
                Dictionary <string, ChartValues <DataPoint> > theValues = new Dictionary <string, ChartValues <DataPoint> >();

                foreach (var dataPoint in recordIterator)
                {
                    double diff = double.IsNaN(lastTime) ? 1 : dataPoint.CurrentTime - lastTime;

                    if (!playerData.TryGetValue(dataPoint.Name, out DataPoint aggregate))
                    {
                        aggregate = new DataPoint()
                        {
                            Name = dataPoint.Name
                        };
                        playerData[dataPoint.Name] = aggregate;
                    }

                    if (double.IsNaN(firstTime) || diff > DataManager.FIGHT_TIMEOUT)
                    {
                        firstTime = dataPoint.CurrentTime;

                        if (diff > DataManager.FIGHT_TIMEOUT)
                        {
                            UpdateRemaining(theValues, needAccounting, firstTime, lastTime);
                            foreach (var value in playerData.Values)
                            {
                                value.RollingTotal    = 0;
                                value.RollingCritHits = 0;
                                value.RollingHits     = 0;
                                value.CurrentTime     = lastTime + 6;
                                Insert(value, theValues);
                                value.CurrentTime = firstTime - 6;
                                Insert(value, theValues);
                            }
                        }
                    }

                    aggregate.Total           += dataPoint.Total;
                    aggregate.RollingTotal    += dataPoint.Total;
                    aggregate.RollingHits     += 1;
                    aggregate.RollingCritHits += LineModifiersParser.IsCrit(dataPoint.ModifiersMask) ? (uint)1 : 0;
                    aggregate.BeginTime        = firstTime;
                    aggregate.CurrentTime      = dataPoint.CurrentTime;
                    lastTime = dataPoint.CurrentTime;

                    if (diff >= 1)
                    {
                        Insert(aggregate, theValues);
                        UpdateRemaining(theValues, needAccounting, firstTime, lastTime, aggregate.Name);
                    }
                    else
                    {
                        needAccounting[aggregate.Name] = aggregate;
                    }
                }

                UpdateRemaining(theValues, needAccounting, firstTime, lastTime);
                Plot(theValues, newTaskTime, selected, filter);
            });
        }