本文整理汇总了C#中Blamite.IO.FileSegmentGroup.FindSegmentWithPointer方法的典型用法代码示例。如果您正苦于以下问题:C# FileSegmentGroup.FindSegmentWithPointer方法的具体用法?C# FileSegmentGroup.FindSegmentWithPointer怎么用?C# FileSegmentGroup.FindSegmentWithPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blamite.IO.FileSegmentGroup
的用法示例。
在下文中一共展示了FileSegmentGroup.FindSegmentWithPointer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromPointer
/// <summary>
/// Given a pointer, creates a SegmentPointer which points to a segment in a certain group.
/// </summary>
/// <param name="pointer">The pointer to create a SegmentPointer to.</param>
/// <param name="baseGroup">The segment group containing the pointer.</param>
/// <returns>The SegmentPointer corresponding to the file pointer.</returns>
public static SegmentPointer FromPointer(uint pointer, FileSegmentGroup baseGroup)
{
if (baseGroup.Segments.Count == 0)
throw new ArgumentException("Cannot create a SegmentPointer from an empty group");
FileSegment baseSegment = baseGroup.FindSegmentWithPointer(pointer);
if (baseSegment == null)
throw new ArgumentException("Cannot create a SegmentPointer from an invalid pointer");
int baseSegmentDelta = (int)(baseGroup.PointerToOffset(pointer) - baseSegment.Offset);
return new SegmentPointer(baseSegment, baseGroup, baseSegmentDelta);
}