public TranslatorPage() { InitializeComponent(); for (ShowNameMode i = 0; i != ShowNameMode.END; i++) { nameModePicker.Items.Add(i.ToString()); } viewModel = new TranslatorViewModel(); BindingContext = viewModel; Appearing += TranslatorPage_Appearing; }
public bool ConvertChatMessage(ref string text, TypingQuirk quirk, bool isBbcMode, ShowNameMode showNameMode) { string[] lines = Regex.Split(text, nextLines).Select(l => l.Trim()).ToArray(); string line = ""; _sb.Clear(); for (int i = 0; i < lines.Length;) { line = lines[i]; if (isBbcMode) { _sb.Append($"[color=#{ColorToHex(quirk.ChatColor)}]"); } if (showNameMode != ShowNameMode.None) { _sb.Append(showNameMode == ShowNameMode.ChatHandle ? quirk.ChatHandleShort : quirk.Name); _sb.Append(seperator[0]); } if (quirk.ApplyQuirk(line, _isBbcMode, out text)) { _sb.Append(text); } else { return(false); } i++; if (i < lines.Length) { _sb.AppendLine(); } } if (isBbcMode) { _sb.Append("[/color]"); } text = _sb.ToString(); return(true); }