本文整理汇总了C#中Microsoft.Cci.Pdb.BitAccess.MinCapacity方法的典型用法代码示例。如果您正苦于以下问题:C# BitAccess.MinCapacity方法的具体用法?C# BitAccess.MinCapacity怎么用?C# BitAccess.MinCapacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Cci.Pdb.BitAccess
的用法示例。
在下文中一共展示了BitAccess.MinCapacity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MsfDirectory
internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits) {
bits.MinCapacity(head.directorySize);
int pages = reader.PagesFromSize(head.directorySize);
// 0..n in page of directory pages.
reader.Seek(head.directoryRoot, 0);
bits.FillBuffer(reader.reader, pages * 4);
DataStream stream = new DataStream(head.directorySize, bits, pages);
bits.MinCapacity(head.directorySize);
stream.Read(reader, bits);
// 0..3 in directory pages
int count;
bits.ReadInt32(out count);
// 4..n
int[] sizes = new int[count];
bits.ReadInt32(sizes);
// n..m
streams = new DataStream[count];
for (int i = 0; i < count; i++) {
if (sizes[i] <= 0) {
streams[i] = new DataStream();
} else {
streams[i] = new DataStream(sizes[i], bits,
reader.PagesFromSize(sizes[i]));
}
}
}
示例2: MsfDirectory
internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits)
{
int pages = reader.PagesFromSize(head.directorySize);
// 0..n in page of directory pages.
bits.MinCapacity(head.directorySize);
int directoryRootPages = head.directoryRoot.Length;
int pagesPerPage = head.pageSize / 4;
int pagesToGo = pages;
for (int i = 0; i < directoryRootPages; i++)
{
int pagesInThisPage = pagesToGo <= pagesPerPage ? pagesToGo : pagesPerPage;
reader.Seek(head.directoryRoot[i], 0);
bits.Append(reader.reader, pagesInThisPage * 4);
pagesToGo -= pagesInThisPage;
}
bits.Position = 0;
DataStream stream = new DataStream(head.directorySize, bits, pages);
bits.MinCapacity(head.directorySize);
stream.Read(reader, bits);
// 0..3 in directory pages
int count;
bits.ReadInt32(out count);
// 4..n
int[] sizes = new int[count];
bits.ReadInt32(sizes);
// n..m
streams = new DataStream[count];
for (int i = 0; i < count; i++)
{
if (sizes[i] <= 0)
{
streams[i] = new DataStream();
}
else
{
streams[i] = new DataStream(sizes[i], bits,
reader.PagesFromSize(sizes[i]));
}
}
}
示例3: Write
internal void Write(Stream writer, BitAccess bits) {
bits.MinCapacity(56);
bits.WriteBytes(magic); // 0..31
bits.WriteInt32(pageSize); // 32..35
bits.WriteInt32(freePageMap); // 36..39
bits.WriteInt32(pagesUsed); // 40..43
bits.WriteInt32(directorySize); // 44..47
bits.WriteInt32(zero); // 48..51
bits.WriteInt32(directoryRoot); // 52..55
writer.Seek(0, SeekOrigin.Begin);
bits.WriteBuffer(writer, 56);
}
示例4: PdbFileHeader
internal PdbFileHeader(Stream reader, BitAccess bits) {
bits.MinCapacity(56);
reader.Seek(0, SeekOrigin.Begin);
bits.FillBuffer(reader, 56);
this.magic = new byte[32];
bits.ReadBytes(this.magic); // 0..31
bits.ReadInt32(out this.pageSize); // 32..35
bits.ReadInt32(out this.freePageMap); // 36..39
bits.ReadInt32(out this.pagesUsed); // 40..43
bits.ReadInt32(out this.directorySize); // 44..47
bits.ReadInt32(out this.zero); // 48..51
bits.ReadInt32(out this.directoryRoot); // 52..55
}
示例5: WriteDirectory
private void WriteDirectory(DataStream[] streams,
out int directoryRoot,
out int directorySize,
BitAccess bits) {
DataStream directory = new DataStream();
int pages = 0;
for (int s = 0; s < streams.Length; s++) {
if (streams[s].Length > 0) {
pages += streams[s].Pages;
}
}
int use = 4 * (1 + streams.Length + pages);
bits.MinCapacity(use);
bits.WriteInt32(streams.Length);
for (int s = 0; s < streams.Length; s++) {
bits.WriteInt32(streams[s].Length);
}
for (int s = 0; s < streams.Length; s++) {
if (streams[s].Length > 0) {
bits.WriteInt32(streams[s].pages);
}
}
directory.Write(this, bits.Buffer, use);
directorySize = directory.Length;
use = 4 * directory.Pages;
bits.MinCapacity(use);
bits.WriteInt32(directory.pages);
DataStream ddir = new DataStream();
ddir.Write(this, bits.Buffer, use);
directoryRoot = ddir.pages[0];
}
示例6: PdbFileHeader
internal PdbFileHeader(Stream reader, BitAccess bits)
{
bits.MinCapacity(56);
reader.Seek(0, SeekOrigin.Begin);
bits.FillBuffer(reader, 52);
this.magic = new byte[32];
bits.ReadBytes(this.magic); // 0..31
bits.ReadInt32(out this.pageSize); // 32..35
bits.ReadInt32(out this.freePageMap); // 36..39
bits.ReadInt32(out this.pagesUsed); // 40..43
bits.ReadInt32(out this.directorySize); // 44..47
bits.ReadInt32(out this.zero); // 48..51
if (Magic != MAGIC) {
throw new InvalidOperationException("Magic is wrong.");
}
int directoryPages = ((((directorySize + pageSize - 1) / pageSize) * 4) + pageSize - 1) / pageSize;
this.directoryRoot = new int[directoryPages];
bits.FillBuffer(reader, directoryPages * 4);
bits.ReadInt32(this.directoryRoot);
}
示例7: Read
internal void Read(PdbReader reader, BitAccess bits)
{
bits.MinCapacity(contentSize);
Read(reader, 0, bits.Buffer, 0, contentSize);
}