CampahApp.Chatlog.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
        public void Update()
        {
            if (FFACEInstance.Instance == null)
            {
                return;
            }

            if (ChatLog.Blocks.Count > 1000)
            {
                while (ChatLog.Blocks.Count > 500)
                {
                    ChatLog.Blocks.Remove(ChatLog.Blocks.FirstBlock);
                }
            }

            FFACE.ChatTools.ChatLine chatline;
            var lines = new List<FFACE.ChatTools.ChatLine>();

            while ((chatline = FFACEInstance.Instance.Chat.GetNextLine()) != null)
            {
                if (lines.Count > 0 && chatline.RawString[4] == lines[0].RawString[4])
                {
                    lines[0].Text += chatline.Text;
                }
                else
                {
                    if (chatline.Type == ChatMode.RcvdTell)
                    {
                        var findname = new Regex(@"(.*)>>.*");
                        _lasttells.Remove(findname.Matches(chatline.Text)[0].Groups[1].Value);
                        _lasttells.Insert(0, findname.Matches(chatline.Text)[0].Groups[1].Value);
                        //LastTell = findname.Matches(chatline.Text)[0].Groups[1].Value;
                    }
                    lines.Add(chatline);
                }
            }

            Lines.AddRange(lines);
            if (Lines.Count > 500)
                Lines.RemoveRange(0, 200);

            foreach (FFACE.ChatTools.ChatLine line in lines)
            {
                AddLine(line);
            }
            foreach (ChatAlert alert in _alerts)
            {
                foreach (FFACE.ChatTools.ChatLine line in lines)
                {
                    if (alert.Mode == ChatMode.Generic || alert.Mode == line.Type)
                    {
                        alert.ParseLine(line);
                    }
                }
            }
        }