Пример #1
0
 public override byte[] ReadBytes(HexPosition position, long length)
 {
     CheckDisposed();
     if (stream != null)
     {
         return(stream.ReadBytes(position, length));
     }
     return(new byte[length]);
 }
Пример #2
0
        public override void Read(IntPtr hProcess, HexPosition position, byte[] destination, long destinationIndex, long length)
        {
            if (hProcess == IntPtr.Zero)
            {
                throw new ArgumentException();
            }
            if (position >= HexPosition.MaxEndPosition)
            {
                throw new ArgumentOutOfRangeException(nameof(position));
            }
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (destinationIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(destinationIndex));
            }
            if (length < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length));
            }
            if (new HexPosition(destinationIndex) + length > destination.LongLength)
            {
                throw new ArgumentOutOfRangeException(nameof(length));
            }
            HexSimpleBufferStream processStream = null;
            HexBufferStream       cachedStream  = null;

            try {
                processStream = hexBufferStreamFactoryService.CreateSimpleProcessStream(hProcess);
                cachedStream  = hexBufferStreamFactoryService.CreateCached(processStream, disposeStream: false);
                cachedStream.ReadBytes(position, destination, destinationIndex, length);
            }
            finally {
                processStream?.Dispose();
                cachedStream?.Dispose();
            }
        }
Пример #3
0
 public override byte[] ReadBytes(HexPosition position, long length) => stream.ReadBytes(position, length);
Пример #4
0
 public override void ReadBytes(HexPosition position, byte[] destination, long destinationIndex, long length)
 {
     CheckDisposed();
     stream?.ReadBytes(position, destination, destinationIndex, length);
 }
Пример #5
0
 public override byte[] ReadBytes(HexPosition position, long length) => length == 0 ? Array.Empty <byte>() : stream.ReadBytes(position, length);