C# Class dnSpy.Contracts.Hex.HexBuffer

Hex buffer
Inheritance: Microsoft.VisualStudio.Utilities.IPropertyOwner, IDisposable
Afficher le fichier Open project: 0xd4d/dnSpy Class Usage Examples

Méthodes publiques

Méthode Description
CheckEditAccess ( ) : bool

Returns true if the current thread is allowed to modify the buffer

CreateEdit ( ) : dnSpy.Contracts.Hex.HexEdit

Creates a HexEdit object

CreateEdit ( int reiteratedVersionNumber, object editTag ) : dnSpy.Contracts.Hex.HexEdit

Creates a HexEdit object

Dispose ( ) : void

Disposes this instance

GetNextValidSpan ( HexPosition position, HexPosition upperBounds, bool fullSpan ) : HexSpan?

Gets the next valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.

GetNextValidSpan ( HexPosition position, bool fullSpan ) : HexSpan?

Gets the next valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.

GetPreviousValidSpan ( HexPosition position, HexPosition lowerBounds, bool fullSpan ) : HexSpan?

Gets the previous valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.

GetPreviousValidSpan ( HexPosition position, bool fullSpan ) : HexSpan?

Gets the previous valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.

GetSpanInfo ( HexPosition position ) : HexSpanInfo

Gets information about a position in the buffer. The returned info isn't normalized, there may be consecutive spans with the same flags. It's the responsibility of the caller to merge such spans.

GetValidSpans ( ) : IEnumerable

Gets all valid spans. This could be empty if it's a 0-byte buffer stream. This method merges all consecutive valid spans.

GetValidSpans ( HexSpan span, bool fullSpan ) : IEnumerable

Gets all valid spans overlapping span. This method merges all consecutive valid spans.

ReadByte ( HexPosition position ) : byte

Reads a byte

ReadBytes ( HexPosition position, long length ) : byte[]

Reads bytes

ReadBytes ( HexPosition position, ulong length ) : byte[]

Reads bytes

ReadBytes ( HexSpan span ) : byte[]

Reads bytes

ReadBytes ( HexPosition position, byte destination ) : void

Reads bytes

ReadBytes ( HexPosition position, byte destination, long destinationIndex, long length ) : void

Reads bytes

ReadDouble ( HexPosition position ) : double

Reads a double

ReadHexBytes ( HexPosition position, long length ) : dnSpy.Contracts.Hex.HexBytes

Reads bytes

ReadInt16 ( HexPosition position ) : short

Reads a short

ReadInt32 ( HexPosition position ) : int

Reads a int

ReadInt64 ( HexPosition position ) : long

Reads a long

ReadSByte ( HexPosition position ) : sbyte

Reads a sbyte

ReadSingle ( HexPosition position ) : float

Reads a float

ReadUInt16 ( HexPosition position ) : ushort

Reads a ushort

ReadUInt32 ( HexPosition position ) : uint

Reads a uint

ReadUInt64 ( HexPosition position ) : ulong

Reads a ulong

Refresh ( ) : void

Clears any read caches and raises BufferSpanInvalidated if needed

Replace ( HexPosition position, byte value ) : void

Replaces the byte at position with value

Replace ( HexPosition position, byte data, long index, long length ) : void

Replaces the data at position with data

Replace ( HexPosition position, double value ) : void

Replaces the double at position with value

Replace ( HexPosition position, float value ) : void

Replaces the float at position with value

Replace ( HexPosition position, int value ) : void

Replaces the int at position with value

Replace ( HexPosition position, long value ) : void

Replaces the long at position with value

Replace ( HexPosition position, sbyte value ) : void

Replaces the sbyte at position with value

Replace ( HexPosition position, short value ) : void

Replaces the short at position with value

Replace ( HexPosition position, uint value ) : void

Replaces the uint at position with value

Replace ( HexPosition position, ulong value ) : void

Replaces the ulong at position with value

Replace ( HexPosition position, ushort value ) : void

Replaces the ushort at position with value

TakeThreadOwnership ( ) : void

Claims ownership of this buffer for the current thread

TryReadByte ( HexPosition position ) : int

Tries to read a byte. If there's no data, a value less than 0 is returned.

Méthodes protégées

Méthode Description
DisposeCore ( ) : void

Disposes this instance

HexBuffer ( HexTags tags ) : System

Constructor

Private Methods

