// dnlib: See LICENSE.txt for more info
using System;
using dnlib.IO;
namespace dnlib.DotNet.MD {
///
/// Represents the #GUID stream
///
public sealed class GuidStream : HeapStream {
///
public GuidStream() {
}
///
public GuidStream(DataReaderFactory mdReaderFactory, uint metadataBaseOffset, StreamHeader streamHeader)
: base(mdReaderFactory, metadataBaseOffset, streamHeader) {
}
///
public override bool IsValidIndex(uint index) => index == 0 || (index <= 0x10000000 && IsValidOffset((index - 1) * 16, 16));
///
/// Read a
///
/// Index into this stream
/// A or null if is 0 or invalid
public Guid? Read(uint index) {
if (index == 0 || !IsValidIndex(index))
return null;
var reader = dataReader;
reader.Position = (index - 1) * 16;
return reader.ReadGuid();
}
}
}