Esempio n. 1
0
        public List <ChatMessage> GetCombinedLog(int len = 50)
        {
            var playerlog   = this.GetPrivateLog(len);
            var globallog   = CAMain.GetLog(len);
            var channellog  = CAMain.Channels[this.Channel].GetLog(len);
            var combinedLog = playerlog.Union(globallog).Union(channellog).OrderByDescending(m => m.Timestamp).ToList(); // combine 3 logs + sort by timestamp descending (largest = latest on top)

            for (int i = combinedLog.Count - 1; i >= 0; i--)
            {
                if (this.Ignores.Contains(combinedLog[i].Sender))
                {
                    combinedLog.RemoveAt(i);
                }
            }
            if (combinedLog.Count > len) // take required len from the top
            {
                combinedLog = combinedLog.Take(len).ToList();
            }
            combinedLog.Reverse(); // reverse the result
            return(combinedLog);
        }