public static IStreamFile GetStreamFileFromCaseEvidenceUnit(ITreeUnit treeUnit) { if (treeUnit == null) { return(null); } var csEvidence = treeUnit.GetInstance <ICaseEvidence>(Contracts.Casing.Constants.TreeUnitTag_CaseEvidence); if (csEvidence == null) { LoggerService.WriteCallerLine($"{nameof(csEvidence)} can't be null."); return(null); } var fileTuple = FileSystemService.Current.MountedUnits?.FirstOrDefault(p => p.GUID == csEvidence.EvidenceGUID); if (fileTuple == null) { LoggerService.WriteCallerLine($"{nameof(fileTuple)} can't be null."); return(null); } if (fileTuple.File is IStreamFile streamFile) { return(streamFile); } return(null); }
public void AddUnit(ITreeUnit parentUnit, ITreeUnit nUnit) { if (nUnit == null) { throw new ArgumentNullException($"{nameof(nUnit)}"); } ThreadInvoker.UIInvoke(() => { if (parentUnit == null) { VM.AddUnit(nUnit); } else { parentUnit.Children.Add(nUnit); } }); try { CommonEventHelper.GetEvent <TreeUnitAddedEvent>().Publish((nUnit, this)); CommonEventHelper.PublishEventToHandlers((nUnit, this as ITreeService), _treeUnitAddedEventHandlers); } catch (Exception ex) { LoggerService.WriteCallerLine(ex.Message); } }
public void NotifySelectedUnitChanged(ITreeUnit unit) { if (unit.TypeGuid == Constants.DBUnitType_Table) { var dt = GetDataTable($"Select* from { unit.Label}"); BrowseTableSource?.Dispose(); BrowseTableSource = dt; } }
private void HandleOnFileSystemUnit(ITreeUnit unit) { var file = unit?.GetInstance <IFile>(Contracts.FileExplorer.Constants.TreeUnitTag_FileSystem_File); if (!(file is IHaveFileCollection haveFileCollection)) { return; } HandleOnFileCollection(haveFileCollection); }
private void VM_UnitRightClicked(object sender, ITreeUnit e) { if (sender != VM) { return; } try { CommonEventHelper.GetEvent <TreeUnitRightClicked>().Publish((e, this as ITreeService)); CommonEventHelper.PublishEventToHandlers((e, this as ITreeService), _treeUnitRightClickeEventHandlers); } catch (Exception ex) { LoggerService.WriteCallerLine(ex.Message); } }
public static IStreamFile GetStreamFileFromInnerFileUnit(ITreeUnit treeUnit) { var file = treeUnit.GetInstance <IFile>(Contracts.FileExplorer.Constants.TreeUnitTag_InnerFile); if (file == null) { LoggerService.WriteCallerLine($"{nameof(file)} can't be null."); return(null); } if (file is IStreamFile streamFile) { return(streamFile); } return(null); }
private void HandleOnInnerFileUnit(ITreeUnit unit) { var innerFile = unit.GetInstance <IFile>(Contracts.FileExplorer.Constants.TreeUnitTag_InnerFile); if (innerFile == null) { LoggerService.WriteCallerLine($"{nameof(innerFile)} can't be null."); return; } if (!(innerFile is IHaveFileCollection haveFileCollection)) { LoggerService.WriteCallerLine($"{nameof(haveFileCollection)} can't be null."); return; } HandleOnFileCollection(haveFileCollection); }
/// <summary> /// 添加取证信息节点; /// </summary> /// <param name="cFile"></param> public void AddForensicUnit(ICaseEvidence cFile) { ITreeUnit fUnit = null; var caseService = ServiceProvider.Current.GetInstance <ICaseService>(); if (caseService == null) { LoggerService.Current?.WriteCallerLine($"{nameof(caseService)} can't be null!"); } ThreadInvoker.UIInvoke(() => { var tUnit = GetCaseFileUnit(cFile); if (tUnit != null) { fUnit = TreeUnitFactory.Current.CreateNew(Constants.ForensicInfoUnit); fUnit.Label = FindResourceString("ForensicInfo"); tUnit.Children.Add(fUnit); } }); }
//移除unit; public void RemoveUnit(ITreeUnit unit) { if (unit == null) { throw new ArgumentNullException(nameof(unit)); } if (unit.Parent != null) { unit.Parent.Children.Remove(unit); } else if (VM.TreeUnits.Contains(unit)) { VM.TreeUnits.Remove(unit); } else { var ex = new InvalidOperationException($"The tree unit is not contained in the list:{unit.TypeGuid}."); LoggerService.WriteCallerLine(ex.Message); throw ex; } CommonEventHelper.GetEvent <TreeUnitRemovedEvent>().Publish((unit, this)); }
public void AddUnit(ITreeUnit unit) { TreeUnits.Add(unit); }
public void NotifySelectionUnitChanged(ITreeUnit unit) { SelectedUnit = unit; SelectedUnitChanged?.Invoke(this, unit); }
protected void NotifyUnitExpand(ITreeUnit unit) { NotifyUnitExpanded?.Invoke(this, unit); }