当前位置: 首页>>代码示例>>C#>>正文


C# BitAccess.MinCapacity方法代码示例

本文整理汇总了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]));
        }
      }
    }
开发者ID:pusp,项目名称:o2platform,代码行数:31,代码来源:MsfDirectory.cs

示例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]));
        }
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:45,代码来源:MsfDirectory.cs

示例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);
    }
开发者ID:pusp,项目名称:o2platform,代码行数:13,代码来源:PdbFileHeader.cs

示例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
    }
开发者ID:pusp,项目名称:o2platform,代码行数:14,代码来源:PdbFileHeader.cs

示例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];
    }
开发者ID:pusp,项目名称:o2platform,代码行数:36,代码来源:PdbWriter.cs

示例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);
        }
开发者ID:jbevain,项目名称:cecil,代码行数:22,代码来源:PdbFileHeader.cs

示例7: Read

 internal void Read(PdbReader reader, BitAccess bits)
 {
     bits.MinCapacity(contentSize);
     Read(reader, 0, bits.Buffer, 0, contentSize);
 }
开发者ID:RoqueDeicide,项目名称:CryCIL,代码行数:5,代码来源:DataStream.cs


注:本文中的Microsoft.Cci.Pdb.BitAccess.MinCapacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。