本文整理汇总了C#中FileOffset.AlignUp方法的典型用法代码示例。如果您正苦于以下问题:C# FileOffset.AlignUp方法的具体用法?C# FileOffset.AlignUp怎么用?C# FileOffset.AlignUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileOffset
的用法示例。
在下文中一共展示了FileOffset.AlignUp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateRvasAndFileOffsets
/// <summary>
/// Calculates <see cref="RVA"/> and <see cref="FileOffset"/> of all <see cref="IChunk"/>s
/// </summary>
/// <param name="chunks">All chunks</param>
/// <param name="offset">Starting file offset</param>
/// <param name="rva">Starting RVA</param>
/// <param name="fileAlignment">File alignment</param>
/// <param name="sectionAlignment">Section alignment</param>
protected void CalculateRvasAndFileOffsets(List<IChunk> chunks, FileOffset offset, RVA rva, uint fileAlignment, uint sectionAlignment) {
foreach (var chunk in chunks) {
chunk.SetOffset(offset, rva);
offset += chunk.GetFileLength();
rva += chunk.GetVirtualSize();
offset = offset.AlignUp(fileAlignment);
rva = rva.AlignUp(sectionAlignment);
}
}
示例2: WriteChunks
/// <summary>
/// Writes all chunks to <paramref name="writer"/>
/// </summary>
/// <param name="writer">The writer</param>
/// <param name="chunks">All chunks</param>
/// <param name="offset">File offset of first chunk</param>
/// <param name="fileAlignment">File alignment</param>
protected void WriteChunks(BinaryWriter writer, List<IChunk> chunks, FileOffset offset, uint fileAlignment) {
foreach (var chunk in chunks) {
chunk.VerifyWriteTo(writer);
offset += chunk.GetFileLength();
var newOffset = offset.AlignUp(fileAlignment);
writer.WriteZeros((int)(newOffset - offset));
offset = newOffset;
}
}
示例3: Align
static void Align(ref FileOffset offset, ref RVA rva) {
offset = offset.AlignUp(HH_ALIGNMENT);
rva = rva.AlignUp(HH_ALIGNMENT);
}