Click here to Skip to main content
15,883,921 members
Articles / Programming Languages / C#

Building .NET Coverage Tool

Rate me:
Please Sign up or sign in to vote.
4.94/5 (34 votes)
25 Aug 2009MIT8 min read 84.7K   2.3K   109  
This article is a walkthrough for building a .NET coverage tool
//-----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation.  All Rights Reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.IO;

namespace Microsoft.Cci.Pdb {
  internal class PdbReader {
    internal PdbReader(Stream reader, int pageSize) {
      this.pageSize = pageSize;
      this.reader = reader;
    }

    internal void Seek(int page, int offset) {
      reader.Seek(page * pageSize + offset, SeekOrigin.Begin);
    }

    internal void Read(byte[] bytes, int offset, int count) {
      reader.Read(bytes, offset, count);
    }

    internal int PagesFromSize(int size) {
      return (size + pageSize - 1) / (pageSize);
    }

    internal int PageSize {
      get { return pageSize; }
    }

    internal readonly int pageSize;
    internal readonly Stream reader;
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions