private void InitializeTargetListViewItem() { PUnit wu = ObjectManager.MyPlayer.Target; var pairs = new NameValuePair[] {}; if (wu != null && wu.BaseAddress != 0) { if (wu.Type == 3) { pairs = GetTargetNameValuePairs(wu); } else if (wu.Type == 4) { var wpm = (PPlayer) wu; pairs = GetPlayerNameValuePairs(wpm); } } _wowTargetListViewItemArray = new ListViewItem[pairs.Length]; for (int i = 0; i < pairs.Length; i++) { var temp = new ListViewItem(pairs[i].Name); temp.SubItems.Add(pairs[i].Value); _wowTargetListViewItemArray[i] = temp; } listView2.Items.AddRange(_wowTargetListViewItemArray); }
public void UpdateTargetTabValues() { PUnit wu = ObjectManager.MyPlayer.Target; if (wu != null) { if (_wowTargetListViewItemArray != null && _wowTargetListViewItemArray.Length < 2) { InitializeTargetListViewItem(); } else { var targetPairs = new NameValuePair[] {}; if (wu.BaseAddress != 0) { if (wu.Type == 3) { targetPairs = GetTargetNameValuePairs(wu); } else if (wu.Type == 4) { var wpm = (PPlayer) wu; targetPairs = GetPlayerNameValuePairs(wpm); } if (_wowTargetListViewItemArray != null) for (int j = 0; j < _wowTargetListViewItemArray.Length; j++) { try { _wowTargetListViewItemArray[j].SubItems.RemoveAt(1); _wowTargetListViewItemArray[j].SubItems.Add(targetPairs[j].Value); } catch { } } } } } else { // erase the view when the target changes _wowTargetListViewItemArray = new ListViewItem[0]; listView2.Items.Clear(); } }