Ejemplo n.º 1
0
        void scan_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                Completed completed = new Completed(scan_ScanCompleted);
                this.Invoke(completed, new object[] { sender, e });
            }
            else
            {
                if (!Canceled)
                {
                    //addressListView.EndUpdate();
                    //addressListView.ResumeLayout();
                    ProgressBar.Value = 0;

                    int TotalFound = (int)(e.TotalFoundSize / (Int64)DataTypeSize.Int64);

                    if (TotalFound > 0)
                    {
                        CurrentScanAddresses = MemoryMappedFile.CreateFromFile(@ExecutablePath + @"/Scan Data/CurrentScanAddresses", FileMode.Open, "CurrentScanAddresses", e.TotalFoundSize);
                        CurrentAddressAccessor = CurrentScanAddresses.CreateViewAccessor(0, e.TotalFoundSize);
                    }

                    AddressCount.Text = "Items: " + TotalFound.ToString();
                    AddressListView.VirtualListSize = TotalFound;

                    NewScanButton.Enabled = true;
                    AbortScanButton.Enabled = false;
                    UpdateFoundTimer.Enabled = true;
                    NextScanButton.Enabled = true;
                    UndoScanButton.Enabled = true;
                }
            }
        }
Ejemplo n.º 2
0
        private void FinishEvents(Int64 TotalFoundSize)
        {
            if (!IsRescan) //First scan unique events
            {

                FirstScanAddresses.Dispose();
                FirstScanValues.Dispose();
                //Resize the files to match how many items were found
                using (FileStream FileStream = File.Open(@ExecutablePath + @"/Scan Data/FirstScanAddresses", FileMode.Open, FileAccess.ReadWrite))
                {
                    FileStream.SetLength(TotalFoundSize);
                    FileStream.Close();
                }
                using (FileStream FileStream = File.Open(@ExecutablePath + @"/Scan Data/FirstScanValues", FileMode.Open, FileAccess.ReadWrite))
                {
                    FileStream.SetLength(TotalFoundSize);
                    FileStream.Close();
                }
                //Copy first scan results to current
                File.Delete(@ExecutablePath + @"/Scan Data/CurrentScanAddresses");
                File.Copy(@ExecutablePath + @"/Scan Data/FirstScanAddresses", @ExecutablePath + @"/Scan Data/CurrentScanAddresses", false);
                File.Delete(@ExecutablePath + @"/Scan Data/CurrentScanValues");
                File.Copy(@ExecutablePath + @"/Scan Data/FirstScanValues", @ExecutablePath + @"/Scan Data/CurrentScanValues", false);
            }
            else //Rescan unique events
            {
                CurrentScanAddresses.Dispose();
                CurrentScanValues.Dispose();

                if (CompareToFirstScan)
                {
                    FirstScanAddresses.Dispose();
                    FirstScanValues.Dispose();
                }
                else
                {
                    LastScanAddresses.Dispose();
                    LastScanValues.Dispose();
                }

                //Resize the files to match how many items were found
                using (FileStream FileStream = File.Open(@ExecutablePath + @"/Scan Data/CurrentScanAddresses", FileMode.Open, FileAccess.ReadWrite))
                {
                    FileStream.SetLength(TotalFoundSize);
                    FileStream.Close();
                }
                using (FileStream FileStream = File.Open(@ExecutablePath + @"/Scan Data/CurrentScanValues", FileMode.Open, FileAccess.ReadWrite))
                {
                    FileStream.SetLength(TotalFoundSize);
                    FileStream.Close();
                }
            }

            //Close the handle to the process to avoid process errors.
            ProcessMemoryEditor.CloseHandle();

            //Prepare and raise the ScanCompleted event.
            ScanCompletedEventArgs ScanCompleteEventArgs = new ScanCompletedEventArgs(TotalFoundSize);
            ScanCompleted(this, ScanCompleteEventArgs);
        }