Interface IRawFile
Namespace: PeNet.FileParser
Assembly: PeNet.dll
Syntax
public interface IRawFile
Properties
| Improve this Doc View SourceLength
Get the length of the unerlying PE file in bytes.
Declaration
long Length { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
| Improve this Doc View SourceAppendBytes(Span<Byte>)
Appends the given bytes to the current raw file. The file growths by the size of the given span.
Declaration
int AppendBytes(Span<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
Span<System.Byte> | bytes | Bytes to append. |
Returns
Type | Description |
---|---|
System.Int32 | Raw start address of the appended bytes. |
AsSpan(Int64, Int64)
Get a Span from the underlying file.
Declaration
Span<byte> AsSpan(long offset, long length)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Start offset of the span. |
System.Int64 | length | Length of the span in byte. |
Returns
Type | Description |
---|---|
Span<System.Byte> |
ReadAsciiString(Int64)
Read a ASCII (zero-terminated, one byte per character) string at a given offset.
Declaration
string ReadAsciiString(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Start offset of the string. |
Returns
Type | Description |
---|---|
System.String | Parsed C string. |
ReadByte(Int64)
Read a byte at the given offset.
Declaration
byte ReadByte(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to read from. |
Returns
Type | Description |
---|---|
System.Byte | Byte at given offset. |
ReadUInt(Int64)
Read an unsigned integer (four bytes) at the given offset.
Declaration
uint ReadUInt(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to read from. |
Returns
Type | Description |
---|---|
System.UInt32 | UInt at given offset. |
ReadULong(Int64)
Read an unsigned long (eight bytes) at the given offset.
Declaration
ulong ReadULong(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to read from. |
Returns
Type | Description |
---|---|
System.UInt64 | ULong at given offset. |
ReadUnicodeString(Int64)
Read an unicode (two byte per char) string at a given offset.
Declaration
string ReadUnicodeString(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Start offset of the string. |
Returns
Type | Description |
---|---|
System.String | Parsed unicode string. |
ReadUnicodeString(Int64, Int64)
Read an unicode (two byte per char) string at a given offset of a given length.
Declaration
string ReadUnicodeString(long offset, long length)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Start offset of the string. |
System.Int64 | length | Number of unicode chars to read. |
Returns
Type | Description |
---|---|
System.String | Parsed unicode string. |
ReadUShort(Int64)
Read an unsigned short (two bytes) at the given offset.
Declaration
ushort ReadUShort(long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to read from. |
Returns
Type | Description |
---|---|
System.UInt16 | UShort at given offset. |
RemoveRange(Int64, Int64)
Remove a byte range from the underlying file.
Declaration
void RemoveRange(long offset, long length)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset of the range to remove. |
System.Int64 | length | Length of the range to remove. |
ToArray()
Get the underlying file as a byte array.
Declaration
byte[] ToArray()
Returns
Type | Description |
---|---|
System.Byte[] | Byte array representation fo the file. |
WriteByte(Int64, Byte)
Write a byte at a given offset.
Declaration
void WriteByte(long offset, byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to write to. |
System.Byte | value | Byte value to write. |
WriteBytes(Int64, Span<Byte>)
Write a byte sequence to a given offset.
Declaration
void WriteBytes(long offset, Span<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Start offset to write to. |
Span<System.Byte> | bytes | Byte sequence to write. |
WriteUInt(Int64, UInt32)
Write a uint at a given offset.
Declaration
void WriteUInt(long offset, uint value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to write to. |
System.UInt32 | value | UInt value to write. |
WriteULong(Int64, UInt64)
Write a ulong at a given offset.
Declaration
void WriteULong(long offset, ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to write to. |
System.UInt64 | value | ULong value to write. |
WriteUShort(Int64, UInt16)
Write a ushort at a given offset.
Declaration
void WriteUShort(long offset, ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset to write to. |
System.UInt16 | value | UShort value to write. |