Exemplo n.º 1
0
        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", "")));
        }
Exemplo n.º 2
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));
            }
        }