C# Класс dnSpy.Contracts.Hex.HexBuffer

Hex buffer
Наследование: Microsoft.VisualStudio.Utilities.IPropertyOwner, IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
DisposeCore ( ) : void

Disposes this instance

HexBuffer ( HexTags tags ) : System

Constructor

Приватные методы

Метод Описание
GetStartOfData ( HexPosition start, bool validData ) : HexPosition
GetStartOfDataCore ( HexPosition start, bool validData ) : HexPosition

Описание методов

CheckEditAccess() публичный абстрактный Метод

Returns true if the current thread is allowed to modify the buffer
public abstract CheckEditAccess ( ) : bool
Результат bool

CreateEdit() публичный абстрактный Метод

Creates a HexEdit object
public abstract CreateEdit ( ) : dnSpy.Contracts.Hex.HexEdit
Результат dnSpy.Contracts.Hex.HexEdit

CreateEdit() публичный абстрактный Метод

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
Результат dnSpy.Contracts.Hex.HexEdit

Dispose() публичный Метод

Disposes this instance
public Dispose ( ) : void
Результат void

DisposeCore() защищенный Метод

Disposes this instance
protected DisposeCore ( ) : void
Результат void

GetNextValidSpan() публичный Метод

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.
Результат HexSpan?

GetNextValidSpan() публичный Метод

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.
Результат HexSpan?

GetPreviousValidSpan() публичный Метод

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.
Результат HexSpan?

GetPreviousValidSpan() публичный Метод

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.
Результат HexSpan?

GetSpanInfo() публичный абстрактный Метод

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
Результат HexSpanInfo

GetValidSpans() публичный Метод

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
Результат IEnumerable

GetValidSpans() публичный Метод

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.
Результат IEnumerable

HexBuffer() защищенный Метод

Constructor
protected HexBuffer ( HexTags tags ) : System
tags HexTags
Результат System

ReadByte() публичный абстрактный Метод

Reads a byte
public abstract ReadByte ( HexPosition position ) : byte
position HexPosition Position
Результат byte

ReadBytes() публичный абстрактный Метод

Reads bytes
public abstract ReadBytes ( HexPosition position, long length ) : byte[]
position HexPosition Position
length long Number of bytes to read
Результат byte[]

ReadBytes() публичный абстрактный Метод

Reads bytes
public abstract ReadBytes ( HexPosition position, ulong length ) : byte[]
position HexPosition Position
length ulong Number of bytes to read
Результат byte[]

ReadBytes() публичный абстрактный Метод

Reads bytes
public abstract ReadBytes ( HexSpan span ) : byte[]
span HexSpan Span
Результат byte[]

ReadBytes() публичный Метод

Reads bytes
public ReadBytes ( HexPosition position, byte destination ) : void
position HexPosition Position
destination byte Destination array
Результат void

ReadBytes() публичный абстрактный Метод

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
Результат void

ReadDouble() публичный абстрактный Метод

Reads a double
public abstract ReadDouble ( HexPosition position ) : double
position HexPosition Position
Результат double

ReadHexBytes() публичный абстрактный Метод

Reads bytes
public abstract ReadHexBytes ( HexPosition position, long length ) : dnSpy.Contracts.Hex.HexBytes
position HexPosition Position
length long Length
Результат dnSpy.Contracts.Hex.HexBytes

ReadInt16() публичный абстрактный Метод

Reads a short
public abstract ReadInt16 ( HexPosition position ) : short
position HexPosition Position
Результат short

ReadInt32() публичный абстрактный Метод

Reads a int
public abstract ReadInt32 ( HexPosition position ) : int
position HexPosition Position
Результат int

ReadInt64() публичный абстрактный Метод

Reads a long
public abstract ReadInt64 ( HexPosition position ) : long
position HexPosition Position
Результат long

ReadSByte() публичный абстрактный Метод

Reads a sbyte
public abstract ReadSByte ( HexPosition position ) : sbyte
position HexPosition Position
Результат sbyte

ReadSingle() публичный абстрактный Метод

Reads a float
public abstract ReadSingle ( HexPosition position ) : float
position HexPosition Position
Результат float

ReadUInt16() публичный абстрактный Метод

Reads a ushort
public abstract ReadUInt16 ( HexPosition position ) : ushort
position HexPosition Position
Результат ushort

ReadUInt32() публичный абстрактный Метод

Reads a uint
public abstract ReadUInt32 ( HexPosition position ) : uint
position HexPosition Position
Результат uint

ReadUInt64() публичный абстрактный Метод

Reads a ulong
public abstract ReadUInt64 ( HexPosition position ) : ulong
position HexPosition Position
Результат ulong

Refresh() публичный абстрактный Метод

Clears any read caches and raises BufferSpanInvalidated if needed
public abstract Refresh ( ) : void
Результат void

Replace() публичный Метод

Replaces the byte at position with value
public Replace ( HexPosition position, byte value ) : void
position HexPosition Position
value byte New value
Результат void

Replace() публичный Метод

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
Результат void

Replace() публичный Метод

Replaces the double at position with value
public Replace ( HexPosition position, double value ) : void
position HexPosition Position
value double New value
Результат void

Replace() публичный Метод

Replaces the float at position with value
public Replace ( HexPosition position, float value ) : void
position HexPosition Position
value float New value
Результат void

Replace() публичный Метод

Replaces the int at position with value
public Replace ( HexPosition position, int value ) : void
position HexPosition Position
value int New value
Результат void

Replace() публичный Метод

Replaces the long at position with value
public Replace ( HexPosition position, long value ) : void
position HexPosition Position
value long New value
Результат void

Replace() публичный Метод

Replaces the sbyte at position with value
public Replace ( HexPosition position, sbyte value ) : void
position HexPosition Position
value sbyte New value
Результат void

Replace() публичный Метод

Replaces the short at position with value
public Replace ( HexPosition position, short value ) : void
position HexPosition Position
value short New value
Результат void

Replace() публичный Метод

Replaces the uint at position with value
public Replace ( HexPosition position, uint value ) : void
position HexPosition Position
value uint New value
Результат void

Replace() публичный Метод

Replaces the ulong at position with value
public Replace ( HexPosition position, ulong value ) : void
position HexPosition Position
value ulong New value
Результат void

Replace() публичный Метод

Replaces the ushort at position with value
public Replace ( HexPosition position, ushort value ) : void
position HexPosition Position
value ushort New value
Результат void

TakeThreadOwnership() публичный абстрактный Метод

Claims ownership of this buffer for the current thread
public abstract TakeThreadOwnership ( ) : void
Результат void

TryReadByte() публичный абстрактный Метод

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
Результат int