public void AddItem(SearchListViewItem item) { CalculateSBarMax(); //a.Add(item.addr, item); b.Add(item); if (b.Count >= MaxItemSize) { AddItemsFromList(); } }
private void printBox_DoubleClick(object sender, EventArgs e) { if (tempTB != null) { printBox.Controls.Remove(tempTB); tempTB = null; } Point pos = printBox.PointToClient(Cursor.Position); int item = (int)(pos.Y / ItemHeight) + vertSBar.Value; int index = (int)(pos.X / addrLabel.Width); if (item < TotalCount) { tempTB = new TextBox(); tempTB.Width = addrLabel.Width - 10; tempTB.TextAlign = HorizontalAlignment.Center; tempTB.ReadOnly = true; SearchListViewItem lItem = GetItemAtIndex(item); string[] res = ParseListViewItem(lItem, item); switch (index) { case 0: //Address tempTB.Text = res[0]; break; case 1: //Hex tempTB.Text = res[1]; break; case 2: //Dec tempTB.Text = res[2]; break; case 3: //Align tempTB.Text = res[3]; break; } tempTB.Location = new Point((index * addrLabel.Width) + addrLabel.Width / 2 - tempTB.Width / 2, (item - vertSBar.Value) * (int)ItemHeight - 2); printBox.Controls.Add(tempTB); tempTB.Select(); tempTB.Refresh(); tempTB.SelectionStart = 0; tempTB.SelectionLength = tempTB.Text.Length; } }
public void SetItemAtIndex(SearchListViewItem item, int ind) { if (ind < 0 || ind >= (a.Count + b.Count)) { return; } if (ind >= a.Count) { b[ind - a.Count] = item; return; } a[ind] = item; }
void CopySelection() { bool cont = true; if (SelectedIndices.Count > 100000) { //cont = MessageBox.Show("You are about to copy a hell of a lot of codes... And it will probably take some time.\nAre you sure you want to go through with this?", "Art thou surest?", MessageBoxButtons.YesNo) == DialogResult.Yes; } if (!cont) { return; } string res = ""; List <int> selParsed = new List <int>(); SearchControl.ncSearcher searcher = SearchControl.SearchComparisons.Where(sc => sc.Name == SearchControl.Instance.searchNameBox.Items[SearchControl.Instance.searchNameBox.SelectedIndex].ToString()).FirstOrDefault(); string[] codes = new string[SelectedIndices.Count]; int codeIndex = 0; foreach (int x in SelectedIndices) { //if (!selParsed.Contains(x)) { //selParsed.Add(x); SearchListViewItem item = GetItemAtIndex(x); if (item.newVal != null) { SearchControl.ncSearchType type = SearchControl.SearchTypes[item.align]; if (searcher.ItemToString != null) { codes[codeIndex] = searcher.ItemToString(item) + Environment.NewLine; } else { codes[codeIndex] = type.ItemToString(item) + Environment.NewLine; } codeIndex++; } } } Clipboard.SetDataObject(new DataObject(DataFormats.Text, (String.Join("", codes, 0, codeIndex)).Replace("\0", ""))); }
public string[] ParseItem(SearchListViewItem item, int ind) { SearchControl.ncSearchType type = SearchControl.SearchTypes[item.align]; SearchControl.ncSearcher searcher = SearchControl.SearchComparisons.Where(sc => sc.Name == SearchControl.Instance.searchNameBox.Items[SearchControl.Instance.searchNameBox.SelectedIndex].ToString()).FirstOrDefault(); if (item.refresh) { byte[] newVal = new byte[type.ByteSize]; Form1.apiGetMem(item.addr, ref newVal); newVal = misc.notrevif(newVal); item.oldVal = item.newVal; item.newVal = newVal; item.refresh = false; SetItemAtIndex(item, ind); } if (searcher.ItemToLString != null) { return(searcher.ItemToLString(item)); } else { return(type.ItemToLString(item)); } }
private void addi(SearchListViewItem item) { a.Add(item); }
public void RemoveItem(SearchListViewItem item) { //a.Remove(item.addr); a.Remove(item); printBox.Refresh(); }