private void Explorer_OnFileCarverCompleted(object sender, EventArgs e) { FileCarverResults results = (FileCarverResults)e; fileCarver = results.carver; CreateCarverView(fileCarver); }
private async void runFileCarverToolStripMenuItem_Click(object sender, EventArgs e) { // TODO: Make into a user controlled setting var searchLength = this.volume.FileAreaLength; var searchInterval = Properties.Settings.Default.FileCarverInterval; taskRunner.Maximum = searchLength; taskRunner.Interval = (long)searchInterval; FileCarver carver = new FileCarver(this.volume, searchInterval, searchLength); var numBlocks = searchLength / (long)searchInterval; await taskRunner.RunTaskAsync("File Carver", // Task (CancellationToken cancellationToken, IProgress <int> progress) => { carver.Analyze(cancellationToken, progress); }, // Progress Update (int progress) => { //var progress = carver.GetProgress(); taskRunner.UpdateLabel($"Processing block {progress}/{numBlocks}"); taskRunner.UpdateProgress(progress); }, // On Task Completion () => { OnFileCarverCompleted?.Invoke(this, new FileCarverResults() { carver = carver }); }); }
public PartitionDatabase(Volume volume) { this.volume = volume; this.metadataAnalyzer = false; this.fileCarver = null; this.fileDatabase = new FileDatabase(volume); }
public CarverResults(FileCarver analyzer, TaskRunner taskRunner) { InitializeComponent(); this._analyzer = analyzer; this._volume = analyzer.GetVolume(); this.taskRunner = taskRunner; PopulateResultsList(analyzer.GetCarvedFiles()); }
public void CreateCarverView(FileCarver carver) { if (carverResultsPage != null) { tabControl1.TabPages.Remove(carverResultsPage); } partitionDatabase.SetFileCarver(carver); carverResultsPage = new TabPage("Carver View"); CarverResults carverResults = new CarverResults(carver, this.taskRunner); carverResults.Dock = DockStyle.Fill; carverResultsPage.Controls.Add(carverResults); tabControl1.TabPages.Add(carverResultsPage); tabControl1.SelectedTab = carverResultsPage; }
public void LoadFromJson(JsonElement partitionElement) { // We are loading a new database so clear previous results fileDatabase.Reset(); // Find the Analysis element, which contains analysis results JsonElement analysisElement; if (!partitionElement.TryGetProperty("Analysis", out analysisElement)) { var name = partitionElement.GetProperty("Name").GetString(); throw new FileLoadException($"Database: Partition ${name} is missing Analysis object!"); } if (analysisElement.TryGetProperty("MetadataAnalyzer", out var metadataAnalysisList)) { // Loads the files from the json into the FileDatabase // Only post the results if there actually was any if (LoadFromDatabase(metadataAnalysisList)) { OnLoadRecoveryFromDatabase?.Invoke(null, null); // Mark that analysis was done this.metadataAnalyzer = true; } else { // Element was there but no analysis results were loaded this.metadataAnalyzer = false; } } if (analysisElement.TryGetProperty("FileCarver", out var fileCarverList)) { // TODO: We will begin replacing this when we start work on customizable "CarvedFiles" var analyzer = new FileCarver(this.volume, FileCarverInterval.Cluster, this.volume.Length); analyzer.LoadFromDatabase(fileCarverList); if (analyzer.GetCarvedFiles().Count > 0) { view.CreateCarverView(analyzer); this.fileCarver = analyzer; } } }
public void SetFileCarver(FileCarver fileCarver) { this.fileCarver = fileCarver; }