private void PasteStats(PastePlayerStatsMessage obj) { if (DamageTracker == null) return; var playerStatsSequence = DamageTracker.StatsByUser.OrderByDescending(playerStats => playerStats.Dealt.Damage).TakeWhile(x => x.Dealt.Damage > 0); const int maxLength = 300; var sb = new StringBuilder(); bool first = true; foreach (var playerInfo in playerStatsSequence) { var placeHolder = new PlayerStatsFormatter(playerInfo, FormatHelpers.Invariant); var playerText = first ? "" : " | "; playerText += placeHolder.Replace(SettingsHelper.Instance.Settings.DpsPasteFormat); if (sb.Length + playerText.Length > maxLength) break; sb.Append(playerText); first = false; } if (sb.Length > 0) { var text = sb.ToString(); if (ProcessHelper.Instance.IsTeraActive) { //send text input to Tera ProcessHelper.Instance.SendString(text); } //copy to clipboard in case user wants to paste outside of Tera Application.Current.Dispatcher.Invoke(() => Clipboard.SetDataObject(text)); } }
private void PasteStats(PastePlayerStatsMessage obj) { if (DamageTracker == null) return; var playerStatsSequence = DamageTracker.StatsByUser.OrderByDescending(playerStats => playerStats.Dealt.Damage).TakeWhile(x => x.Dealt.Damage > 0); const int maxLength = 300; var sb = new StringBuilder(); bool first = true; foreach (var playerInfo in playerStatsSequence) { var placeHolder = new PlayerStatsFormatter(playerInfo, FormatHelpers.Invariant); var playerText = first ? "" : " | "; if (playerInfo.Player.Class != PlayerClass.Mystic && playerInfo.Player.Class != PlayerClass.Priest) { playerText += placeHolder.Replace(SettingsHelper.Instance.Settings.DpsDmgPasteFormat); } if (playerInfo.Player.Class == PlayerClass.Mystic || playerInfo.Player.Class == PlayerClass.Priest) { playerText += "HealStat: " + playerInfo.Player.Name + " HPS:" + playerInfo.Dealt.Hps + "(" + playerInfo.Dealt.Heal + ") — " + playerInfo.Dealt.HealFraction.ToString("P1").Replace(" ", string.Empty); } if (sb.Length + playerText.Length > maxLength) break; sb.Append(playerText); first = false; } if (sb.Length > 0) { var text = sb.ToString(); var isActive = ProcessHelper.Instance.IsTeraActive; if (isActive.HasValue && isActive.Value) { //send text input to Tera ProcessHelper.Instance.SendString(text); } //copy to clipboard in case user wants to paste outside of Tera Application.Current.Dispatcher.Invoke(() => Clipboard.SetDataObject(text)); } }