public void OnSpecialColoredMessage(Color color, string text)
        {
            Paragraph pr   = new Paragraph();
            Run       date = new Run("[" + DateTime.Now.ToString("HH:mm") + "] ");

            date.Foreground = new SolidColorBrush(color);
            pr.Inlines.Add(date);

            string[] args = text.Split(' ');

            bool bold      = false;
            bool italic    = false;
            bool underline = false;

            foreach (string word in args)
            {
                Run normalTxt = new Run();

                if (bold)
                {
                    normalTxt.FontWeight = FontWeights.Bold;
                }
                if (italic)
                {
                    normalTxt.FontStyle = FontStyles.Italic;
                }
                if (underline)
                {
                    normalTxt.TextDecorations = TextDecorations.Underline;
                }

                if (word.StartsWith("http://") || word.StartsWith("www.") || word.StartsWith("https://"))
                {
                    string url = word;
                    if (word.EndsWith("."))
                    {
                        url = word.Substring(0, word.Length - 2);
                    }

                    Hyperlink textLink = new Hyperlink(new Run(url));
                    textLink.NavigateUri      = new Uri(url);
                    textLink.RequestNavigate += TextLink_RequestNavigate;

                    pr.Inlines.Add(textLink);

                    normalTxt.Text = " ";
                }
                else if (word == "**")
                {
                    bold = !bold;
                    continue;
                }
                else if (word == "*")
                {
                    italic = !italic;
                    continue;
                }
                else if (word == "__")
                {
                    underline = !underline;
                    continue;
                }
                else if (word.StartsWith("**"))
                {
                    normalTxt.Text       = (word.Substring(2) + " ");
                    normalTxt.FontWeight = FontWeights.Bold;
                    bold = true;
                }
                else if (word.EndsWith("**"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 2) + " ");
                    bold           = false;
                }
                else if (word.StartsWith("*"))
                {
                    normalTxt.Text      = (word.Substring(1) + " ");
                    normalTxt.FontStyle = FontStyles.Italic;
                    italic = true;
                }
                else if (word.EndsWith("*"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 1) + " ");
                    italic         = false;
                }
                else if (word.StartsWith("__"))
                {
                    normalTxt.Text            = (word.Substring(2) + " ");
                    normalTxt.TextDecorations = TextDecorations.Underline;
                    underline = true;
                }
                else if (word.EndsWith("__"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 2) + " ");
                    underline      = false;
                }
                else if (word == FormExecution.Username)
                {
                    normalTxt.Text       = (word + " ");
                    normalTxt.FontWeight = FontWeights.Bold;

                    FormExecution.FlashChat();
                }
                else
                {
                    normalTxt.Text = (word + " ");
                }

                normalTxt.Foreground = new SolidColorBrush(color);
                pr.Inlines.Add(normalTxt);
            }

            pr.Margin = new Thickness(0);
            chat.Document.Blocks.Add(pr);


            if (FormExecution.ClientConfig.Autoscroll)
            {
                ScrollToCarret();
            }
        }
        public void OnPlayerColoredMessage(Color color, PlayerInfo player, string text, bool canHighlight = false)
        {
            Paragraph pr   = new Paragraph();
            Run       date = new Run("[" + DateTime.Now.ToString("HH:mm") + "] [");

            date.Foreground = new SolidColorBrush(color);

            Run pl = new Run(ParseUsername(player.Username, player.Rank, player.VIP));

            if (player.Team != 0 && FormExecution.ClientConfig.DisplayTagTeam)
            {
                pl.Text = player.TeamTag + " - " + pl.Text;
            }

            pl.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + player.ChatColorString));

            Run txt = new Run("]: ");

            txt.Foreground = new SolidColorBrush(color);

            /*Image avatar = new Image();
             * avatar.Width = FormExecution.AppDesignConfig.FontSize + 10;
             * avatar.Height = FormExecution.AppDesignConfig.FontSize + 10;
             * avatar.Source = DrawingImageToBitmapImage(RoundCorners(FormExecution.AssetsManager.GetCustom(player.Avatar), 300, System.Drawing.Color.Transparent));
             * avatar.Margin = new Thickness(3);*/

            date.BaselineAlignment = BaselineAlignment.Center;
            pl.BaselineAlignment   = BaselineAlignment.Center;
            txt.BaselineAlignment  = BaselineAlignment.Center;
            //pr.Inlines.Add(avatar);
            pr.Inlines.Add(date);
            pr.Inlines.Add(pl);
            pr.Inlines.Add(txt);

            string[] args = text.Split(' ');

            bool highlight = false;

            if (!canHighlight && args.Contains(FormExecution.Username))
            {
                highlight = true;
            }

            bool bold      = false;
            bool italic    = false;
            bool underline = false;

            foreach (string word in args)
            {
                Run normalTxt = new Run();
                normalTxt.BaselineAlignment = BaselineAlignment.Center;

                if (bold)
                {
                    normalTxt.FontWeight = FontWeights.Bold;
                }
                if (italic)
                {
                    normalTxt.FontStyle = FontStyles.Italic;
                }
                if (underline)
                {
                    normalTxt.TextDecorations = TextDecorations.Underline;
                }
                if (highlight)
                {
                    normalTxt.Background = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("HighlighMessageColor"));
                }

                if (word.StartsWith("http://") || word.StartsWith("www.") || word.StartsWith("https://"))
                {
                    string url = word;
                    if (word.EndsWith("."))
                    {
                        url = word.Substring(0, word.Length - 2);
                    }

                    Hyperlink textLink = new Hyperlink(new Run(url));
                    if (highlight)
                    {
                        textLink.Background = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("HighlighMessageColor"));
                    }
                    textLink.NavigateUri      = new Uri(url);
                    textLink.RequestNavigate += TextLink_RequestNavigate;

                    textLink.BaselineAlignment = BaselineAlignment.Center;

                    pr.Inlines.Add(textLink);

                    normalTxt.Text = " ";
                }
                else if (word.Length > 2 && word.StartsWith(":") && word.EndsWith(":") && FormExecution.AssetsManager.CheckSmiley(word.Substring(1, word.Length - 2)) != null)
                {
                    Image img = new Image();
                    img.Source      = FormExecution.AssetsManager.CheckSmiley(word.Substring(1, word.Length - 2)).Pic.Source.Clone();
                    img.Width       = FormExecution.AppDesignConfig.FontSize + 10;
                    img.Height      = FormExecution.AppDesignConfig.FontSize + 10;
                    img.MouseEnter += (sender, e) => Smiley_Hover(sender, e, word);
                    img.MouseLeave += Smiley_Leave;
                    pr.Inlines.Add(img);
                    normalTxt.Text = " ";
                }
                else if (word == "**")
                {
                    bold = !bold;
                    continue;
                }
                else if (word == "*")
                {
                    italic = !italic;
                    continue;
                }
                else if (word == "__")
                {
                    underline = !underline;
                    continue;
                }
                else if (word.StartsWith("**"))
                {
                    normalTxt.Text       = (word.Substring(2) + " ");
                    normalTxt.FontWeight = FontWeights.Bold;
                    bold = true;
                }
                else if (word.EndsWith("**"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 2) + " ");
                    bold           = false;
                }
                else if (word.StartsWith("*"))
                {
                    normalTxt.Text      = (word.Substring(1) + " ");
                    normalTxt.FontStyle = FontStyles.Italic;
                    italic = true;
                }
                else if (word.EndsWith("*"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 1) + " ");
                    italic         = false;
                }
                else if (word.StartsWith("__"))
                {
                    normalTxt.Text            = (word.Substring(2) + " ");
                    normalTxt.TextDecorations = TextDecorations.Underline;
                    underline = true;
                }
                else if (word.EndsWith("__"))
                {
                    normalTxt.Text = (word.Substring(0, word.Length - 2) + " ");
                    underline      = false;
                }
                else if (word == FormExecution.Username)
                {
                    normalTxt.Text       = (word + " ");
                    normalTxt.FontWeight = FontWeights.Bold;

                    FormExecution.FlashChat();
                }
                else
                {
                    normalTxt.Text = (word + " ");
                }

                normalTxt.BaselineAlignment = BaselineAlignment.Center;
                normalTxt.Foreground        = new SolidColorBrush(color);
                pr.Inlines.Add(normalTxt);
            }

            pr.Margin = new Thickness(0);
            chat.Document.Blocks.Add(pr);


            if (FormExecution.ClientConfig.Autoscroll)
            {
                ScrollToCarret();
            }
        }