public static string ToHtml(this IOpenRCT2String str)
        {
            var sb          = new StringBuilder();
            var htmlWriter  = new StringWriter(sb);
            var htmlEncoder = HtmlEncoder.Default;

            WriteColourSpanOpen(htmlWriter, (char)144);

            char[] charArray = str.Raw.ToCharArray();
            for (int i = 0; i < charArray.Length; i++)
            {
                char c = charArray[i];
                if (OpenRCT2String.IsFormatCode(c))
                {
                    if (OpenRCT2String.IsColourCode(c))
                    {
                        WriteSpanClose(htmlWriter);
                        WriteColourSpanOpen(htmlWriter, c);
                    }
                }
                else
                {
                    htmlEncoder.Encode(htmlWriter, charArray, i, 1);
                }
            }
            WriteSpanClose(htmlWriter);
            return(sb.ToString());
        }
Example #2
0
        public void SendChat(IOpenRCT2String message)
        {
            using (var ms = new MemoryStream())
            {
                var bw = new BinaryWriter(ms);
                bw.Write(PacketType.Chat);
                bw.WriteUTF8(message.Raw);

                SendPacket(ms.ToArray());
            }
        }