private void CompareSnapshots() { RegistrySnapshot lhs; RegistrySnapshot rhs; ChangeResult[] results; lhs = null; rhs = null; results = new ChangeResult[0]; this.PerformAction(() => lhs = RegistrySnapshot.LoadFromFile(PathHelpers.GetFullPath(_files[0])), "Loading first snapshot"); this.PerformAction(() => rhs = RegistrySnapshot.LoadFromFile(PathHelpers.GetFullPath(_files[1])), "Loading second snapshot"); if (lhs != null && rhs != null) { this.PerformAction(() => { RegistrySnapshotComparer comparer; comparer = new RegistrySnapshotComparer(lhs, rhs); results = comparer.Compare(); }, "Comparing snapshots"); } this.PrintResults(results); if (this.ExitCode == ExitCode.InvalidArguments) { this.ExitCode = results.Length == 0 ? ExitCode.Success : ExitCode.CompareMismatch; } }
private void viewButton_Click(object sender, EventArgs e) { if (snapshotsListBox.SelectedItem == null) { MessageBox.Show("Please select the snapshot to view.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { RegistrySnapshot snapshot; string fileName; this.SetStatus("Loading snapshot..."); fileName = ((FileInfo)snapshotsListBox.SelectedItem).FullPath; snapshot = RegistrySnapshot.LoadFromFile(fileName); this.SetStatus(null); using (ViewDialog dialog = new ViewDialog(snapshot)) { dialog.ShowDialog(this); } } }
private void compareBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { TaskOptions options; RegistrySnapshot lhs; RegistrySnapshot rhs; RegistrySnapshotComparer comparer; options = (TaskOptions)e.Argument; lhs = RegistrySnapshot.LoadFromFile(options.FileName1); rhs = RegistrySnapshot.LoadFromFile(options.FileName2); comparer = new RegistrySnapshotComparer(lhs, rhs); e.Result = comparer.Compare(); }
protected RegistrySnapshot LoadSnapshot(string name) { return(RegistrySnapshot.LoadFromFile(Path.Combine(this.DataPath, name + ".rge"))); }