Beispiel #1
0
        HexBuffer GetOrCreate(string filename)
        {
            if (!File.Exists(filename))
            {
                return(null);
            }
            filename = GetFullPath(filename);

            HexBuffer buffer;

            lock (lockObj) {
                buffer = TryGet_NoLock(filename);
                if (buffer != null)
                {
                    return(buffer);
                }

                byte[] data;
                try {
                    data = File.ReadAllBytes(filename);
                }
                catch {
                    return(null);
                }

                buffer = hexBufferFactoryService.Create(data, filename, hexBufferFactoryService.DefaultFileTags);
                filenameToBuffer[filename] = new WeakReference(buffer);
            }
            return(NotifyBufferCreated(buffer));
        }
Beispiel #2
0
 MemoryVM(ITheDebugger theDebugger, HexBufferFactoryService hexBufferFactoryService, HexBufferStreamFactoryService hexBufferStreamFactoryService)
 {
     this.theDebugger = theDebugger;
     this.hexBufferStreamFactoryService = hexBufferStreamFactoryService;
     debuggerStream = new DebuggerHexBufferStream();
     debuggerStream.UnderlyingStreamChanged += DebuggerStream_UnderlyingStreamChanged;
     Buffer = hexBufferFactoryService.Create(debuggerStream, hexBufferFactoryService.DefaultMemoryTags, disposeStream: true);
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
     InitializeHexStream();
 }
        // UI thread
        public override IHexBufferInfo CreateBuffer()
        {
            uiDispatcher.VerifyAccess();
            var debuggerHexBufferStream = new DebuggerHexBufferStream();
            var buffer      = hexBufferFactoryService.Create(debuggerHexBufferStream, hexBufferFactoryService.DefaultMemoryTags, disposeStream: true);
            var bufferState = new BufferState(buffer, debuggerHexBufferStream);

            bufferStates.Add(bufferState);
            buffer.Disposed           += Buffer_Disposed;
            buffer.ChangedLowPriority += Buffer_ChangedLowPriority;
            var info = processInfos.FirstOrDefault();

            bufferState.SetUnderlyingStream(info?.Stream, info?.Process);
            HexBufferInfoCreated?.Invoke(this, new HexBufferInfoCreatedEventArgs(bufferState));
            return(bufferState);
        }
Beispiel #4
0
 DebuggerHexBufferStreamProvider(HexBufferFactoryService hexBufferFactoryService, HexBufferStreamFactoryService hexBufferStreamFactoryService)
 {
     this.hexBufferStreamFactoryService = hexBufferStreamFactoryService;
     DebuggerHexBufferStream            = new DebuggerHexBufferStream();
     Buffer = hexBufferFactoryService.Create(DebuggerHexBufferStream, hexBufferFactoryService.DefaultMemoryTags, disposeStream: true);
 }