Méthode Description
GetStartOfData ( HexPosition start, bool validData ) : HexPosition
GetStartOfDataCore ( HexPosition start, bool validData ) : HexPosition

Method Details

CheckEditAccess() public abstract méthode

Returns true if the current thread is allowed to modify the buffer
public abstract CheckEditAccess ( ) : bool
Résultat bool

CreateEdit() public abstract méthode

Creates a HexEdit object
public abstract CreateEdit ( ) : dnSpy.Contracts.Hex.HexEdit
Résultat dnSpy.Contracts.Hex.HexEdit

CreateEdit() public abstract méthode

Creates a HexEdit object
public abstract CreateEdit ( int reiteratedVersionNumber, object editTag ) : dnSpy.Contracts.Hex.HexEdit
reiteratedVersionNumber int Use by undo/redo to restore a previous version
editTag object Edit tag, can be anything
Résultat dnSpy.Contracts.Hex.HexEdit

Dispose() public méthode

Disposes this instance
public Dispose ( ) : void
Résultat void

DisposeCore() protected méthode

Disposes this instance
protected DisposeCore ( ) : void
Résultat void

GetNextValidSpan() public méthode

Gets the next valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.
public GetNextValidSpan ( HexPosition position, HexPosition upperBounds, bool fullSpan ) : HexSpan?
position HexPosition Start position to check
upperBounds HexPosition End position
fullSpan bool true if positions before should be included /// in the returned result. This could result in worse performance.
Résultat HexSpan?

GetNextValidSpan() public méthode

Gets the next valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.
public GetNextValidSpan ( HexPosition position, bool fullSpan ) : HexSpan?
position HexPosition Start position to check
fullSpan bool true if positions before should be included /// in the returned result. This could result in worse performance.
Résultat HexSpan?

GetPreviousValidSpan() public méthode

Gets the previous valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.
public GetPreviousValidSpan ( HexPosition position, HexPosition lowerBounds, bool fullSpan ) : HexSpan?
position HexPosition Start position to check
lowerBounds HexPosition End position
fullSpan bool true if positions after should be included /// in the returned result. This could result in worse performance.
Résultat HexSpan?

GetPreviousValidSpan() public méthode

Gets the previous valid span or null if there's none left. This includes the input (position) if it happens to lie within this valid span. This method merges all consecutive valid spans.
public GetPreviousValidSpan ( HexPosition position, bool fullSpan ) : HexSpan?
position HexPosition Start position to check
fullSpan bool true if positions after should be included /// in the returned result. This could result in worse performance.
Résultat HexSpan?

GetSpanInfo() public abstract méthode

Gets information about a position in the buffer. The returned info isn't normalized, there may be consecutive spans with the same flags. It's the responsibility of the caller to merge such spans.
public abstract GetSpanInfo ( HexPosition position ) : HexSpanInfo
position HexPosition Position
Résultat HexSpanInfo

GetValidSpans() public méthode

Gets all valid spans. This could be empty if it's a 0-byte buffer stream. This method merges all consecutive valid spans.
public GetValidSpans ( ) : IEnumerable
Résultat IEnumerable

GetValidSpans() public méthode

Gets all valid spans overlapping span. This method merges all consecutive valid spans.
public GetValidSpans ( HexSpan span, bool fullSpan ) : IEnumerable
span HexSpan Span
fullSpan bool true if positions before should be included /// in the returned result. This could result in worse performance.
Résultat IEnumerable

HexBuffer() protected méthode

Constructor
protected HexBuffer ( HexTags tags ) : System
tags HexTags
Résultat System

ReadByte() public abstract méthode

Reads a byte
public abstract ReadByte ( HexPosition position ) : byte
position HexPosition Position
Résultat byte

ReadBytes() public abstract méthode

Reads bytes
public abstract ReadBytes ( HexPosition position, long length ) : byte[]
position HexPosition Position
length long Number of bytes to read
Résultat byte[]

ReadBytes() public abstract méthode

Reads bytes
public abstract ReadBytes ( HexPosition position, ulong length ) : byte[]
position HexPosition Position
length ulong Number of bytes to read
Résultat byte[]

ReadBytes() public abstract méthode

Reads bytes
public abstract ReadBytes ( HexSpan span ) : byte[]
span HexSpan Span
Résultat byte[]

ReadBytes() public méthode

