//private Task<ListViewItem[]>[] scanTasks; //private CancellationTokenSource cancellation; //private ScanProgress progress; //private struct ScanSettings //{ // public long address, size; // public byte[] bytes; // public string mask; //} ////TODO: Implement better progress synchronization. //private class ScanProgress //{ // public ScanSettings[] Settings { get; private set; } // public long[] BytesRead { get; private set; } // public int Findings { get; private set; } // public int lastUpdate; // public event EventHandler MadeProgress, FoundItems; // public void Setup(ScanSettings[] settings) // { // Settings = settings; // BytesRead = new long[settings.Length]; // Findings = 0; // lastUpdate = 0; // } // public void Update(int id, long bytes) // { // BytesRead[id] = bytes; // MadeProgress?.Invoke(this, EventArgs.Empty); // } // public void AddFinding() // { // Findings++; // FoundItems?.Invoke(this, EventArgs.Empty); // } //} public frmMain() { InitializeComponent(); Icon = Properties.Resources.Logo_256; var proj = new ProjectView(); //progress = new ScanProgress(); //progress.MadeProgress += (o, e) => //{ // var totalBytes = progress.BytesRead.Sum(); // var perc = (int)(100 * (totalBytes / (double)progress.Settings.Sum(x => x.size))); // if (perc > progress.lastUpdate) // { // progress.lastUpdate = perc; // this.Invoke((MethodInvoker)delegate { progressBar1.Value = Math.Min(perc, progressBar1.Maximum); }); // } //}; //progress.FoundItems += (o, e) => //{ // if (progress.Findings < 10 || // progress.Findings < 100 && progress.Findings % 10 == 0 || // progress.Findings < 1000 && progress.Findings % 100 == 0 || // progress.Findings < 10000 && progress.Findings % 1000 == 0 || // progress.Findings < 100000 && progress.Findings % 1000 == 0 || // progress.Findings < 1000000 && progress.Findings % 10000 == 0) // this.Invoke((MethodInvoker)delegate { lblOccurences.Text = progress.Findings.ToString(); }); //}; }
public frmMain() { InitializeComponent(); Icon = Properties.Resources.Logo_256; var proj = new ProjectView(); }