public static void SetEndOffset(SegmentCommand segmentCommand, uint endOffset) { if (segmentCommand is SegmentCommand32) { SegmentCommand32 segmentCommand32 = (SegmentCommand32)segmentCommand; segmentCommand32.FileSize = endOffset - segmentCommand32.FileOffset; } else if (segmentCommand is SegmentCommand64) { SegmentCommand64 segmentCommand64 = (SegmentCommand64)segmentCommand; segmentCommand64.FileSize = endOffset - segmentCommand64.FileOffset; } }
public static SegmentCommand FindLinkEditSegment(List <LoadCommand> loadCommands) { foreach (LoadCommand loadCommand in loadCommands) { if (loadCommand is SegmentCommand) { SegmentCommand segmentCommand = (SegmentCommand)loadCommand; if (segmentCommand.SegmentName == LinkEditSegmentName) { return(segmentCommand); } } } return(null); }