Reads bytes
public ReadBytes ( HexPosition position, byte destination ) : void
position HexPosition Position
destination byte Destination array
Résultat void

ReadBytes() public abstract méthode

Reads bytes
public abstract ReadBytes ( HexPosition position, byte destination, long destinationIndex, long length ) : void
position HexPosition Position
destination byte Destination array
destinationIndex long Index
length long Length
Résultat void

ReadDouble() public abstract méthode

Reads a double
public abstract ReadDouble ( HexPosition position ) : double
position HexPosition Position
Résultat double

ReadHexBytes() public abstract méthode

Reads bytes
public abstract ReadHexBytes ( HexPosition position, long length ) : dnSpy.Contracts.Hex.HexBytes
position HexPosition Position
length long Length
Résultat dnSpy.Contracts.Hex.HexBytes

ReadInt16() public abstract méthode

Reads a short
public abstract ReadInt16 ( HexPosition position ) : short
position HexPosition Position
Résultat short

ReadInt32() public abstract méthode

Reads a int
public abstract ReadInt32 ( HexPosition position ) : int
position HexPosition Position
Résultat int

ReadInt64() public abstract méthode

Reads a long
public abstract ReadInt64 ( HexPosition position ) : long
position HexPosition Position
Résultat long

ReadSByte() public abstract méthode

Reads a sbyte
public abstract ReadSByte ( HexPosition position ) : sbyte
position HexPosition Position
Résultat sbyte

ReadSingle() public abstract méthode

Reads a float
public abstract ReadSingle ( HexPosition position ) : float
position HexPosition Position
Résultat float

ReadUInt16() public abstract méthode

Reads a ushort
public abstract ReadUInt16 ( HexPosition position ) : ushort
position HexPosition Position
Résultat ushort

ReadUInt32() public abstract méthode

Reads a uint
public abstract ReadUInt32 ( HexPosition position ) : uint
position HexPosition Position
Résultat uint

ReadUInt64() public abstract méthode

Reads a ulong
public abstract ReadUInt64 ( HexPosition position ) : ulong
position HexPosition Position
Résultat ulong

Refresh() public abstract méthode

Clears any read caches and raises BufferSpanInvalidated if needed
public abstract Refresh ( ) : void
Résultat void

Replace() public méthode

Replaces the byte at position with value
public Replace ( HexPosition position, byte value ) : void
position HexPosition Position
value byte New value
Résultat void

Replace() public méthode

Replaces the data at position with data
public Replace ( HexPosition position, byte data, long index, long length ) : void
position HexPosition Position
data byte New data
index long Index
length long Length
Résultat void

Replace() public méthode

Replaces the double at position with value
public Replace ( HexPosition position, double value ) : void
position HexPosition Position
value double New value
Résultat void

Replace() public méthode

Replaces the float at position with value
public Replace ( HexPosition position, float value ) : void
position HexPosition Position
value float New value
Résultat void

Replace() public méthode

Replaces the int at position with value
public Replace ( HexPosition position, int value ) : void
position HexPosition Position
value int New value
Résultat void

Replace() public méthode

Replaces the long at position with value
public Replace ( HexPosition position, long value ) : void
position HexPosition Position
value long New value
Résultat void

Replace() public méthode

Replaces the sbyte at position with value
public Replace ( HexPosition position, sbyte value ) : void
position HexPosition Position
value sbyte New value
Résultat void

Replace() public méthode

Replaces the short at position with value
public Replace ( HexPosition position, short value ) : void
position HexPosition Position
value short New value
Résultat void

Replace() public méthode

Replaces the uint at position with value
public Replace ( HexPosition position, uint value ) : void
position HexPosition Position
value uint New value
Résultat void

Replace() public méthode

Replaces the ulong at position with value
public Replace ( HexPosition position, ulong value ) : void
position HexPosition Position
value ulong New value
Résultat void

Replace() public méthode

Replaces the ushort at position with value
public Replace ( HexPosition position, ushort value ) : void
position HexPosition Position
value ushort New value
Résultat void

TakeThreadOwnership() public abstract méthode

Claims ownership of this buffer for the current thread
public abstract TakeThreadOwnership ( ) : void
Résultat void

TryReadByte() public abstract méthode

Tries to read a byte. If there's no data, a value less than 0 is returned.
public abstract TryReadByte ( HexPosition position ) : int
position HexPosition Position
Résultat int