コード例 #1
0
 private void AddIfPresent(ISegment segment)
 {
     if (segment != null)
     {
         _segments.Add(segment, 4);
     }
 }
コード例 #2
0
 /// <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);
     }
 }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 /// <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);
コード例 #6
0
 /// <summary>
 /// Creates a new method body table buffer.
 /// </summary>
 public MethodBodyTableBuffer()
 {
     _segments.Add(_tinyBodies);
     _segments.Add(_fatBodies);
     _segments.Add(_nativeBodies);
 }