void OnModuleAddedRemoved(DnModule module, bool added) { if (module.Address == 0 || module.Size == 0) { return; } var service = hexBufferFileServiceFactory.Create(debuggerHexBufferStreamProvider.Buffer); int refCount; var pos = new HexPosition(module.Address); moduleReferences.TryGetValue(pos, out refCount); if (added) { if (refCount == 0) { var tags = module.IsInMemory ? new string[] { PredefinedBufferFileTags.FileLayout } : new string[] { PredefinedBufferFileTags.MemoryLayout }; service.CreateFile(new HexSpan(module.Address, module.Size), module.Name, module.Name, tags); } refCount++; } else { if (refCount == 1) { service.RemoveFiles(new HexSpan(module.Address, module.Size)); } refCount--; } moduleReferences[pos] = refCount; }
public HexFileStructureInfoServiceImpl(HexView hexView, HexBufferFileServiceFactory hexBufferFileServiceFactory, Lazy <HexFileStructureInfoProviderFactory, IOrderable>[] hexFileStructureInfoProviderFactories) { if (hexBufferFileServiceFactory == null) { throw new ArgumentNullException(nameof(hexBufferFileServiceFactory)); } this.hexView = hexView ?? throw new ArgumentNullException(nameof(hexView)); hexBufferFileService = hexBufferFileServiceFactory.Create(hexView.Buffer); this.hexFileStructureInfoProviderFactories = hexFileStructureInfoProviderFactories ?? throw new ArgumentNullException(nameof(hexFileStructureInfoProviderFactories)); }
// UI thread public ModuleListener(HexBufferFileServiceFactory hexBufferFileServiceFactory, IHexBufferInfo hexBufferInfo, UIDispatcher uiDispatcher) { uiDispatcher.VerifyAccess(); this.hexBufferInfo = hexBufferInfo; this.uiDispatcher = uiDispatcher; runtimes = new List <DbgRuntime>(); moduleReferences = new Dictionary <HexPosition, int>(); addedModules = new HashSet <DbgModule>(); hexBufferFileService = hexBufferFileServiceFactory.Create(hexBufferInfo.Buffer); hexBufferInfo.UnderlyingProcessChanged += HexBufferInfo_UnderlyingProcessChanged; hexBufferInfo.Buffer.Disposed += Buffer_Disposed; OnProcessChanged_UI(); }
public DefaultHexStructureInfoProvider(HexView hexView, HexBufferFileServiceFactory hexBufferFileServiceFactory, HexFileStructureInfoServiceFactory hexFileStructureInfoServiceFactory) { if (hexView is null) { throw new ArgumentNullException(nameof(hexView)); } if (hexBufferFileServiceFactory is null) { throw new ArgumentNullException(nameof(hexBufferFileServiceFactory)); } if (hexFileStructureInfoServiceFactory is null) { throw new ArgumentNullException(nameof(hexFileStructureInfoServiceFactory)); } hexBufferFileService = hexBufferFileServiceFactory.Create(hexView.Buffer); hexFileStructureInfoService = hexFileStructureInfoServiceFactory.Create(hexView); }
public void BufferCreated(HexBuffer buffer) { var service = hexBufferFileServiceFactory.Create(buffer); service.CreateFile(buffer.Span, buffer.Name, buffer.Name, Array.Empty <string>()); }