/// <param name="stream">The index of the stream. This must be less than NumStreams.</param>
/// <returns>A Reader which can read the stream.</returns>
Reader GetStream(uint stream);
+
+ /// <summary>
+ /// Returns the container kind for this implementation.
+ /// </summary>
+ PDBContainerKind ContainerKind { get; }
+
+ /// <summary>
+ /// Returns a string which identifies the container kind, using a backward-compatible naming scheme.
+ /// <summary>
+ /// <para>
+ /// The existing PDB format is identified as "pdb", while PDZ (MSFZ) is identified as "msfz0".
+ /// This allows new versions of MSFZ to be identified and deployed without updating clients of this API.
+ /// </para>
+ public string ContainerKindSpecString { get; }
}
}
{
return _streams[index];
}
+
+ public PDBContainerKind ContainerKind
+ {
+ get { return PDBContainerKind.MSF; }
+ }
+
+ public string ContainerKindSpecString
+ {
+ get { return "msf"; }
+ }
}
}
/// </summary>
private readonly uint[] _streamDirStarts;
- private MSFZFile(Reader reader, uint numStreams, uint[] streamDir, uint[] streamDirStarts)
+ /// <summary>
+ /// The value of the "version" field from the MSFZ header.
+ /// </summary>
+ private readonly ulong _msfzVersion;
+
+ private MSFZFile(Reader reader, uint numStreams, uint[] streamDir, uint[] streamDirStarts, ulong msfzVersion)
{
Debug.Assert(numStreams == streamDirStarts.Length);
this._numStreams = numStreams;
this._reader = reader;
this._streamDir = streamDir;
this._streamDirStarts = streamDirStarts;
+ this._msfzVersion = msfzVersion;
}
public uint NumStreams
uint streamDirSizeCompressed = fileHeader.StreamDirSizeCompressed;
uint streamDirSizeUncompressed = fileHeader.StreamDirSizeUncompressed;
+ // Validate the MSFZ file header version. We keep track of the version in a variable,
+ // even though the only version that is actually supported is V0. This is to minimize
+ // code changes in future versions of this code that would parse V1, V2, etc.
if (headerVersion != MSFZFileHeader.VersionV0)
{
// Wrong version
// We do not read the Chunk Table because this implementation does not support
// compression. Since the Chunk Table describes compressed chunks, we will never use it.
- return new MSFZFile(reader, numStreams, streamDirEncoded, streamStarts);
+ return new MSFZFile(reader, numStreams, streamDirEncoded, streamStarts, headerVersion);
}
/// <summary>
return totalBytesTransferred;
}
+ public PDBContainerKind ContainerKind
+ {
+ get { return PDBContainerKind.MSFZ; }
+ }
+
+ public string ContainerKindSpecString
+ {
+ get { return $"msfz{_msfzVersion}"; }
+ }
public void Dispose()
{
}
return streamReaders;
}
+
+ /// <summary>
+ /// Returns the container kind used for this PDB file.
+ /// </summary>
+ public PDBContainerKind ContainerKind
+ {
+ get
+ {
+ CheckValid();
+ return _msfFile.ContainerKind;
+ }
+ }
+
+ /// <summary>
+ /// Returns a string which identifies the container kind, using a backward-compatible naming scheme.
+ /// <summary>
+ /// <para>
+ /// The existing PDB format is identified as "pdb", while PDZ (MSFZ) is identified as "msfz0".
+ /// This allows new versions of MSFZ to be identified and deployed without updating clients of this API.
+ /// </para>
+ public string ContainerKindSpecString
+ {
+ get
+ {
+ CheckValid();
+ return _msfFile.ContainerKindSpecString;
+ }
+ }
}
/// <summary>
public DbiStreamHeader Header { get { _header.Value.IsHeaderValid.CheckThrowing(); return _header.Value; } }
}
+
+ /// <summary>
+ /// Specifies the kinds of PDB container formats.
+ /// </summary>
+ public enum PDBContainerKind
+ {
+ /// <summary>
+ /// An uncompressed PDB.
+ /// </summary>
+ MSF,
+
+ /// <summary>
+ /// A compressed PDB, also known as a PDBZ or "PDB using MSFZ container".
+ /// </summary>
+ MSFZ,
+ }
}
Assert.Equal((uint)1, pdb.Age);
Assert.Equal(Guid.Parse("99891B3E-D7AE-4C3B-ABFF-8A2B4A9B0C43"), pdb.Signature);
+ Assert.Equal(PDBContainerKind.MSF, pdb.ContainerKind);
+ Assert.Equal("msf", pdb.ContainerKindSpecString);
+
// Also read the PDBI stream directly, using the downlevel API.
#pragma warning disable CS0618 // Type or member is obsolete
var stream1 = pdb.Streams[1];
Assert.Equal((uint)1, pdb.Age);
Assert.Equal(Guid.Parse("99891B3E-D7AE-4C3B-ABFF-8A2B4A9B0C43"), pdb.Signature);
+ Assert.Equal(PDBContainerKind.MSFZ, pdb.ContainerKind);
+ Assert.Equal("msfz0", pdb.ContainerKindSpecString);
+
// Also read the PDBI stream directly, using the downlevel API.
#pragma warning disable CS0618 // Type or member is obsolete
var stream1 = pdb.Streams[1];