Exemple #1
0
 /// <summary>
 /// Builds a memory map for a tag.
 /// </summary>
 /// <param name="data">The tag data to build a memory map for.</param>
 /// <returns>The built map.</returns>
 private static MemoryMap BuildTagMap(TagData data)
 {
     // Create a memory map with a boundary at each fixup target
     // and at the main structure
     var result = new MemoryMap(0, (uint)data.Data.Length);
     result.AddBoundary(data.MainStructOffset);
     result.AddBoundaries(data.PointerFixups.Select(f => f.TargetOffset));
     return result;
 }
Exemple #2
0
 public TagLayoutGuess Analyze(TagData data)
 {
     _tagMap = BuildTagMap(data);
     _dataFixupsByWriteOffset = data.PointerFixups.ToDictionary(f => f.WriteOffset);
     _resourceFixupsByWriteOffset = new HashSet<uint>(data.ResourcePointerOffsets);
     using (var reader = new BinaryReader(new MemoryStream(data.Data)))
     {
         reader.BaseStream.Position = data.MainStructOffset;
         return AnalyzeStructure(reader, 1);
     }
 }