Show / Hide Table of Contents

Class BufferFile

Inheritance
object
BufferFile
Implements
IRawFile
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: PeNet.FileParser
Assembly: PeNet.dll
Syntax
public class BufferFile : IRawFile

Constructors

| Edit this page View Source

BufferFile(byte[])

Declaration
public BufferFile(byte[] file)
Parameters
Type Name Description
byte[] file

Properties

| Edit this page View Source

Length

Get the length of the unerlying PE file in bytes.

Declaration
public long Length { get; }
Property Value
Type Description
long

Methods

| Edit this page View Source

AppendBytes(Span<byte>)

Appends the given bytes to the current raw file. The file growths by the size of the given span.

Declaration
public int AppendBytes(Span<byte> bytes)
Parameters
Type Name Description
Span<byte> bytes

Bytes to append.

Returns
Type Description
int

Raw start address of the appended bytes.

| Edit this page View Source

AsSpan(long, long)

Get a Span from the underlying file.

Declaration
public Span<byte> AsSpan(long offset, long length)
Parameters
Type Name Description
long offset

Start offset of the span.

long length

Length of the span in byte.

Returns
Type Description
Span<byte>
| Edit this page View Source

ReadAsciiString(long)

Read a ASCII (zero-terminated, one byte per character) string at a given offset.

Declaration
public string ReadAsciiString(long offset)
Parameters
Type Name Description
long offset

Start offset of the string.

Returns
Type Description
string

Parsed C string.

| Edit this page View Source

ReadByte(long)

Read a byte at the given offset.

Declaration
public byte ReadByte(long offset)
Parameters
Type Name Description
long offset

Offset to read from.

Returns
Type Description
byte

Byte at given offset.

| Edit this page View Source

ReadUInt(long)

Read an unsigned integer (four bytes) at the given offset.

Declaration
public uint ReadUInt(long offset)
Parameters
Type Name Description
long offset

Offset to read from.

Returns
Type Description
uint

UInt at given offset.

| Edit this page View Source

ReadULong(long)

Read an unsigned long (eight bytes) at the given offset.

Declaration
public ulong ReadULong(long offset)
Parameters
Type Name Description
long offset

Offset to read from.

Returns
Type Description
ulong

ULong at given offset.

| Edit this page View Source

ReadUShort(long)

Read an unsigned short (two bytes) at the given offset.

Declaration
public ushort ReadUShort(long offset)
Parameters
Type Name Description
long offset

Offset to read from.

Returns
Type Description
ushort

UShort at given offset.

| Edit this page View Source

ReadUnicodeString(long)

Read an unicode (two byte per char) string at a given offset.

Declaration
public string ReadUnicodeString(long offset)
Parameters
Type Name Description
long offset

Start offset of the string.

Returns
Type Description
string

Parsed unicode string.

| Edit this page View Source

ReadUnicodeString(long, long)

Read an unicode (two byte per char) string at a given offset of a given length.

Declaration
public string ReadUnicodeString(long offset, long length)
Parameters
Type Name Description
long offset

Start offset of the string.

long length

Number of unicode chars to read.

Returns
Type Description
string

Parsed unicode string.

| Edit this page View Source

RemoveRange(long, long)

Remove a byte range from the underlying file.

Declaration
public void RemoveRange(long offset, long length)
Parameters
Type Name Description
long offset

Offset of the range to remove.

long length

Length of the range to remove.

| Edit this page View Source

ToArray()

Get the underlying file as a byte array.

Declaration
public byte[] ToArray()
Returns
Type Description
byte[]

Byte array representation fo the file.

| Edit this page View Source

WriteByte(long, byte)

Write a byte at a given offset.

Declaration
public void WriteByte(long offset, byte value)
Parameters
Type Name Description
long offset

Offset to write to.

byte value

Byte value to write.

| Edit this page View Source

WriteBytes(long, Span<byte>)

Write a byte sequence to a given offset.

Declaration
public void WriteBytes(long offset, Span<byte> bytes)
Parameters
Type Name Description
long offset

Start offset to write to.

Span<byte> bytes

Byte sequence to write.

| Edit this page View Source

WriteUInt(long, uint)

Write a uint at a given offset.

Declaration
public void WriteUInt(long offset, uint value)
Parameters
Type Name Description
long offset

Offset to write to.

uint value

UInt value to write.

| Edit this page View Source

WriteULong(long, ulong)

Write a ulong at a given offset.

Declaration
public void WriteULong(long offset, ulong value)
Parameters
Type Name Description
long offset

Offset to write to.

ulong value

ULong value to write.

| Edit this page View Source

WriteUShort(long, ushort)

Write a ushort at a given offset.

Declaration
public void WriteUShort(long offset, ushort value)
Parameters
Type Name Description
long offset

Offset to write to.

ushort value

UShort value to write.

Implements

IRawFile

Extension Methods

ExtensionMethods.Is32Bit(IRawFile)
ExtensionMethods.Is64Bit(IRawFile)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX