Class Extensions
- Namespace
- AsmResolver
- Assembly
- AsmResolver.dll
Provides various extensions to AsmResolver related types.
public static class Extensions
- Inheritance
-
Extensions
- Inherited Members
Methods
Align(uint, uint)
Rounds the provided unsigned integer up to the nearest multiple of the provided alignment.
public static uint Align(this uint value, uint alignment)
Parameters
Returns
- uint
The aligned value.
Align(ulong, ulong)
Rounds the provided unsigned integer up to the nearest multiple of the provided alignment.
public static ulong Align(this ulong value, ulong alignment)
Parameters
Returns
- ulong
The aligned value.
AsPatchedSegment(ISegment)
Wraps the provided segment into a PatchedSegment, making it eligible for applying post-serialization patches.
public static PatchedSegment AsPatchedSegment(this ISegment segment)
Parameters
segmentISegmentThe segment to wrap.
Returns
- PatchedSegment
The wrapped segment, or
segmentif it is already an instance of PatchedSegment.
AsPatchedSegment(ISegment, bool)
Wraps the provided segment into a PatchedSegment, making it eligible for applying post-serialization patches.
public static PatchedSegment AsPatchedSegment(this ISegment segment, bool alwaysCreateNew)
Parameters
segmentISegmentThe segment to wrap.
alwaysCreateNewboolIndicates whether the segment should always be wrapped into a new instance of PatchedSegment, regardless of whether
segmentis already an instance of PatchedSegment or not.
Returns
- PatchedSegment
The wrapped segment, or
segmentif it is already an instance of PatchedSegment andalwaysCreateNewis set totrue.
CreateEscapedString(string)
Converts a string into an escaped string literal.
public static string CreateEscapedString(this string literal)
Parameters
literalstringThe string to convert.
Returns
- string
The escaped string.
CreateReader(IReadableSegment)
Creates a new binary reader that reads the raw contents of the segment.
public static BinaryStreamReader CreateReader(this IReadableSegment segment)
Parameters
segmentIReadableSegmentThe segment to read from.
Returns
- BinaryStreamReader
The created binary reader.
CreateReader(IReadableSegment, ulong)
Creates a new binary reader that reads the raw contents of the segment.
public static BinaryStreamReader CreateReader(this IReadableSegment segment, ulong fileOffset)
Parameters
segmentIReadableSegmentThe segment to read from.
fileOffsetulongThe starting file offset of the reader.
Returns
- BinaryStreamReader
The created binary reader.
Get7BitEncodedSize(uint)
Computes the number of bytes the provided integer would require after compressing it using the integer compression using the 7-bit encoding.
public static uint Get7BitEncodedSize(this uint value)
Parameters
valueuintThe integer to determine the compressed size of.
Returns
- uint
The number of bytes the value would require.
GetBinaryFormatterSize(string)
Computes the number of bytes required to represent the provided string as a binary formatted string.
public static uint GetBinaryFormatterSize(this string value)
Parameters
valuestringThe string to measure.
Returns
- uint
The number of bytes.
GetBinaryFormatterSize(string, Encoding)
Computes the number of bytes required to represent the provided string as a binary formatted string.
public static uint GetBinaryFormatterSize(this string value, Encoding encoding)
Parameters
Returns
- uint
The number of bytes.
GetCompressedSize(uint)
Computes the number of bytes the provided integer would require after compressing it using the integer compression as specified in ECMA-335.
public static uint GetCompressedSize(this uint value)
Parameters
valueuintThe integer to determine the compressed size of.
Returns
- uint
The number of bytes the value would require.
ToArray(IReadableSegment)
Reads the segment and puts the data in a byte array.
public static byte[] ToArray(this IReadableSegment segment)
Parameters
segmentIReadableSegmentThe segment to read.
Returns
- byte[]
The byte array that was read.
ToReference(ISegment)
Constructs a reference to the start of the segment.
public static ISegmentReference ToReference(this ISegment segment)
Parameters
segmentISegmentThe segment to reference.
Returns
- ISegmentReference
The reference.
ToReference(ISegment, int)
Constructs a reference to an offset within the segment.
public static ISegmentReference ToReference(this ISegment segment, int additive)
Parameters
Returns
- ISegmentReference
The reference.
WriteIntoArray(ISegment)
Serializes the segment by calling Write(BinaryStreamWriter) and writes the result into a byte array.
public static byte[] WriteIntoArray(this ISegment segment)
Parameters
segmentISegmentThe segment to serialize to
Returns
- byte[]
The resulting byte array.
WriteIntoArray(ISegment, MemoryStreamWriterPool)
Serializes the segment by calling Write(BinaryStreamWriter) and writes the result into a byte array.
public static byte[] WriteIntoArray(this ISegment segment, MemoryStreamWriterPool pool)
Parameters
segmentISegmentThe segment to serialize to
poolMemoryStreamWriterPoolThe memory stream writer pool to rent temporary writers from.
Returns
- byte[]
The resulting byte array.