public UserStatisticsBucket GetOrCreateBucket(DateTime when) { int yearDay = (1000 * when.Year) + when.DayOfYear; UserStatisticsBucket result = Buckets.Where(x => x.YearDay == yearDay).FirstOrDefault(); if (null == result) { result = new UserStatisticsBucket() { YearDay = yearDay }; Buckets.Insert(0, result); } return(result); }
public void AddTo(UserStatisticsBucket total) { total.TotalMessages += TotalMessages; total.Hashtags += Hashtags; total.Mentions += Mentions; total.Mentioned += Mentioned; total.Forwards += Forwards; total.Forwarded += Forwarded; total.Replies += Replies; total.Replied += Replied; total.Joined += Joined; total.Left += Left; total.Words += Words; total.Lines += Lines; total.Characters += Characters; total.Stickers += Stickers; total.URLs += URLs; int numMBTs = Math.Min(MessagesByType.Length, total.MessagesByType.Length); for (int i = 0; i < numMBTs; i++) { total.MessagesByType[i] += MessagesByType[i]; } }