public void Load(string fn) { using (var stream = File.Open(fn, FileMode.Open, FileAccess.Read, FileShare.Read)) { FileSize = stream.Length; // Figure out what the footer looks like using (var br = new BinaryReader(stream, Encoding.UTF8, /*leaveOpen:*/ true)) { // Seek to last 8 bytes. stream.Position = stream.Length - 8; // Read position of footer. long footer_pos = br.ReadInt64(); // Stash length of compressed data preceding the footer. FooterPosition = footer_pos; stream.Position = footer_pos; // Slurp in the serialized footer. uint magic = br.ReadUInt32(); Version = Array.IndexOf(AllMagics, magic); if (Version == -1) { throw new IOException(String.Format("Expected decorated stream magic {0:x8}, got {1:x8}. Old file?", V2Magic, magic)); } PlatformName = br.ReadString(); PointerSizeBytes = br.ReadInt32(); EventCount = br.ReadInt64(); WireSizeBytes = br.ReadInt64(); SourceMachine = br.ReadString(); MaxTimeStamp = br.ReadUInt64(); TimerFrequency = br.ReadUInt64(); EncodedDataSizeBytes = br.ReadInt64(); { int modcount = br.ReadInt32(); Modules = new List <ModuleInfo>(modcount); for (int i = 0; i < modcount; ++i) { var name = br.ReadString(); var baseaddr = br.ReadUInt64(); var size = br.ReadUInt64(); Modules.Add(new ModuleInfo { Name = name, BaseAddress = baseaddr, SizeBytes = size }); } } { int markcount = br.ReadInt32(); m_Marks.Clear(); for (int i = 0; i < markcount; ++i) { var name = br.ReadString(); var time = br.ReadUInt64(); AddMark(new TraceMark { Name = name, TimeStamp = time }); } } { int symcount = br.ReadInt32(); Symbols = new List <ulong>(symcount); for (int i = 0; i < symcount; ++i) { var addr = br.ReadUInt64(); Symbols.Add(addr); } } { ResolvedSymbols.Clear(); int rsymcount = br.ReadInt32(); for (int i = 0; i < rsymcount; ++i) { var sym = new SymbolInfo(); ulong addr = br.ReadUInt64(); sym.FileName = br.ReadString(); sym.LineNumber = br.ReadInt32(); sym.Symbol = br.ReadString(); ResolvedSymbols[addr] = sym; } } if (Version > 0) { MemTraceInitCommonAddress = br.ReadUInt64(); } if (Version > 1) { ExecutableName = br.ReadString(); WarningCount = br.ReadInt32(); } if (Version > 3) { int warnTextCount = br.ReadInt32(); for (int i = 0; i < warnTextCount; ++i) { Warnings.Add(br.ReadString()); } } } } }