| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System;
- using System.IO;
- namespace Mono.CompilerServices.SymbolWriter
- {
- public class OffsetTable
- {
- [Flags]
- public enum Flags
- {
- IsAspxSource = 1,
- WindowsFileNames = 2
- }
- public const int MajorVersion = 50;
- public const int MinorVersion = 0;
- public const long Magic = 5037318119232611860L;
- public int TotalFileSize;
- public int DataSectionOffset;
- public int DataSectionSize;
- public int CompileUnitCount;
- public int CompileUnitTableOffset;
- public int CompileUnitTableSize;
- public int SourceCount;
- public int SourceTableOffset;
- public int SourceTableSize;
- public int MethodCount;
- public int MethodTableOffset;
- public int MethodTableSize;
- public int TypeCount;
- public int AnonymousScopeCount;
- public int AnonymousScopeTableOffset;
- public int AnonymousScopeTableSize;
- public OffsetTable.Flags FileFlags;
- public int LineNumberTable_LineBase = -1;
- public int LineNumberTable_LineRange = 8;
- public int LineNumberTable_OpcodeBase = 9;
- internal OffsetTable()
- {
- int platform = (int)Environment.OSVersion.Platform;
- if (platform != 4 && platform != 128)
- {
- this.FileFlags |= OffsetTable.Flags.WindowsFileNames;
- }
- }
- internal OffsetTable(BinaryReader reader, int major_version, int minor_version)
- {
- this.TotalFileSize = reader.ReadInt32();
- this.DataSectionOffset = reader.ReadInt32();
- this.DataSectionSize = reader.ReadInt32();
- this.CompileUnitCount = reader.ReadInt32();
- this.CompileUnitTableOffset = reader.ReadInt32();
- this.CompileUnitTableSize = reader.ReadInt32();
- this.SourceCount = reader.ReadInt32();
- this.SourceTableOffset = reader.ReadInt32();
- this.SourceTableSize = reader.ReadInt32();
- this.MethodCount = reader.ReadInt32();
- this.MethodTableOffset = reader.ReadInt32();
- this.MethodTableSize = reader.ReadInt32();
- this.TypeCount = reader.ReadInt32();
- this.AnonymousScopeCount = reader.ReadInt32();
- this.AnonymousScopeTableOffset = reader.ReadInt32();
- this.AnonymousScopeTableSize = reader.ReadInt32();
- this.LineNumberTable_LineBase = reader.ReadInt32();
- this.LineNumberTable_LineRange = reader.ReadInt32();
- this.LineNumberTable_OpcodeBase = reader.ReadInt32();
- this.FileFlags = (OffsetTable.Flags)reader.ReadInt32();
- }
- internal void Write(BinaryWriter bw, int major_version, int minor_version)
- {
- bw.Write(this.TotalFileSize);
- bw.Write(this.DataSectionOffset);
- bw.Write(this.DataSectionSize);
- bw.Write(this.CompileUnitCount);
- bw.Write(this.CompileUnitTableOffset);
- bw.Write(this.CompileUnitTableSize);
- bw.Write(this.SourceCount);
- bw.Write(this.SourceTableOffset);
- bw.Write(this.SourceTableSize);
- bw.Write(this.MethodCount);
- bw.Write(this.MethodTableOffset);
- bw.Write(this.MethodTableSize);
- bw.Write(this.TypeCount);
- bw.Write(this.AnonymousScopeCount);
- bw.Write(this.AnonymousScopeTableOffset);
- bw.Write(this.AnonymousScopeTableSize);
- bw.Write(this.LineNumberTable_LineBase);
- bw.Write(this.LineNumberTable_LineRange);
- bw.Write(this.LineNumberTable_OpcodeBase);
- bw.Write((int)this.FileFlags);
- }
- public override string ToString()
- {
- return string.Format("OffsetTable [{0} - {1}:{2} - {3}:{4}:{5} - {6}:{7}:{8} - {9}]", new object[]
- {
- this.TotalFileSize,
- this.DataSectionOffset,
- this.DataSectionSize,
- this.SourceCount,
- this.SourceTableOffset,
- this.SourceTableSize,
- this.MethodCount,
- this.MethodTableOffset,
- this.MethodTableSize,
- this.TypeCount
- });
- }
- }
- }
|