private void AddIfPresent(ISegment segment) { if (segment != null) { _segments.Add(segment, 4); } }
/// <summary> /// Adds a debug data entry to the buffer. /// </summary> /// <param name="entry">The entry.</param> public void AddEntry(DebugDataEntry entry) { _headers.Add(entry); if (entry.Contents != null) { _streamsTable.Add(entry.Contents, 4); } }
/// <summary> /// Adds a CIL method body to the buffer. /// </summary> /// <param name="body">The method body to add.</param> public void AddCilBody(CilRawMethodBody body) { if (body.IsFat) { _fatBodies.Add(body, 4); } else { _tinyBodies.Add(body); } }
/// <summary> /// Creates a new .NET segment buffer. /// </summary> /// <param name="dotNetDirectory">The .NET directory to base it on.</param> public DotNetSegmentBuffer(IDotNetDirectory dotNetDirectory) { _segments = new SegmentBuilder { (DotNetDirectory = dotNetDirectory), (FieldRvaTable = new SegmentBuilder()), (MethodBodyTable = new MethodBodyTableBuffer()) }; AddIfPresent(dotNetDirectory.Metadata); AddIfPresent(dotNetDirectory.DotNetResources); AddIfPresent(dotNetDirectory.StrongName); if (dotNetDirectory.VTableFixups?.Count > 0) { _segments.Add(new VTableFixupsDirectoryBuffer(dotNetDirectory.VTableFixups)); } AddIfPresent(dotNetDirectory.ExportAddressTable); AddIfPresent(dotNetDirectory.ManagedNativeHeader); }
/// <summary> /// Adds a native method body to the buffer. /// </summary> /// <param name="body">The method body to add.</param> /// <param name="alignment">The byte-boundary to align the body to.</param> public void AddNativeBody(ISegment body, uint alignment) => _nativeBodies.Add(body, alignment);
/// <summary> /// Creates a new method body table buffer. /// </summary> public MethodBodyTableBuffer() { _segments.Add(_tinyBodies); _segments.Add(_fatBodies); _segments.Add(_nativeBodies); }